r65995 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65994‎ | r65995 | r65996 >
Date:19:58, 6 May 2010
Author:aaron
Status:ok
Tags:
Comment:
* Disabled autoreview on re-protect
* Use down/up arrow in place of (+/-)
* Stabilization refactoring and JS fixes
* A few CSS/HTML cleanups
* Fixed autoReviewEdit() comment
* Bumped style version
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/flaggedrevs.css (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/flaggedrevs.js (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/img/arrow-down.png (added) (history)
  • /trunk/extensions/FlaggedRevs/client/img/arrow-up.png (added) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -301,7 +301,7 @@
302302 $wgAvailableRights[] = 'stablesettings';
303303
304304 # Bump this number every time you change flaggedrevs.css/flaggedrevs.js
305 -$wgFlaggedRevStyleVersion = 70;
 305+$wgFlaggedRevStyleVersion = 71;
306306
307307 $wgExtensionFunctions[] = 'efLoadFlaggedRevs';
308308
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -1454,10 +1454,11 @@
14551455 # ################ Auto-review function #################
14561456
14571457 /**
1458 - * Automatically review an edit and add a log entry in the review log.
1459 - * LinksUpdate was already called via edit operations, so the page
1460 - * fields will be up to date. This updates the stable version.
 1458+ * Automatically review an revision and add a log entry in the review log.
14611459 *
 1460+ * This is called during edit operations after the new revision is added
 1461+ * and the page tables updated, but before LinksUpdate is called.
 1462+ *
14621463 * $auto is here for revisions checked off to be reviewed. Auto-review
14631464 * triggers on edit, but we don't want it to count as just automatic.
14641465 * This also makes it so the user's name shows up in the page history.
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -20,24 +20,27 @@
2121 # Let anyone view, but not submit...
2222 if ( $wgRequest->wasPosted() ) {
2323 if ( $wgUser->isBlocked( !$confirm ) ) {
24 - return $wgOut->blockedPage();
 24+ $wgOut->blockedPage();
 25+ return;
2526 } elseif ( !$this->isAllowed ) {
26 - return $wgOut->permissionRequired( 'stablesettings' );
 27+ $wgOut->permissionRequired( 'stablesettings' );
 28+ return;
2729 } elseif ( wfReadOnly() ) {
28 - return $wgOut->readOnlyPage();
 30+ $wgOut->readOnlyPage();
 31+ return;
2932 }
3033 }
3134 # Set page title
3235 $this->setHeaders();
33 -
 36+
3437 $this->skin = $wgUser->getSkin();
3538 # Our target page
36 - $this->target = $wgRequest->getText( 'page', $par );
 39+ $this->target = $wgRequest->getVal( 'page', $par );
3740 # Watch checkbox
3841 $this->watchThis = (bool)$wgRequest->getCheck( 'wpWatchthis' );
3942 # Reason
4043 $this->reason = $wgRequest->getText( 'wpReason' );
41 - $this->reasonSelection = $wgRequest->getText( 'wpReasonSelection' );
 44+ $this->reasonSelection = $wgRequest->getVal( 'wpReasonSelection' );
4245 # Expiry
4346 $this->expiry = $wgRequest->getText( 'mwStabilize-expiry' );
4447 $this->expirySelection = $wgRequest->getVal( 'wpExpirySelection' );
@@ -55,24 +58,25 @@
5659
5760 # We need a page...
5861 if ( is_null( $this->page ) ) {
59 - return $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
 62+ $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
 63+ return;
6064 } elseif ( !$this->page->exists() ) {
61 - return $wgOut->addHTML( wfMsgExt( 'stabilization-notexists', array( 'parseinline' ),
62 - $this->page->getPrefixedText() ) );
 65+ $wgOut->addWikiText(
 66+ wfMsg( 'stabilization-notexists', $this->page->getPrefixedText() ) );
 67+ return;
6368 } elseif ( !FlaggedRevs::inReviewNamespace( $this->page ) ) {
64 - return $wgOut->addHTML( wfMsgExt( 'stabilization-notcontent', array( 'parseinline' ),
65 - $this->page->getPrefixedText() ) );
 69+ $wgOut->addWikiText(
 70+ wfMsg( 'stabilization-notcontent', $this->page->getPrefixedText() ) );
 71+ return;
6672 }
67 -
6873 # Users who cannot edit or review the page cannot set this
69 - if ( $this->isAllowed && !( $this->page->userCan( 'edit' )
70 - && $this->page->userCan( 'review' ) ) )
71 - {
 74+ if ( !$this->page->userCan( 'edit' ) || !$this->page->userCan( 'review' ) ) {
7275 $this->isAllowed = false;
7376 }
 77+
7478 # Disable some elements as needed
75 - $this->disabledAttrib = !$this->isAllowed ?
76 - array( 'disabled' => 'disabled' ) : array();
 79+ $this->disabledAttrib = $this->isAllowed ?
 80+ array() : array( 'disabled' => 'disabled' );
7781 # Show form or submit...
7882 if ( $this->isAllowed && $isValid && $confirm ) {
7983 $status = $this->submit();
@@ -85,58 +89,49 @@
8690 $this->showSettings();
8791 }
8892 }
89 -
 93+
9094 /**
91 - * Fetch and check parameters. Items may not all be set if false is returned.
 95+ * Verify and clean up parameters and preload data from DB.
 96+ * Note: if false is returned items may not all be set.
9297 * @return bool success
9398 */
9499 public function handleParams() {
95 - # Our target page
96100 $this->page = Title::newFromURL( $this->target );
97 - # We need a page...
98101 if ( is_null( $this->page ) ) {
99 - return false; // can't continue
 102+ return false; // page title is invalid
100103 }
101 - # Get old config
 104+ # Get the current page config and GMT expiry
102105 $this->config = FlaggedRevs::getPageVisibilitySettings( $this->page, FR_MASTER );
103 - # Make user readable date for GET requests
104 - $this->oldExpiry = $this->config['expiry'] !== 'infinity' ?
105 - wfTimestamp( TS_RFC2822, $this->config['expiry'] ) : 'infinite';
106 - # If not posted, then fill in existing values/defaults
 106+ $this->oldExpiry = $this->config['expiry'] === 'infinity'
 107+ ? 'infinite'
 108+ : wfTimestamp( TS_RFC2822, $this->config['expiry'] );
 109+ # Handle views (GET)
107110 if ( !$this->wasPosted ) {
108 - # Get visiblity settings...
109 - $this->select = $this->config['select'];
110 - $this->override = $this->config['override'];
111 - # Get autoreview restrictions...
112 - $this->autoreview = $this->config['autoreview'];
113 - # Handle submission data
 111+ # Fill in existing settings
 112+ $this->preloadSettings( $this->config );
 113+ # Handle submission data (POST)
114114 } else {
115 - // Custom expiry takes precedence
116 - $this->expiry = strlen( $this->expiry ) ?
117 - $this->expiry : $this->expirySelection;
118 - if ( $this->expiry == 'existing' ) {
119 - $this->expiry = $this->oldExpiry;
120 - }
121 - // Custom reason takes precedence
122 - if ( $this->reasonSelection != 'other' ) {
123 - $comment = $this->reasonSelection; // start with dropdown reason
124 - if ( $this->reason != '' ) {
125 - // Append custom reason
126 - $comment .= wfMsgForContent( 'colon-separator' ) . $this->reason;
127 - }
128 - } else {
129 - $comment = $this->reason; // just use custom reason
130 - }
131 - $this->reason = $comment;
 115+ $this->loadReason();
 116+ $this->loadExpiry();
132117 // Protection level case...
133 - if( FlaggedRevs::useProtectionLevels() ) {
 118+ if ( FlaggedRevs::useProtectionLevels() ) {
134119 # Autoreview restriction => use stable
135120 # No autoreview restriction => site default
136 - $this->override = ($this->autoreview != '')
 121+ $this->override = ( $this->autoreview != '' )
137122 ? 1 // edits require review before being published
138123 : (int)FlaggedRevs::isStableShownByDefault();
139 - # Leave the selection precedence alone
 124+ # Leave the selection precedence to the site default
140125 $this->select = FlaggedRevs::getPrecedence();
 126+ # Autoreview only when protecting currently unprotected pages
 127+ $this->reviewThis = ( FlaggedRevs::getProtectionLevel( $this->config ) == 'none' );
 128+ # Check that settings are a valid protection level...
 129+ $newConfig = array(
 130+ 'override' => $this->override,
 131+ 'autoreview' => $this->autoreview
 132+ );
 133+ if ( FlaggedRevs::getProtectionLevel( $newConfig ) == 'invalid' ) {
 134+ return false; // this is not a valid configuration
 135+ }
141136 // General case...
142137 } else {
143138 if ( $this->override !== 0 && $this->override !== 1 ) {
@@ -145,24 +140,45 @@
146141 if ( !FlaggedRevs::isValidPrecedence( $this->select ) ) {
147142 return false; // invalid precedence value
148143 }
 144+ // Check autoreview restriction setting
 145+ if ( !self::userCanSetAutoreviewLevel( $this->autoreview ) ) {
 146+ return false; // invalid value
 147+ }
149148 }
150 - // Check autoreview setting
151 - if ( !self::userCanSetAutoreviewLevel( $this->autoreview ) ) {
152 - return false; // invalid value
 149+ }
 150+ return true;
 151+ }
 152+
 153+ private function preloadSettings( $config ) {
 154+ # Get visiblity settings...
 155+ $this->select = $config['select'];
 156+ $this->override = $config['override'];
 157+ # Get autoreview restrictions...
 158+ $this->autoreview = $config['autoreview'];
 159+ }
 160+
 161+ private function loadExpiry() {
 162+ // Custom expiry takes precedence
 163+ if ( $this->expiry == '' ) {
 164+ $this->expiry = $this->expirySelection;
 165+ if ( $this->expiry == 'existing' ) {
 166+ $this->expiry = $this->oldExpiry;
153167 }
154168 }
155 - # If we use protection levels, check that settings match one...
156 - if ( FlaggedRevs::useProtectionLevels() ) {
157 - $config = array(
158 - 'select' => $this->select,
159 - 'override' => $this->override,
160 - 'autoreview' => $this->autoreview
161 - );
162 - if ( FlaggedRevs::getProtectionLevel( $config ) == 'invalid' ) {
163 - return false; // this is not a valid configuration
 169+ }
 170+
 171+ private function loadReason() {
 172+ // Custom reason takes precedence
 173+ if ( $this->reasonSelection != 'other' ) {
 174+ $comment = $this->reasonSelection; // start with dropdown reason
 175+ if ( $this->reason != '' ) {
 176+ // Append custom reason
 177+ $comment .= wfMsgForContent( 'colon-separator' ) . $this->reason;
164178 }
 179+ } else {
 180+ $comment = $this->reason; // just use custom reason
165181 }
166 - return true;
 182+ $this->reason = $comment;
167183 }
168184
169185 /**
@@ -205,19 +221,6 @@
206222 $form = wfMsgExt( 'stabilization-text', array( 'parse' ),
207223 $this->page->getPrefixedText() );
208224 }
209 - # Add some script for expiry dropdowns
210 - $wgOut->addScript(
211 - "<script type=\"text/javascript\">
212 - function updateStabilizationDropdowns() {
213 - val = document.getElementById('mwExpirySelection').value;
214 - if( val == 'existing' )
215 - document.getElementById('mwStabilize-expiry').value = " .
216 - Xml::encodeJsVar( $this->oldExpiry ) . ";
217 - else if( val != 'othertime' )
218 - document.getElementById('mwStabilize-expiry').value = val;
219 - }
220 - </script>"
221 - );
222225 # Borrow some protection messages for dropdowns
223226 $reasonDropDown = Xml::listDropDown( 'wpReasonSelection',
224227 wfMsgForContent( 'protect-dropdown' ),
@@ -287,26 +290,26 @@
288291 $form .= "
289292 <tr>
290293 <td class='mw-label'>" .
291 - Xml::label( wfMsg( 'stabilization-expiry' ), 'mwExpirySelection' ) .
 294+ Xml::label( wfMsg( 'stabilization-expiry' ), 'mwStabilizeExpirySelection' ) .
292295 "</td>
293296 <td class='mw-input'>" .
294297 Xml::tags( 'select',
295298 array(
296 - 'id' => 'mwExpirySelection',
297 - 'name' => 'wpExpirySelection',
298 - 'onchange' => 'updateStabilizationDropdowns()',
 299+ 'id' => 'mwStabilizeExpirySelection',
 300+ 'name' => 'wpExpirySelection',
 301+ 'onchange' => 'onFRChangeExpiryDropdown()',
299302 ) + $this->disabledAttrib,
300303 $expiryFormOptions ) .
301304 "</td>
302305 </tr>";
303306 }
304307 # Add custom expiry field
305 - $attribs = array( 'id' => "mwStabilize-expiry",
306 - 'onkeyup' => 'updateStabilizationDropdowns()' ) + $this->disabledAttrib;
 308+ $attribs = array( 'id' => "mwStabilizeExpiryOther",
 309+ 'onkeyup' => 'onFRChangeExpiryField()' ) + $this->disabledAttrib;
307310 $form .= "
308311 <tr>
309312 <td class='mw-label'>" .
310 - Xml::label( wfMsg( 'stabilization-othertime' ), 'mwStabilize-expiry' ) .
 313+ Xml::label( wfMsg( 'stabilization-othertime' ), 'mwStabilizeExpiryOther' ) .
311314 '</td>
312315 <td class="mw-input">' .
313316 Xml::input( "mwStabilize-expiry", 50,
@@ -369,8 +372,25 @@
370373 $wgOut->addHTML( Xml::element( 'h2', null,
371374 htmlspecialchars( LogPage::logName( 'stable' ) ) ) );
372375 LogEventsList::showLogExtract( $wgOut, 'stable', $this->page->getPrefixedText() );
 376+
 377+ # Add some script for expiry dropdowns
 378+ self::addProtectionJS();
373379 }
374 -
 380+
 381+ public static function addProtectionJS() {
 382+ global $wgOut;
 383+ $wgOut->addScript(
 384+ "<script type=\"text/javascript\">
 385+ function onFRChangeExpiryDropdown() {
 386+ document.getElementById('mwStabilizeExpiryOther').value = '';
 387+ }
 388+ function onFRChangeExpiryField() {
 389+ document.getElementById('mwStabilizeExpirySelection').value = 'othertime';
 390+ }
 391+ </script>"
 392+ );
 393+ }
 394+
375395 protected function buildSelector( $selected ) {
376396 global $wgUser;
377397 $allowedLevels = array();
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -293,7 +293,7 @@
294294 }
295295 # Make fancy box...
296296 $box = '<div class="flaggedrevs_short_basic">' . $shtml .
297 - '&nbsp;' . self::ratingToggle() . "</div>\n";
 297+ '&nbsp;' . self::ratingArrow() . "</div>\n";
298298 $box .= '<div style="position: relative;">'; // for rel-absolute child div
299299 $box .= '<div id="mw-fr-revisionratings" class="flaggedrevs_short_details">';
300300 $box .= $html; // details text
@@ -309,15 +309,27 @@
310310 }
311311
312312 /**
 313+ * Generates JS toggle arrow icon
 314+ * @returns string
 315+ */
 316+ public static function ratingArrow() {
 317+ $encPath = htmlspecialchars( FlaggedRevs::styleUrlPath() . '/img' );
 318+ return "<img id=\"mw-fr-revisiontoggle\" class=\"fr-toggle-arrow\"" .
 319+ " src=\"{$encPath}/arrow-up.png\" style=\"display:none;\" " .
 320+ " onclick=\"FlaggedRevs.toggleRevRatings()\" title=\"" .
 321+ wfMsgHtml( 'revreview-toggle-title' ) . "\" alt=\"" .
 322+ wfMsgHtml( 'revreview-toggle-show' ) . "\" />";
 323+ }
 324+
 325+ /**
313326 * Generates (+/-) JS toggle HTML (monospace to keep things in place)
314327 * @returns string
315328 */
316329 public static function ratingToggle() {
317 - return '<strong><a id="mw-fr-revisiontoggle" class="flaggedrevs_toggle"' .
318 - ' style="display:none; font-family: monospace;"' .
319 - ' onclick="FlaggedRevs.toggleRevRatings()" title="' .
 330+ return '<a id="mw-fr-revisiontoggle" class="fr-toggle-symbol"' .
 331+ ' style="display:none;" onclick="FlaggedRevs.toggleRevRatings()" title="' .
320332 wfMsgHtml( 'revreview-toggle-title' ) . '" >' .
321 - wfMsgHtml( 'revreview-toggle-show' ) . '</a></strong>';
 333+ wfMsgHtml( 'revreview-toggle-show' ) . '</a>';
322334 }
323335
324336 /**
@@ -325,7 +337,7 @@
326338 * @returns string
327339 */
328340 public static function diffToggle() {
329 - $toggle = '<a id="mw-fr-difftoggle" class="flaggedrevs_toggle" style="display:none;"' .
 341+ $toggle = '<a id="mw-fr-difftoggle" class="fr-toggle-text" style="display:none;"' .
330342 ' onclick="FlaggedRevs.toggleDiff()" title="' .
331343 wfMsgHtml( 'revreview-diff-toggle-title' ) . '" >' .
332344 wfMsgHtml( 'revreview-diff-toggle-show' ) . '</a>';
@@ -337,7 +349,7 @@
338350 * @returns string
339351 */
340352 public static function logToggle() {
341 - $toggle = '<a id="mw-fr-logtoggle" class="flaggedrevs_toggle" style="display:none;"' .
 353+ $toggle = '<a id="mw-fr-logtoggle" class="fr-toggle-text" style="display:none;"' .
342354 ' onclick="FlaggedRevs.toggleLog()" title="' .
343355 wfMsgHtml( 'revreview-log-toggle-show' ) . '" >' .
344356 wfMsgHtml( 'revreview-log-toggle-show' ) . '</a>';
@@ -349,7 +361,7 @@
350362 * @returns string
351363 */
352364 public static function logDetailsToggle() {
353 - $toggle = '<a id="mw-fr-logtoggle" class="flaggedrevs_toggle" style="display:none;"' .
 365+ $toggle = '<a id="mw-fr-logtoggle" class="fr-toggle-text" style="display:none;"' .
354366 ' onclick="FlaggedRevs.toggleLogDetails()" title="' .
355367 wfMsgHtml( 'revreview-log-details-show' ) . '" >' .
356368 wfMsgHtml( 'revreview-log-details-show' ) . '</a>';
@@ -520,7 +532,7 @@
521533 $encPath = htmlspecialchars( FlaggedRevs::styleUrlPath() . '/img' );
522534 $encTitle = wfMsgHtml( 'revreview-draft-title' );
523535 return "<img class=\"flaggedrevs-icon\" src=\"$encPath/1.png\"" .
524 - " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\"></img>";
 536+ " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\" />";
525537 }
526538
527539 /*
@@ -535,7 +547,7 @@
536548 ? wfMsgHtml( 'revreview-quality-title' )
537549 : wfMsgHtml( 'revreview-basic-title' );
538550 return "<img class=\"flaggedrevs-icon\" src=\"$encPath/$file\"" .
539 - " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\"></img>";
 551+ " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\" />";
540552 }
541553
542554 /*
@@ -548,11 +560,11 @@
549561 if ( $flaggedArticle->isPageLocked() ) {
550562 $encTitle = wfMsgHtml( 'revreview-locked-title' );
551563 return "<img class=\"flaggedrevs-icon\" src=\"$encPath/lock-closed.png\"" .
552 - " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\"></img>";
 564+ " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\" />";
553565 } elseif ( $flaggedArticle->isPageUnlocked() ) {
554566 $encTitle = wfMsgHtml( 'revreview-unlocked-title' );
555567 return "<img class=\"flaggedrevs-icon\" src=\"$encPath/lock-open.png\"" .
556 - " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\"></img>";
 568+ " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\" />";
557569 }
558570 }
559571
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -2081,8 +2081,8 @@
20822082 }
20832083 # Can the user actually do anything?
20842084 $isAllowed = $wgUser->isAllowed( 'stablesettings' );
2085 - $disabledAttrib = !$isAllowed ?
2086 - array( 'disabled' => 'disabled' ) : array();
 2085+ $disabledAttrib = $isAllowed ?
 2086+ array() : array( 'disabled' => 'disabled' );
20872087
20882088 # Get the current config/expiry
20892089 $config = FlaggedRevs::getPageVisibilitySettings( $article->getTitle(), FR_MASTER );
@@ -2194,24 +2194,10 @@
21952195 $output .= "</td></tr>";
21962196
21972197 # Add some script for expiry dropdowns
2198 - self::addProtectionJS();
 2198+ Stabilization::addProtectionJS();
21992199 return true;
22002200 }
22012201
2202 - private static function addProtectionJS() {
2203 - global $wgOut;
2204 - $wgOut->addScript(
2205 - "<script type=\"text/javascript\">
2206 - function onFRChangeExpiryDropdown() {
2207 - document.getElementById('mwStabilizeExpiryOther').value = '';
2208 - }
2209 - function onFRChangeExpiryField() {
2210 - document.getElementById('mwStabilizeExpirySelection').value = 'othertime';
2211 - }
2212 - </script>"
2213 - );
2214 - }
2215 -
22162202 // Add stability log extract to protection form
22172203 public static function insertStabilityLog( $article, $out ) {
22182204 if ( !FlaggedRevs::useProtectionLevels() || !$article->exists() ) {
@@ -2248,13 +2234,12 @@
22492235 $permission = $wgRequest->getVal( 'mwStabilityConfig' );
22502236 if ( $permission == "none" ) {
22512237 $form->autoreview = ''; // default
2252 - $form->reviewThis = false;
22532238 } else if ( in_array( $permission, FlaggedRevs::getRestrictionLevels() ) ) {
22542239 $form->autoreview = $permission; // autoreview restriction
2255 - $form->reviewThis = true; // auto-review page; protection-like
22562240 } else {
22572241 return false; // bad level, don't save!
22582242 }
 2243+ $form->reviewThis = null; // autoreview if not currently protected state
22592244 $form->override = null; // implied by autoreview level
22602245 $form->select = null; // site default
22612246 $form->wasPosted = $wgRequest->wasPosted();
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.css
@@ -186,12 +186,24 @@
187187 background-color: #faebd7;
188188 }
189189
190 -a.flaggedrevs_toggle {
 190+a.fr-toggle-symbol {
191191 color: blue;
192192 white-space: nowrap;
 193+ font-family: monospace;
 194+ font-weight: bold;
193195 cursor: pointer;
194196 }
195197
 198+a.fr-toggle-text {
 199+ color: blue;
 200+ font-weight: bold;
 201+ cursor: pointer;
 202+}
 203+
 204+img.fr-toggle-arrow {
 205+ cursor: pointer;
 206+}
 207+
196208 li.fr-hist-stable-margin {
197209 margin-top: 2em;
198210 }
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.js
@@ -47,12 +47,24 @@
4848 if( !ratings ) return;
4949 var toggle = document.getElementById('mw-fr-revisiontoggle');
5050 if( !toggle ) return;
 51+ // Collapsed -> expand
5152 if( ratings.style.display == 'none' ) {
5253 ratings.style.display = 'block';
53 - toggle.innerHTML = this.messages.toggleHide;
 54+ if( toggle.tagName == 'IMG' ) { // arrow
 55+ toggle.alt = this.messages.toggleHide; // fallback text
 56+ toggle.src = toggle.src.replace( 'arrow-up.png', 'arrow-down.png' );
 57+ } else { // text
 58+ toggle.innerHTML = this.messages.toggleHide;
 59+ }
 60+ // Expanded -> collapse
5461 } else {
5562 ratings.style.display = 'none';
56 - toggle.innerHTML = this.messages.toggleShow;
 63+ if( toggle.tagName == 'IMG' ) { // arrow
 64+ toggle.alt = this.messages.toggleShow; // fallback text
 65+ toggle.src = toggle.src.replace( 'arrow-down.png', 'arrow-up.png' );
 66+ } else { // text
 67+ toggle.innerHTML = this.messages.toggleShow;
 68+ }
5769 }
5870 },
5971
Index: trunk/extensions/FlaggedRevs/client/img/arrow-down.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/client/img/arrow-down.png
___________________________________________________________________
Name: svn:mime-type
6072 + image/png
Index: trunk/extensions/FlaggedRevs/client/img/arrow-up.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Property changes on: trunk/extensions/FlaggedRevs/client/img/arrow-up.png
___________________________________________________________________
Name: svn:mime-type
6173 + image/png

Follow-up revisions

RevisionCommit summaryAuthorDate
r65996MFT r65995aaron20:00, 6 May 2010

Status & tagging log