@@ -112,6 +112,16 @@ a.sentence.down.has_note .heading {
112
112
height : 90px ;
113
113
}
114
114
115
+ .flote {
116
+ padding : 10px ;
117
+ font-family : Courier;
118
+ height : 90px ;
119
+ }
120
+
121
+ .mark {
122
+ cursor : pointer;
123
+ }
124
+
115
125
# tooltip {
116
126
position : absolute;
117
127
z-index : 3000 ;
@@ -132,6 +142,26 @@ a.sentence.down.has_note .heading {
132
142
font-weight : bold;
133
143
}
134
144
145
+ # tooltipflote {
146
+ position : absolute;
147
+ z-index : 3000 ;
148
+ border : 1px solid # 86acc1 ;
149
+ background-color : # fff ;
150
+ opacity : 0.85 ;
151
+ max-width : 450px ;
152
+ }
153
+ # tooltipflote .contain {
154
+ background : # cde9f8 ;
155
+ border : 2px solid # fff ;
156
+ color : black;
157
+ padding : 5px ;
158
+ }
159
+ # tooltipflote h3 , # tooltipflote div {
160
+ margin : 0 ;
161
+ font-size : 12px ;
162
+ font-weight : bold;
163
+ }
164
+
135
165
</ style >
136
166
137
167
< script type ="text/javascript ">
@@ -140,18 +170,22 @@ var t = null;
140
170
141
171
var save_review = function ( continuous ) {
142
172
var content = $ ( "#draft_content" ) . html ( ) ;
143
- $ . post ( "/drafts/save_review" , { authenticity_token : AUTH_TOKEN , draft_id : <%= @draft . id %> , content : content , signature : $ ( "#signature" ) . attr ( "value" ) , general_comments : $ ( "#general_comments" ) . val ( ) } ,
144
- function ( ret ) {
145
- var ret = JSON . parse ( ret ) ;
146
- var now = new Date ( ) ;
147
- document . title = "(saved at " + now . format ( "h:MM:sstt" ) + " on " + now . format ( "dddd dS, yyyy" ) + ")" ;
148
- }
149
- )
173
+ $ . post ( "/drafts/save_review" , {
174
+ authenticity_token : AUTH_TOKEN ,
175
+ draft_id : <%= @draft . id %> ,
176
+ content : content ,
177
+ signature : $ ( "#signature" ) . attr ( "value" ) ,
178
+ general_comments : $ ( "#general_comments" ) . val ( )
179
+ } ,
180
+ function ( ret ) {
181
+ var ret = JSON . parse ( ret ) ;
182
+ var now = new Date ( ) ;
183
+ document . title = "[draft]back » saved at " + now . format ( "h:MM:sstt" ) + " on " + now . format ( "dddd dS, yyyy" ) + "" ;
184
+ } ) ;
185
+
150
186
if ( continuous ) {
151
187
setTimeout ( "save_review(true)" , 1000 * 30 ) // Save every thirty seconds.
152
- } else {
153
- return false ;
154
- }
188
+ } else { return false ; }
155
189
} ;
156
190
157
191
var hide_notes = function ( affect ) {
@@ -166,6 +200,58 @@ var hide_notes = function(affect) {
166
200
} ;
167
201
168
202
$ ( document ) . ready ( function ( ) {
203
+ var flote_count = 0 ;
204
+ $ ( "#draft" ) . click ( function ( ev ) {
205
+ if ( ev . shiftKey ) {
206
+ $flote = $ ( "#flote" ) . clone ( ) ;
207
+ $flote . appendTo ( "#draft_content" ) ;
208
+ $flote . attr ( "id" , "flote-" + flote_count ) ;
209
+ flote_count += 1 ;
210
+ $flote . val ( $flote . val ( ) . replace ( "\n" , "" ) ) ;
211
+ $flote . css ( "top" , ( ev . pageY - 10 ) + "px" ) ;
212
+ $flote . css ( "left" , ( ev . pageX - 10 ) + "px" ) ;
213
+ $flote . show ( ) ;
214
+ $flote . focus ( ) ;
215
+ }
216
+ } ) ;
217
+
218
+ $ ( ".mark" ) . live ( "mouseover" ,
219
+ function ( ev ) {
220
+ var id = $ ( this ) . attr ( "id" ) . split ( "-" ) [ 1 ] ;
221
+ if ( $ ( "#flote-" + id ) . html ( ) != "" && $ ( "#flote-" + id ) . html ( ) != null ) {
222
+ $ ( "#show-flote" ) . html ( $ ( "#flote-" + id ) . html ( ) ) ;
223
+ $ ( "#tooltipflote" ) . css ( "top" , ev . pageY - 30 + "px" ) ;
224
+ $ ( "#tooltipflote" ) . css ( "left" , ev . pageX + 20 + "px" ) ;
225
+ //$("#note-" + id).css("height", $("#note-" + id)[0].scrollHeight);
226
+ $ ( "#tooltipflote" ) . show ( ) ;
227
+ } else {
228
+ $ ( "#tooltipflote" ) . hide ( ) ;
229
+ }
230
+ }
231
+ ) ;
232
+
233
+ $ ( ".mark" ) . live ( "mouseout" ,
234
+ function ( ev ) {
235
+ var id = $ ( this ) . attr ( "id" ) . split ( "-" ) [ 1 ] ;
236
+ $ ( "#tooltipflote" ) . hide ( ) ;
237
+ }
238
+ ) ;
239
+
240
+ $ ( ".mark" ) . live ( "mousemove" ,
241
+ function ( ev ) {
242
+ $ ( "#tooltipflote" ) . css ( "top" , ev . pageY - 30 + "px" ) ;
243
+ $ ( "#tooltipflote" ) . css ( "left" , ev . pageX + 20 + "px" ) ;
244
+ }
245
+ ) ;
246
+
247
+ $ ( ".mark" ) . live ( "click" ,
248
+ function ( ev ) {
249
+ var id = $ ( this ) . attr ( "id" ) . split ( "-" ) [ 1 ] ;
250
+ $ ( "#flote-" + id ) . show ( ) ;
251
+ $ ( "#flote-" + id ) . focus ( ) ;
252
+ }
253
+ ) ;
254
+
169
255
$ ( ".note" ) . live ( "keydown" , function ( e ) {
170
256
if ( e . keyCode == 13 ) {
171
257
$ ( this ) . hide ( ) ;
@@ -214,7 +300,50 @@ $(document).ready(function() {
214
300
return false ;
215
301
}
216
302
303
+ $ ( ".flote" ) . live ( "keydown" , function ( e ) {
304
+ if ( e . keyCode == 13 ) {
305
+ if ( $ ( this ) . val ( ) == "" ) {
306
+ if ( $ ( this ) . attr ( "id" ) != "flote" ) {
307
+ $ ( this ) . remove ( ) ;
308
+ $ ( this ) . hide ( ) ;
309
+ }
310
+ } else {
311
+ $ ( this ) . html ( $ ( this ) . val ( ) ) ;
312
+ $ ( this ) . hide ( ) ;
313
+ $mark = $ ( "#mark-" + $ ( this ) . attr ( "id" ) . split ( "-" ) [ 1 ] ) ;
314
+ if ( $mark . length == 0 ) {
315
+ $mark = $ ( "#mark" ) . clone ( ) ;
316
+ $mark . appendTo ( "#draft_content" ) ;
317
+ $mark . attr ( "id" , "mark-" + $ ( this ) . attr ( "id" ) . split ( "-" ) [ 1 ] ) ;
318
+ } ;
319
+ $mark . css ( "top" , $ ( this ) . css ( "top" ) ) ;
320
+ $mark . css ( "left" , $ ( this ) . css ( "left" ) ) ;
321
+ $mark . show ( ) ;
322
+ }
323
+ } ;
324
+ } ) ;
325
+
217
326
$ ( ".sentence" ) . click ( function ( ev ) {
327
+ $ ( ".flote" ) . each ( function ( ) {
328
+ if ( $ ( this ) . val ( ) == "" ) {
329
+ if ( $ ( this ) . attr ( "id" ) != "flote" ) {
330
+ $ ( this ) . remove ( ) ;
331
+ $ ( this ) . hide ( ) ;
332
+ }
333
+ } else {
334
+ $ ( this ) . html ( $ ( this ) . val ( ) ) ;
335
+ $ ( this ) . hide ( ) ;
336
+ $mark = $ ( "#mark-" + $ ( this ) . attr ( "id" ) . split ( "-" ) [ 1 ] ) ;
337
+ if ( $mark . length == 0 ) {
338
+ $mark = $ ( "#mark" ) . clone ( ) ;
339
+ $mark . appendTo ( "#draft_content" ) ;
340
+ $mark . attr ( "id" , "mark-" + $ ( this ) . attr ( "id" ) . split ( "-" ) [ 1 ] ) ;
341
+ } ;
342
+ $mark . css ( "top" , $ ( this ) . css ( "top" ) ) ;
343
+ $mark . css ( "left" , $ ( this ) . css ( "left" ) ) ;
344
+ $mark . show ( ) ;
345
+ }
346
+ } ) ;
218
347
clearTimeout ( t ) ;
219
348
$ ( ".note" ) . each ( function ( e ) {
220
349
$ ( this ) . hide ( ) ;
@@ -276,7 +405,10 @@ $(document).ready(function() {
276
405
} ) ;
277
406
</ script >
278
407
< div id ="tooltip " style ="display: none; right: auto; "> < div class ="contain "> < h3 > < span id ="show-note "> </ span > </ h3 > </ div > </ div >
408
+ < div id ="tooltipflote " style ="display: none; right: auto; "> < div class ="contain "> < h3 > < span id ="show-flote "> </ span > </ h3 > </ div > </ div >
409
+ < textarea id ="flote " class ="flote " affect ="neutral " style ="width: 250px; position: absolute; display: none; z-index: 999 "> </ textarea >
279
410
< textarea id ="note " class ="note " affect ="neutral " style ="width: 250px; position: absolute; display: none; "> </ textarea >
411
+ < div id ="mark " class ="mark " style ="position: absolute; display: none; font-size: 12px; color: #ff5544; z-index: 10 "> ●</ div >
280
412
< div class ="instructions ">
281
413
< h2 style ="margin: 2px 0px 5px 0px; "> Instructions:</ h2 >
282
414
< ol style ="font-size: 11px; ">
@@ -288,7 +420,7 @@ $(document).ready(function() {
288
420
289
421
< div id ="draft ">
290
422
< div style ="float: right; margin-top: 10px; "> < a href ="/drafts/refresh_review?public_url=<%= params [ :id ] %> &draft_id= <%= @draft . id %> "> Refresh latest draft and start over</ a > </ div >
291
- < h1 style ="font-family: Arial; font-size: 22px; margin-top: 20px; line-height: 1.2em; "> <%= @draft . title %> </ h1 >
423
+ < h1 style ="font-family: Arial; font-size: 22px; margin-top: 20px; line-height: 1.2em; "> < a class =" sentence " href =" # " id =" sent-0 " > < %= @draft . title %> </ a > </ h1 >
292
424
< div id ="draft_content ">
293
425
<% if @content . nil? %>
294
426
Whoops, it looks like something's gone horribly wrong and we've lost your work.
0 commit comments