Index: trunk/extensions/Reflect/client/css/reflect.css |
— | — | @@ -220,6 +220,7 @@ |
221 | 221 | height: 60px; |
222 | 222 | padding: 4px 2px; |
223 | 223 | width:100%; |
| 224 | + overflow: auto; |
224 | 225 | } |
225 | 226 | |
226 | 227 | #reflected .rf_comment_summary tr.submit_footer { |
— | — | @@ -464,7 +465,7 @@ |
465 | 466 | |
466 | 467 | #reflected div.new_bullet_prompt { |
467 | 468 | position:absolute; |
468 | | - top:-7px; |
| 469 | + top:-9px; |
469 | 470 | z-index:50; |
470 | 471 | width:92%; |
471 | 472 | margin-left:3px; |
Index: trunk/extensions/Reflect/client/js/reflect.js |
— | — | @@ -156,7 +156,9 @@ |
157 | 157 | |
158 | 158 | text = jQuery.trim( |
159 | 159 | text.substring( 0, |
160 | | - text.indexOf( "<span class=\"username\">" ) ) ); |
| 160 | + text |
| 161 | + .toLowerCase() |
| 162 | + .indexOf( "<span class=" ) ) ); |
161 | 163 | function add_highlights () { |
162 | 164 | var el_id = $j( this ).attr( 'id' ).substring( 9 ); |
163 | 165 | highlights.push( { |
— | — | @@ -859,7 +861,6 @@ |
860 | 862 | var highlight = bullet_obj.enter_highlight_state(); |
861 | 863 | |
862 | 864 | highlight.find( 'td:first' ).addClass( 'connect_directions' ) |
863 | | - .text( 'Please click the relevant sentences' ) |
864 | 865 | .css( 'color', Reflect.utils.get_background_color( highlight ) ) |
865 | 866 | .css( 'background-color', Reflect.utils |
866 | 867 | .get_inverted_background_color( highlight, function ( c ) { |
— | — | @@ -992,39 +993,38 @@ |
993 | 994 | return Reflect.current_user; |
994 | 995 | }, |
995 | 996 | |
996 | | - get_background_color : function ( node ) { |
997 | | - var current_p = $j( node ), |
998 | | - rgbString = "transparent"; |
999 | | - while ( current_p |
1000 | | - && (rgbString == "transparent" |
1001 | | - || rgbString == "initial" |
1002 | | - || rgbString == 'rgba(0, 0, 0, 0)') ) |
1003 | | - { |
1004 | | - rgbString = current_p.parent().css( 'background-color' ); |
1005 | | - current_p = current_p.parent(); |
| 997 | + get_background_color : function ( node, no_convert ) { |
| 998 | + col = $j.getColor(node[0], 'background-color'); |
| 999 | + if ( !no_convert ) { |
| 1000 | + var new_col = "#"; |
| 1001 | + for ( var i = 0; i <= 2; ++i) { |
| 1002 | + var new_color = col[i].toString( 16 ); |
| 1003 | + if ( new_color.length == 1 ) { |
| 1004 | + new_color = '0' + new_color; |
| 1005 | + } |
| 1006 | + new_col += new_color; |
| 1007 | + } |
| 1008 | + col = new_col; |
1006 | 1009 | } |
1007 | | - if ( !rgbString ) { |
1008 | | - rgbString = 'rgb(0, 0, 0)'; |
1009 | | - } |
1010 | | - return rgbString; |
| 1010 | + return col |
1011 | 1011 | }, |
1012 | 1012 | |
1013 | 1013 | get_inverted_background_color : function ( node, color_convert ) { |
1014 | 1014 | try { |
1015 | | - var rgbString = Reflect.utils.get_background_color( node ), |
1016 | | - parts = rgbString.match( /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/ ), |
| 1015 | + var rgbString = Reflect.utils.get_background_color( node, true ), |
1017 | 1016 | res = '#'; |
1018 | | - for ( var i = 1; i <= 3; ++i) { |
1019 | | - var color = parseInt( parts[i] ), |
1020 | | - new_color = color_convert( color ); |
1021 | | - parts[i] = new_color.toString( 16 ); |
1022 | | - if ( parts[i].length == 1 ) { |
1023 | | - parts[i] = '0' + parts[i]; |
| 1017 | + |
| 1018 | + for ( var i = 0; i <= 2; ++i) { |
| 1019 | + var new_color = color_convert( rgbString[i] ) |
| 1020 | + .toString( 16 ); |
| 1021 | + if ( new_color.length == 1 ) { |
| 1022 | + new_color = '0' + new_color; |
1024 | 1023 | } |
1025 | | - res += parts[i]; |
| 1024 | + res += new_color; |
1026 | 1025 | } |
1027 | 1026 | return res; |
1028 | 1027 | } catch ( err ) { |
| 1028 | + console.log(err); |
1029 | 1029 | return '#555'; |
1030 | 1030 | } |
1031 | 1031 | } |
— | — | @@ -1247,7 +1247,8 @@ |
1248 | 1248 | if ( modify ) { |
1249 | 1249 | text = this.elements.bullet_text.html(); |
1250 | 1250 | text = $j.trim( text.substring( 0, text |
1251 | | - .indexOf( "<span class=\"username\">" ) ) ); |
| 1251 | + .toLowerCase() |
| 1252 | + .indexOf( "<span class=" ) ) ); |
1252 | 1253 | } |
1253 | 1254 | |
1254 | 1255 | var template_vars = { |
— | — | @@ -1411,7 +1412,8 @@ |
1412 | 1413 | if ( modify ) { |
1413 | 1414 | var text = this.elements.response_text.html(); |
1414 | 1415 | this.options.text = $j.trim( text.substring( 0, text |
1415 | | - .indexOf( "<span class=\"username\">" ) ) ); |
| 1416 | + .toLowerCase() |
| 1417 | + .indexOf( "<span class=" ) ) ); |
1416 | 1418 | } |
1417 | 1419 | |
1418 | 1420 | this._build_prompt(); |
— | — | @@ -1600,12 +1602,13 @@ |
1601 | 1603 | if ( Reflect.config.study ) { |
1602 | 1604 | Reflect.study.load_surveys(); |
1603 | 1605 | } |
1604 | | - |
1605 | 1606 | } ); |
1606 | 1607 | } ); |
1607 | 1608 | } |
1608 | 1609 | }; |
1609 | 1610 | |
1610 | 1611 | $j( document ).ready( function () { |
| 1612 | + $j.ajaxSetup({ cache: false }); |
| 1613 | + |
1611 | 1614 | Reflect.init(); |
1612 | 1615 | } ); |
Index: trunk/extensions/Reflect/client/js/reflect.study.js |
— | — | @@ -16,6 +16,24 @@ |
17 | 17 | // /////////////////// |
18 | 18 | } |
19 | 19 | |
| 20 | + |
| 21 | +function filter(a, fun){ |
| 22 | + var len = a.length >>> 0; |
| 23 | + if (typeof fun != "function") |
| 24 | + throw new TypeError(); |
| 25 | + |
| 26 | + var res = []; |
| 27 | + var thisp = arguments[1]; |
| 28 | + for (var i = 0; i < len; i++) { |
| 29 | + if (i in a) { |
| 30 | + var val = a[i]; // in case fun mutates this |
| 31 | + if (fun.call(thisp, val, i, a)) |
| 32 | + res.push(val); |
| 33 | + } |
| 34 | + } |
| 35 | + return res; |
| 36 | +} |
| 37 | + |
20 | 38 | var $j = jQuery.noConflict(); |
21 | 39 | |
22 | 40 | Reflect.study = { |
— | — | @@ -25,8 +43,13 @@ |
26 | 44 | user = Reflect.utils.get_logged_in_user(); |
27 | 45 | // in a but not in b |
28 | 46 | function relative_complement ( a, b ) { |
29 | | - return a.filter( function ( elem ) { |
30 | | - return b.indexOf( elem ) == -1; |
| 47 | + return filter(a,function ( elem ) { |
| 48 | + for ( var i in b ) { |
| 49 | + if ( b[i] == elem ) { |
| 50 | + return false; |
| 51 | + } |
| 52 | + } |
| 53 | + return true; |
31 | 54 | } ); |
32 | 55 | } |
33 | 56 | $j( '.bullet' ).each( function () { |
— | — | @@ -43,18 +66,19 @@ |
44 | 67 | // for each candidate bullet NOT in data, lay down |
45 | 68 | // appropriate survey |
46 | 69 | var needs_surveys = relative_complement( bullets, data ); |
47 | | - for ( var i in needs_surveys) { |
48 | | - var bullet = $j( '#bullet-' + needs_surveys[i] ) |
49 | | - .data( 'bullet' ); |
50 | | - if ( bullet.comment.user == user |
51 | | - && bullet.responses.length > 0 |
52 | | - && bullet.responses[0].data( 'response' ).id ) { |
53 | | - Reflect.study.new_bullet_reaction_survey( |
54 | | - bullet, bullet.comment, bullet.$elem ); |
55 | | - } else if ( bullet.user == user ) { |
56 | | - Reflect.study.new_bullet_survey( |
57 | | - bullet, bullet.comment, bullet.$elem ); |
58 | | - } |
| 70 | + for (var i in needs_surveys) { |
| 71 | + try { |
| 72 | + var bullet = $j('#bullet-' + needs_surveys[i]).data('bullet'); |
| 73 | + if (bullet.comment.user == user && |
| 74 | + bullet.responses.length > 0 && |
| 75 | + bullet.responses[0].data('response').id) { |
| 76 | + Reflect.study.new_bullet_reaction_survey(bullet, bullet.comment, bullet.$elem); |
| 77 | + } |
| 78 | + else |
| 79 | + if (bullet.user == user) { |
| 80 | + Reflect.study.new_bullet_survey(bullet, bullet.comment, bullet.$elem); |
| 81 | + } |
| 82 | + } catch( err ) {} |
59 | 83 | } |
60 | 84 | |
61 | 85 | } ); |
Index: trunk/extensions/Reflect/client/js/third_party/json2.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * No warranty expressed or implied. Use at your own risk. |
6 | 6 | * See http://www.JSON.org/js.html |
7 | 7 | */ |
8 | | -if(!this.JSON){JSON=function(){function f(n){return n<10?'0'+n:n;} |
| 8 | +JSON=function(){function f(n){return n<10?'0'+n:n;} |
9 | 9 | Date.prototype.toJSON=function(){return this.getUTCFullYear()+'-'+ |
10 | 10 | f(this.getUTCMonth()+1)+'-'+ |
11 | 11 | f(this.getUTCDate())+'T'+ |
— | — | @@ -21,4 +21,4 @@ |
22 | 22 | return{stringify:stringify,parse:function(text,filter){var j;function walk(k,v){var i,n;if(v&&typeof v==='object'){for(i in v){if(Object.prototype.hasOwnProperty.apply(v,[i])){n=walk(i,v[i]);if(n!==undefined){v[i]=n;}}}} |
23 | 23 | return filter(k,v);} |
24 | 24 | if(/^[\],:{}\s]*$/.test(text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof filter==='function'?walk('',j):j;} |
25 | | -throw new SyntaxError('parseJSON');}};}();} |
\ No newline at end of file |
| 25 | +throw new SyntaxError('parseJSON');}};}(); |
\ No newline at end of file |
Index: trunk/extensions/Reflect/client/js/third_party/jquery.color.js |
— | — | @@ -123,4 +123,7 @@ |
124 | 124 | yellow:[255,255,0] |
125 | 125 | }; |
126 | 126 | |
| 127 | + jQuery.extend({getColor: getColor}); |
127 | 128 | })(jQuery); |
| 129 | + |
| 130 | + |
Index: trunk/extensions/Reflect/client/templates/templates.html |
— | — | @@ -2,28 +2,28 @@ |
3 | 3 | <![CDATA[ |
4 | 4 | <div class="new_bullet_prompt"> |
5 | 5 | <ul> |
6 | | - <li class=elicitation>Add a point that <%= this.commenter %> makes...</li> |
7 | | - <li class=count> |
8 | | - <a title="Please limit your bullet to 140 characters or less."><span class=count></span></a> |
| 6 | + <li class="elicitation">Add a point that <%= this.commenter %> makes...</li> |
| 7 | + <li class="count"> |
| 8 | + <a title="Please limit your bullet to 140 characters or less."><span class="count"></span></a> |
9 | 9 | </li> |
10 | 10 | </ul> |
11 | 11 | </div> |
12 | 12 | <table class="new_bullet_wrapper reflect"> |
13 | 13 | <tr> |
14 | | - <td class=new_bullet_text_wrap> |
15 | | - <textarea class=new_bullet_text><% if (this.txt) %><%= this.txt %></textarea> |
| 14 | + <td class="new_bullet_text_wrap"> |
| 15 | + <textarea class="new_bullet_text"><% if (this.txt) %><%= this.txt %></textarea> |
16 | 16 | </td> |
17 | | - <td class=submit_buttons> |
| 17 | + <td class="submit_buttons"> |
18 | 18 | <div><button class="cancel_bullet"><img src="<%= this.media_dir %>/cancel2.png" ></button></div> |
19 | 19 | </td> |
20 | 20 | </tr> |
21 | | - <tr class=submit_footer> |
| 21 | + <tr class="submit_footer"> |
22 | 22 | <td> |
23 | 23 | <ul> |
24 | | - <li class=submit> |
| 24 | + <li class="submit"> |
25 | 25 | <button class="bullet_submit">Done</button> |
26 | 26 | </li> |
27 | | - <li class=be_neutral> |
| 27 | + <li class="be_neutral"> |
28 | 28 | <a title="Someone else reading your summary bullet point should not be able to tell whether YOU agree or disagree it."> |
29 | 29 | don't respond, <span class="big_word">summarize</span> |
30 | 30 | </a> |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | <script type="text/html" id="reflect_template_new_response"> |
67 | 67 | <![CDATA[ |
68 | 68 | <ul class="rebutt_list" > |
69 | | - <li class=img> |
| 69 | + <li class="img"> |
70 | 70 | <% if(this.sig == "2") { %> |
71 | 71 | <span class="response_yes">+</span> |
72 | 72 | <% } else if(this.sig == "1") { %> |
— | — | @@ -74,10 +74,10 @@ |
75 | 75 | <span class="response_no">-</span> |
76 | 76 | <% } %> |
77 | 77 | </li> |
78 | | - <li class=rebutt_txt><%= this.text %> <span class=username><a class=user><%= this.user %></a></span></li> |
| 78 | + <li class="rebutt_txt"><%= this.text %> <span class="username"><a class=user><%= this.user %></a></span></li> |
79 | 79 | </ul> |
80 | | - <ul class=response_footer_wrapper> |
81 | | - <li class=modify_operation> |
| 80 | + <ul class="response_footer_wrapper"> |
| 81 | + <li class="modify_operation"> |
82 | 82 | <button class="modify"> |
83 | 83 | <a title="modify"> |
84 | 84 | <img class="base" src="<%= this.media_dir %>/edit.png"> |
— | — | @@ -87,8 +87,8 @@ |
88 | 88 | </li> |
89 | 89 | <li class="delete_operation"> |
90 | 90 | <button class="delete"> |
91 | | - <img class=base src="<%= this.media_dir %>/delete_gray.png"> |
92 | | - <img title="Delete" class=hover src="<%= this.media_dir %>/delete_red.png"> |
| 91 | + <img class="base" src="<%= this.media_dir %>/delete_gray.png"> |
| 92 | + <img title="Delete" class="hover" src="<%= this.media_dir %>/delete_red.png"> |
93 | 93 | </button> |
94 | 94 | </li> |
95 | 95 | <li class="dispute_operation"> |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | <img class="base" src="<%= this.media_dir %>/comment-flag.png"> |
98 | 98 | <img class=hover src="<%= this.media_dir %>/comment-flag-hover.png"> |
99 | 99 | </span> |
100 | | - <ul class=bullet_report_problem> |
| 100 | + <ul class="bullet_report_problem"> |
101 | 101 | <li>not written neutrally</li> |
102 | 102 | </ul> |
103 | 103 | </li> |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | <ul class="response_def"> |
122 | 122 | <li class="response_prompt"> |
123 | 123 | <label class="prompt">Did you make this point?</label> |
124 | | - <ul class=response_eval> |
| 124 | + <ul class="response_eval"> |
125 | 125 | <li><input type="radio" name="accurate-<%=this.bullet_id %>" value="2" <% if(this.sig == "2"){ %> CHECKED <% } %>>Yes</li> |
126 | 126 | <li><input type="radio" name="accurate-<%=this.bullet_id %>" value="1" <% if(this.sig == "1"){ %> CHECKED <% } %>>Kind of...</li> |
127 | 127 | <li><input type="radio" name="accurate-<%=this.bullet_id %>" value="0" <% if(this.sig == "0"){ %> CHECKED <% } %>>No</li> |
— | — | @@ -129,10 +129,10 @@ |
130 | 130 | <li class=response_dialog> |
131 | 131 | <table class="new_bullet_wrapper reflect"> |
132 | 132 | <tr> |
133 | | - <td class=new_bullet_text_wrap> |
| 133 | + <td class="new_bullet_text_wrap"> |
134 | 134 | <textarea class="new_bullet_text"><% if(this.text) %><%= this.text %></textarea> |
135 | 135 | </td> |
136 | | - <td class=submit_buttons> |
| 136 | + <td class="submit_buttons"> |
137 | 137 | <div> |
138 | 138 | <button class="cancel_bullet"> |
139 | 139 | <img src="<%= this.media_dir %>/cancel2.png"> |
— | — | @@ -140,13 +140,13 @@ |
141 | 141 | </div> |
142 | 142 | </td> |
143 | 143 | </tr> |
144 | | - <tr class=submit_footer> |
| 144 | + <tr class="submit_footer"> |
145 | 145 | <td> |
146 | 146 | <ul> |
147 | | - <li class=submit> |
| 147 | + <li class="submit"> |
148 | 148 | <button class="bullet_submit">Done</button> |
149 | 149 | </li> |
150 | | - <li class=count> |
| 150 | + <li class="count"> |
151 | 151 | <a title="Please limit your response to 140 characters or less."> |
152 | 152 | <span class="count"></span> |
153 | 153 | </a> |
— | — | @@ -169,29 +169,29 @@ |
170 | 170 | <%= this.bullet_text %> <span class="username"><a class="user"><%= this.user %></a></span> |
171 | 171 | </li> |
172 | 172 | <li class="bullet_footer_wrapper"> |
173 | | - <ul class=bullet_operations> |
174 | | - <li class=modify_operation> |
175 | | - <button class=modify> |
| 173 | + <ul class="bullet_operations"> |
| 174 | + <li class="modify_operation"> |
| 175 | + <button class="modify"> |
176 | 176 | <a title="modify"> |
177 | | - <img class=base src="<%= this.media_dir %>/edit.png"></img> |
178 | | - <img title="Modify" class=hover src="<%= this.media_dir %>/edit_hover.png"></img> |
| 177 | + <img class="base" src="<%= this.media_dir %>/edit.png"></img> |
| 178 | + <img title="Modify" class="hover" src="<%= this.media_dir %>/edit_hover.png"></img> |
179 | 179 | </a> |
180 | 180 | </button> |
181 | 181 | </li> |
182 | | - <li class=delete_operation> |
183 | | - <button class=delete> |
| 182 | + <li class="delete_operation"> |
| 183 | + <button class="delete"> |
184 | 184 | <a title="delete"> |
185 | | - <img class=base src="<%= this.media_dir %>/delete_gray.png"></img> |
186 | | - <img title="Delete" class=hover src="<%= this.media_dir %>/delete_red.png"></img> |
| 185 | + <img class="base" src="<%= this.media_dir %>/delete_gray.png"></img> |
| 186 | + <img title="Delete" class="hover" src="<%= this.media_dir %>/delete_red.png"></img> |
187 | 187 | </a> |
188 | 188 | </button> |
189 | 189 | </li> |
190 | | - <li class=dispute_operation> |
| 190 | + <li class="dispute_operation"> |
191 | 191 | <span class="bullet_prompt_problem"> |
192 | | - <img class=base src="<%= this.media_dir %>/comment-flag.png"></img> |
193 | | - <img class=hover src="<%= this.media_dir %>/comment-flag-hover.png"></img> |
| 192 | + <img class="base" src="<%= this.media_dir %>/comment-flag.png"></img> |
| 193 | + <img class="hover" src="<%= this.media_dir %>/comment-flag-hover.png"></img> |
194 | 194 | </span> |
195 | | - <ul class=bullet_report_problem> |
| 195 | + <ul class="bullet_report_problem"> |
196 | 196 | <li class="flag" name="input">not a summary</li> |
197 | 197 | <li class="flag" name="neutral">not written neutrally</li> |
198 | 198 | <li class="flag" name="accurate"><a class=user><%= this.commenter %></a> didn't say this</li> |