Drop zh-tw message "saveprefs"
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.history.js
index 8aa5a1f..2ebfe92 100644 (file)
@@ -12,54 +12,39 @@ jQuery( function ( $ ) {
         * @param e {jQuery.Event}
         */
        function updateDiffRadios() {
-               var diffLi = false, // the li where the diff radio is checked
-                       oldLi = false; // the li where the oldid radio is checked
+               var nextState = 'before',
+                       $li,
+                       $inputs,
+                       $oldidRadio,
+                       $diffRadio;
 
                if ( !$lis.length ) {
                        return true;
                }
 
                $lis
-               .removeClass( 'selected' )
                .each( function () {
-                       var     $li = $( this ),
-                               $inputs = $li.find( 'input[type="radio"]' ),
-                               $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq( 0 ),
-                               $diffRadio = $inputs.filter( '[name="diff"]' ).eq( 0 );
+                       $li = $( this );
+                       $inputs = $li.find( 'input[type="radio"]' );
+                       $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq( 0 );
+                       $diffRadio = $inputs.filter( '[name="diff"]' ).eq( 0 );
+
+                       $li.removeClass( 'selected between before after' );
 
                        if ( !$oldidRadio.length || !$diffRadio.length ) {
                                return true;
                        }
 
                        if ( $oldidRadio.prop( 'checked' ) ) {
-                               oldLi = true;
-                               $li.addClass( 'selected' );
-                               $oldidRadio.css( 'visibility', 'visible' );
-                               $diffRadio.css( 'visibility', 'hidden' );
-
+                               $li.addClass( 'selected after' );
+                               nextState = 'after';
                        } else if ( $diffRadio.prop( 'checked' ) ) {
-                               diffLi = true;
-                               $li.addClass( 'selected' );
-                               $oldidRadio.css( 'visibility', 'hidden' );
-                               $diffRadio.css( 'visibility', 'visible' );
-
-                       // This list item has neither checked
+                               $li.addClass( 'selected ' + nextState );
+                               nextState = 'between';
                        } else {
-                               // We're below the selected radios
-                               if ( diffLi && oldLi ) {
-                                       $oldidRadio.css( 'visibility', 'visible' );
-                                       $diffRadio.css( 'visibility', 'hidden' );
-
-                               // We're between the selected radios
-                               } else if ( diffLi ) {
-                                       $diffRadio.css( 'visibility', 'visible' );
-                                       $oldidRadio.css( 'visibility', 'visible' );
-
-                               // We're above the selected radios
-                               } else {
-                                       $diffRadio.css( 'visibility', 'visible' );
-                                       $oldidRadio.css( 'visibility', 'hidden' );
-                               }
+                               // This list item has neither checked
+                               // apply the appropriate class following the previous item.
+                               $li.addClass( nextState );
                        }
                } );
 
@@ -100,7 +85,8 @@ jQuery( function ( $ ) {
                                $copyForm.find( 'input[name^="ids["]:checked' ).prop( 'checked', false );
 
                        // Remove diff=&oldid=, change action=historysubmit to revisiondelete, remove revisiondelete
-                       } else if ( $historySubmitter.hasClass( 'mw-history-revisiondelete-button' ) ) {
+                       } else if ( $historySubmitter.hasClass( 'mw-history-revisiondelete-button' ) ||
+                                       $historySubmitter.hasClass( 'mw-history-editchangetags-button' ) ) {
                                $copyRadios.remove();
                                $copyAction.val( $historySubmitter.attr( 'name' ) );
                                $copyForm.find( ':submit' ).remove();