Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsXML.php |
— | — | @@ -290,7 +290,6 @@ |
291 | 291 | $encPath = htmlspecialchars( FlaggedRevs::styleUrlPath() . '/img' ); |
292 | 292 | $img = '<img id="mw-fr-revisiontoggle" class="fr-toggle-arrow"'; |
293 | 293 | $img .= " src=\"{$encPath}/arrow-down.png\" style=\"display:none;\""; |
294 | | - $img .= ' onmouseover="FlaggedRevs.onBoxMouseOver()"'; |
295 | 294 | $img .= ' alt="' . wfMsgHtml( 'revreview-toggle-title' ) . '" />'; |
296 | 295 | return $img; |
297 | 296 | } |
— | — | @@ -301,8 +300,7 @@ |
302 | 301 | */ |
303 | 302 | public static function ratingToggle() { |
304 | 303 | return '<a id="mw-fr-revisiontoggle" class="fr-toggle-symbol"' . |
305 | | - ' style="display:none;" onclick="FlaggedRevs.toggleBoxDetails()" title="' . |
306 | | - wfMsgHtml( 'revreview-toggle-title' ) . '" >' . |
| 304 | + ' style="display:none;" title="' . wfMsgHtml( 'revreview-toggle-title' ) . '" >' . |
307 | 305 | wfMsgHtml( 'revreview-toggle-show' ) . '</a>'; |
308 | 306 | } |
309 | 307 | |
— | — | @@ -311,8 +309,7 @@ |
312 | 310 | * @return string |
313 | 311 | */ |
314 | 312 | public static function diffToggle() { |
315 | | - $toggle = '<a class="fr-toggle-text" ' . |
316 | | - ' onclick="FlaggedRevs.toggleDiff()" title="' . |
| 313 | + $toggle = '<a class="fr-toggle-text" title="' . |
317 | 314 | wfMsgHtml( 'revreview-diff-toggle-title' ) . '" >' . |
318 | 315 | wfMsgHtml( 'revreview-diff-toggle-show' ) . '</a>'; |
319 | 316 | return '<span id="mw-fr-difftoggle" style="display:none;">' . |
— | — | @@ -324,11 +321,10 @@ |
325 | 322 | * @return string |
326 | 323 | */ |
327 | 324 | public static function logToggle() { |
328 | | - $toggle = '<a class="fr-toggle-text" ' . |
329 | | - ' onclick="FlaggedRevs.toggleLog()" title="' . |
| 325 | + $toggle = '<a class="fr-toggle-text" title="' . |
330 | 326 | wfMsgHtml( 'revreview-log-toggle-title' ) . '" >' . |
331 | 327 | wfMsgHtml( 'revreview-log-toggle-show' ) . '</a>'; |
332 | | - return '<span id="mw-fr-logtoggle" style="display:none;">' . |
| 328 | + return '<span id="mw-fr-logtoggle" class="fr-logtoggle-excerpt" style="display:none;">' . |
333 | 329 | wfMsgHtml( 'parentheses', $toggle ) . '</span>'; |
334 | 330 | } |
335 | 331 | |
— | — | @@ -337,11 +333,10 @@ |
338 | 334 | * @return string |
339 | 335 | */ |
340 | 336 | public static function logDetailsToggle() { |
341 | | - $toggle = '<a class="fr-toggle-text" ' . |
342 | | - ' onclick="FlaggedRevs.toggleLogDetails()" title="' . |
| 337 | + $toggle = '<a class="fr-toggle-text" title="' . |
343 | 338 | wfMsgHtml( 'revreview-log-details-title' ) . '" >' . |
344 | 339 | wfMsgHtml( 'revreview-log-details-show' ) . '</a>'; |
345 | | - return '<span id="mw-fr-logtoggle" style="display:none;">' . |
| 340 | + return '<span id="mw-fr-logtoggle" class="fr-logtoggle-details" style="display:none;">' . |
346 | 341 | wfMsgHtml( 'parentheses', $toggle ) . '</span>'; |
347 | 342 | } |
348 | 343 | |
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedPageView.php |
— | — | @@ -364,12 +364,9 @@ |
365 | 365 | } else { |
366 | 366 | $this->showDraftVersion( $srev, $tag, $prot ); |
367 | 367 | } |
368 | | - $encJS = ''; // JS events to use |
369 | 368 | # Some checks for which tag CSS to use |
370 | 369 | if ( $this->useSimpleUI() ) { |
371 | 370 | $tagClass = 'flaggedrevs_short'; |
372 | | - # Collapse the box details on mouseOut |
373 | | - $encJS .= ' onmouseout="FlaggedRevs.onBoxMouseOut(event)"'; |
374 | 371 | } elseif ( $pristine ) { |
375 | 372 | $tagClass = 'flaggedrevs_pristine'; |
376 | 373 | } elseif ( $quality ) { |
— | — | @@ -380,7 +377,7 @@ |
381 | 378 | # Wrap tag contents in a div |
382 | 379 | if ( $tag != '' ) { |
383 | 380 | $css = "{$tagClass} plainlinks noprint"; |
384 | | - $notice = "<div id=\"mw-fr-revisiontag\" class=\"{$css}\"{$encJS}>{$tag}</div>\n"; |
| 381 | + $notice = "<div id=\"mw-fr-revisiontag\" class=\"{$css}\">{$tag}</div>\n"; |
385 | 382 | $this->reviewNotice .= $notice; |
386 | 383 | } |
387 | 384 | return true; |
Index: trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.js |
— | — | @@ -14,21 +14,31 @@ |
15 | 15 | var toggle = $('#mw-fr-revisiontoggle'); |
16 | 16 | if ( toggle.length ) { |
17 | 17 | toggle.css('display','inline'); /* show toggle control */ |
18 | | - this.hideBoxDetails(); /* hide the initially displayed ratings */ |
| 18 | + FlaggedRevs.hideBoxDetails(); /* hide the initially displayed ratings */ |
19 | 19 | } |
20 | | - // Enables diff detail box |
| 20 | + // Bar UI: Toggle the box when the toggle is clicked |
| 21 | + $('.fr-toggle-symbol#mw-fr-revisiontoggle').click( FlaggedRevs.toggleBoxDetails ); |
| 22 | + // Simple UI: Show the box on mouseOver |
| 23 | + $('.fr-toggle-arrow#mw-fr-revisiontoggle').mouseover( FlaggedRevs.onBoxMouseOver ); |
| 24 | + $('.flaggedrevs_short#mw-fr-revisiontag').mouseout( FlaggedRevs.onBoxMouseOut ); |
| 25 | + |
| 26 | + // Enables diff detail box and toggle |
21 | 27 | toggle = $('#mw-fr-difftoggle'); |
22 | 28 | if ( toggle.length ) { |
23 | 29 | toggle.css('display','inline'); /* show toggle control */ |
24 | 30 | $('#mw-fr-stablediff').hide(); |
25 | 31 | } |
26 | | - // Enables log detail box |
| 32 | + toggle.children('a').click( FlaggedRevs.toggleDiff ); |
| 33 | + |
| 34 | + // Enables log detail box and toggle |
27 | 35 | toggle = $('#mw-fr-logtoggle'); |
28 | 36 | if ( toggle.length ) { |
29 | 37 | toggle.css('display','inline'); /* show toggle control */ |
30 | 38 | $('#mw-fr-logexcerpt').hide(); |
31 | 39 | } |
32 | | - // Enables changing of save button when "review this" checkbox changes */ |
| 40 | + toggle.children('a').click( FlaggedRevs.toggleLog ); |
| 41 | + |
| 42 | + // Enables changing of save button when "review this" checkbox changes |
33 | 43 | $('#wpReviewEdit').click( FlaggedRevs.updateSaveButton ); |
34 | 44 | }, |
35 | 45 | |
— | — | @@ -49,11 +59,11 @@ |
50 | 60 | if ( toggle.length && ratings.length ) { |
51 | 61 | // Collapsed -> expand |
52 | 62 | if ( ratings.css('display') == 'none' ) { |
53 | | - this.showBoxDetails(); |
| 63 | + FlaggedRevs.showBoxDetails(); |
54 | 64 | toggle.text( mw.msg('revreview-toggle-hide') ); |
55 | 65 | // Expanded -> collapse |
56 | 66 | } else { |
57 | | - this.hideBoxDetails(); |
| 67 | + FlaggedRevs.hideBoxDetails(); |
58 | 68 | toggle.text( mw.msg('revreview-toggle-show') ); |
59 | 69 | } |
60 | 70 | } |
— | — | @@ -61,15 +71,15 @@ |
62 | 72 | |
63 | 73 | /* Expands flag info box details on mouseOver */ |
64 | 74 | 'onBoxMouseOver': function( event ) { |
65 | | - window.clearTimeout( this.boxCollapseTimer ); |
66 | | - this.boxCollapseTimer = null; |
67 | | - this.showBoxDetails(); |
| 75 | + window.clearTimeout( FlaggedRevs.boxCollapseTimer ); |
| 76 | + FlaggedRevs.boxCollapseTimer = null; |
| 77 | + FlaggedRevs.showBoxDetails(); |
68 | 78 | }, |
69 | 79 | |
70 | 80 | /* Hides flag info box details on mouseOut *except* for event bubbling */ |
71 | 81 | 'onBoxMouseOut': function( event ) { |
72 | | - if ( !this.isMouseOutBubble( event, 'mw-fr-revisiontag' ) ) { |
73 | | - this.boxCollapseTimer = window.setTimeout( this.hideBoxDetails, 150 ); |
| 82 | + if ( !FlaggedRevs.isMouseOutBubble( event, 'mw-fr-revisiontag' ) ) { |
| 83 | + FlaggedRevs.boxCollapseTimer = window.setTimeout( FlaggedRevs.hideBoxDetails, 150 ); |
74 | 84 | } |
75 | 85 | }, |
76 | 86 | |
— | — | @@ -113,27 +123,20 @@ |
114 | 124 | var log = $('#mw-fr-logexcerpt'); |
115 | 125 | var toggle = $('#mw-fr-logtoggle'); |
116 | 126 | if ( log.length && toggle.length ) { |
117 | | - if ( log.css('display') == 'none' ) { |
118 | | - log.show(); |
119 | | - toggle.children('a').text( mw.msg('revreview-log-toggle-hide') ); |
| 127 | + // Two different message sets used here... |
| 128 | + if ( toggle.hasClass('fr-logtoggle-details') ) { |
| 129 | + var hideMsg = mw.msg('revreview-log-details-hide'); |
| 130 | + var showMsg = mw.msg('revreview-log-details-show'); |
120 | 131 | } else { |
121 | | - log.hide(); |
122 | | - toggle.children('a').text( mw.msg('revreview-log-toggle-show') ); |
| 132 | + var hideMsg = mw.msg('revreview-log-toggle-hide'); |
| 133 | + var showMsg = mw.msg('revreview-log-toggle-show'); |
123 | 134 | } |
124 | | - } |
125 | | - }, |
126 | | - |
127 | | - /* Toggles log excerpts */ |
128 | | - 'toggleLogDetails': function() { |
129 | | - var log = $('#mw-fr-logexcerpt'); |
130 | | - var toggle = $('#mw-fr-logtoggle'); |
131 | | - if ( log.length && toggle.length ) { |
132 | 135 | if ( log.css('display') == 'none' ) { |
133 | 136 | log.show(); |
134 | | - toggle.children('a').text( mw.msg('revreview-log-details-hide') ); |
| 137 | + toggle.children('a').text( hideMsg ); |
135 | 138 | } else { |
136 | 139 | log.hide(); |
137 | | - toggle.children('a').text( mw.msg('revreview-log-details-show') ); |
| 140 | + toggle.children('a').text( showMsg ); |
138 | 141 | } |
139 | 142 | } |
140 | 143 | }, |