http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70155

Revision: 70155
Author:   tparscal
Date:     2010-07-29 18:33:10 +0000 (Thu, 29 Jul 2010)

Log Message:
-----------
Ported more js from skins/common

Modified Paths:
--------------
    branches/resourceloader/phase3/resources/mw/mw.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.IEFixes.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.ajax.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.ajaxwatch.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.block.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.changepassword.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.edit.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.enhancedchanges.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.history.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.htmlform.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.metadata.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.mwsuggest.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.prefs.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.preview.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.protect.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.rightclickedit.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.search.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.upload.js
    branches/resourceloader/phase3/resources/mw/mw.legacy.wikibits.js

Added Paths:
-----------
    branches/resourceloader/phase3/resources/mw/mw.views.diff.js
    branches/resourceloader/phase3/resources/mw/mw.views.installer.js

Removed Paths:
-------------
    branches/resourceloader/phase3/resources/mw/mw.diff.js
    branches/resourceloader/phase3/resources/mw/mw.installer.js

Deleted: branches/resourceloader/phase3/resources/mw/mw.diff.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.diff.js      2010-07-29 
18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.diff.js      2010-07-29 
18:33:10 UTC (rev 70155)
@@ -1,30 +0,0 @@
-/*
- * Diff tweaks (used to be diff.js)
- * 
- * Ported by: Trevor Parscal
- */
-
-( function( $ ) {
-
-/* Initialization */
-
-$( document ).ready( function() {
-       /*
-        * Workaround for overflow bug in Mozilla 1.1 and earlier, where 
scrolling <div>s in <td> cells collapse their
-        * height to a single line.
-        * 
-        * Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've 
tried with overflow-x disable the scrolling
-        * all the way until Mozilla 1.8 / FF 1.5 and break Opera as well.
-        * 
-        * So... we check for reaaaally old Gecko and hack in an alternate rule 
to let the wide cells spill instead of
-        * scrolling them. Not ideal as it won't work if JS is disabled, of 
course.
-        */
-       if ( window.navigator && window.navigator.product == 'Gecko' && 
window.navigator.productSub < '20021130' ) {
-               document.styleSheets[document.styleSheets.length - 
1].insertRule(
-                       'table.diff td div { overflow: visible; }',
-                       document.styleSheets[document.styleSheets.length - 
1].cssRules.length
-               );
-       }
-} );
-
-} )( jQuery );
\ No newline at end of file

Deleted: branches/resourceloader/phase3/resources/mw/mw.installer.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.installer.js 2010-07-29 
18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.installer.js 2010-07-29 
18:33:10 UTC (rev 70155)
@@ -1,100 +0,0 @@
-/*
- * Installer configuration (used to be config.js)
- * 
- * Ported by: Trevor Parscal
- */
-
-( function( $ ) {
-
-/* Initialization */
-
-$( document ).ready( function() {
-       // Show/hide code for help text
-       $( '.config-show-help a' ).click( function() {
-               $(this).parent().siblings( '.config-help-message' ).show( 
'slow' );
-               $(this).parent().siblings( '.config-hide-help' ).show();
-               $(this).parent().hide();
-               return false;
-       } );
-       $( '.config-hide-help a' ).click( function() {
-               $(this).parent().siblings( '.config-help-message' ).hide( 
'slow' );
-               $(this).parent().siblings( '.config-show-help' ).show();
-               $(this).parent().hide();
-               return false;
-       } );    
-       // Show/hide code for DB-specific options
-       // FIXME: Do we want slow, fast, or even non-animated (instantaneous) 
showing/hiding here?
-       $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) 
).hide(); } );
-       $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show();
-       $( '.dbRadio' ).click( function() {
-               var $checked = $( '.dbRadio:checked' );
-               var $wrapper = $( '#' + $checked.attr( 'rel' ) );
-               if ( !$wrapper.is( ':visible' ) ) {
-                       $( '.dbWrapper' ).hide( 'slow' );
-                       $wrapper.show( 'slow' );
-               }
-       } );    
-       // Scroll to the bottom of upgrade log
-       $( "#config-update-log" ).each( function() { this.scrollTop = 
this.scrollHeight; } );
-       // Show/hide Creative Commons thingy
-       $( '.licenseRadio' ).click( function() {
-               var $wrapper = $( '#config-cc-wrapper' );
-               if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
-                       $wrapper.show( 'slow' );
-               } else {
-                       $wrapper.hide( 'slow' );
-               }
-       } );
-       // Show/hide random stuff (email, upload)
-       $( '.showHideRadio' ).click( function() {
-               var $wrapper = $( '#' + $(this).attr( 'rel' ) );
-               if ( $(this).is( ':checked' ) ) {
-                       $wrapper.show( 'slow' );
-               } else {
-                       $wrapper.hide( 'slow' );
-               }
-       } );
-       $( '.hideShowRadio' ).click( function() {
-               var $wrapper = $( '#' + $(this).attr( 'rel' ) );
-               if ( $(this).is( ':checked' ) ) {
-                       $wrapper.hide( 'slow' );
-               } else {
-                       $wrapper.show( 'slow' );
-               }
-       } );
-       // Enable/disable "other" textboxes
-       $( '.enableForOther' ).click( function() {
-               var $textbox = $( '#' + $(this).attr( 'rel' ) );
-               if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly
-                       $textbox.removeAttr( 'disabled' );
-               } else {
-                       $textbox.attr( 'disabled', 'disabled' );
-               }
-       } );
-       // Synchronize radio button label for sitename with textbox
-       $label = $( 'label[for=config__NamespaceType_site-name]' );
-       labelText = $label.text();
-       $label.text( labelText.replace( '$1', '' ) );
-       $( '#config_wgSitename' ).bind( 'keyup change', syncText ).each( 
syncText );
-       function syncText() {
-               var value = $(this).val()
-                       .replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
-                       .replace( /&/, '&amp;' )
-                       .replace( /__+/g, '_' )
-                       .replace( /^_+/, '' )
-                       .replace( /_+$/, '' );
-               value = value.substr( 0, 1 ).toUpperCase() + value.substr( 1 );
-               $label.text( labelText.replace( '$1', value ) );
-       }
-       // Show/Hide memcached servers when needed
-       $( "input[name$='config_wgMainCacheType']" ).change( function() {
-               var $memc = $( "#config-memcachewrapper" );
-               if ( $( "input[name$='config_wgMainCacheType']:checked" ).val() 
== 'memcached' ) {
-                       $memc.show( 'slow' );
-               } else {
-                       $memc.hide( 'slow' );
-               }
-       } );
-} );
-
-} )( jQuery );

Modified: branches/resourceloader/phase3/resources/mw/mw.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.js   2010-07-29 18:25:13 UTC 
(rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.js   2010-07-29 18:33:10 UTC 
(rev 70155)
@@ -40,7 +40,7 @@
         * the browser does have a console available 
         *
         * @author Michael Dale <[email protected]>, Trevor Parscal 
<[email protected]>
-        * @param {String} string String to output to console
+        * @param string string message to output to console
         */
        this.log = function( string ) {
                // Allow log messages to use a configured prefix                

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.IEFixes.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.IEFixes.js    
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.IEFixes.js    
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/IEFixes.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.ajax.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.ajax.js       
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.ajax.js       
2010-07-29 18:33:10 UTC (rev 70155)
@@ -1,15 +1,15 @@
 /*
- * Legacy emulation for the now depricated ajax.js
+ * Legacy emulation for the now depricated skins/common/ajax.js
  * 
  * Original licensing information:
- *             remote scripting library
- *             (c) copyright 2005 modernmethod, inc
- * 
- * Ported by: Trevor Parscal
+ *             Remote Scripting Library
+ *             (c) Copyright 2005 ModernMethod, Inc.
  */
 
-( function( $ ) {
+( function( $, mw ) {
 
+/* Extension */
+
 $.extend( mw.legacy, {
 
        /* Global Variables */
@@ -36,7 +36,7 @@
                        return true;
                }
                return false;
-       }
+       },
        /**
         * Gets an XMLHttpRequest or equivilant ActiveXObject
         * 
@@ -173,4 +173,4 @@
        }
 } );
 
-} )( jQuery );
\ No newline at end of file
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.ajaxwatch.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.ajaxwatch.js  
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.ajaxwatch.js  
2010-07-29 18:33:10 UTC (rev 70155)
@@ -1,68 +1,85 @@
 /*
- * Legacy emulation for the now depricated ajaxwatch.js
+ * Legacy emulation for the now depricated skins/common/ajaxwatch.js
  * 
- * Ported by: Trevor Parscal
+ * AJAX functionality for the watch/unwatch link
  * 
- * Animate watch/unwatch links to use asynchronous API requests to watch 
pages, rather than clicking on links
- * 
- * Warning: Uses mw.legacy.jsMsg() from mw.legacy.wikibits.js
+ * @depends mw.legacy.jsMsg() from mw.legacy.wikibits.js
  */
 
-( function( $ ) {
+( function( $, mw ) {
 
-if ( typeof mw.legacy.wgAjaxWatch === "undefined" || !mw.legacy.wgAjaxWatch ) {
-       $.extend( mw.legacy, {
-               'wgAjaxWatch': {
-                       'watchMsg': 'Watch',
-                       'unwatchMsg': 'Unwatch',
-                       'watchingMsg': 'Watching...',
-                       'unwatchingMsg': 'Unwatching...',
-                       'tooltip-ca-watchMsg': 'Add this page to your 
watchlist',
-                       'tooltip-ca-unwatchMsg': 'Remove this page from your 
watchlist'
-               }
-       } );
-}
-$.extend( mw.legacy.wgAjaxWatch, {
-       'setLinkText': function( $link, action ) {
-               if ( action == 'watch' || action == 'unwatch' ) {
-                       // save the accesskey from the title
-                       var keyCommand = $link.attr( 'title' ).match( 
/\[.*?\]$/ ) ?
-                               $link.attr( 'title' ).match( /\[.*?\]$/ )[0] : 
'';
-                       $link.attr( 'title', wgAjaxWatch['tooltip-ca-' + action 
+ 'Msg'] + ' ' + keyCommand );
-               }
-               if ( $link.data( 'icon' ) ) {
-                       $link.attr( 'alt', wgAjaxWatch[action + 'Msg'] );
-                       if ( action == 'watching' || action == 'unwatching' ) {
-                               $link.addClass( 'loading' );
+/* Extension */
+
+$.extend( mw.legacy, {
+       
+       /* Global Variables */
+       
+       'wgAjaxWatch': {
+               
+               /* Global Variables */
+               
+               'watchMsg': 'Watch',
+               'unwatchMsg': 'Unwatch',
+               'watchingMsg': 'Watching...',
+               'unwatchingMsg': 'Unwatching...',
+               'tooltip-ca-watchMsg': 'Add this page to your watchlist',
+               'tooltip-ca-unwatchMsg': 'Remove this page from your watchlist',
+               
+               /* Functions */
+               
+               /**
+                * Sets the text of the watch/unwatch link
+                * 
+                * @param object link DOM node or jQuery selection of link to 
set text of
+                * @param string action message to use ('watch', 'unwatch', 
'watching' or 'unwatching')
+                */
+               'setLinkText': function( link, action ) {
+                       var $link = $( link );
+                       if ( action == 'watch' || action == 'unwatch' ) {
+                               // save the accesskey from the title
+                               var keyCommand = $link.attr( 'title' ).match( 
/\[.*?\]$/ ) ?
+                                       $link.attr( 'title' ).match( /\[.*?\]$/ 
)[0] : '';
+                               $link.attr( 'title', wgAjaxWatch['tooltip-ca-' 
+ action + 'Msg'] + ' ' + keyCommand );
+                       }
+                       if ( $link.data( 'icon' ) ) {
+                               $link.attr( 'alt', wgAjaxWatch[action + 'Msg'] 
);
+                               if ( action == 'watching' || action == 
'unwatching' ) {
+                                       $link.addClass( 'loading' );
+                               } else {
+                                       $link.removeClass( 'loading' );
+                               }
                        } else {
-                               $link.removeClass( 'loading' );
+                               $link.html( wgAjaxWatch[action+'Msg'] );
                        }
-               } else {
-                       $link.html( wgAjaxWatch[action+'Msg'] );
+               },
+               /**
+                * Processes responses from the server
+                * 
+                * @param object response data from server
+                */
+               'processResult': function( response ) {
+                       response = response.watch;
+                       var $link = $(this);
+                       // To ensure we set the same status for all watch links 
with the same target we trigger a custom event on
+                       // *all* watch links.
+                       if ( response.watched !== undefined ) {
+                               wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', 
[response.title, 'watch'] );
+                       } else if ( response.unwatched !== undefined ){
+                               wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', 
[response.title, 'unwatch'] );
+                       } else {
+                               // Either we got an error code or it just plain 
broke.
+                               window.location.href = $link.attr( 'href' );
+                               return;
+                       }
+                       mw.legacy.jsMsg( response.message, 'watch' );
+                       // Bug 12395 - update the watch checkbox on edit pages 
when the page is watched or unwatched via the tab.
+                       if ( response.watched !== undefined ) {
+                               $j("#wpWatchthis").attr( 'checked', '1' );
+                       } else {
+                               $j("#wpWatchthis").removeAttr( 'checked' );
+                       }
                }
-       },
-       'processResult': function( response ) {
-               response = response.watch;
-               var $link = $(this);
-               // To ensure we set the same status for all watch links with 
the same target we trigger a custom event on
-               // *all* watch links.
-               if ( response.watched !== undefined ) {
-                       wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', 
[response.title, 'watch'] );
-               } else if ( response.unwatched !== undefined ){
-                       wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', 
[response.title, 'unwatch'] );
-               } else {
-                       // Either we got an error code or it just plain broke.
-                       window.location.href = $link.attr( 'href' );
-                       return;
-               }
-               mw.legacy.jsMsg( response.message, 'watch' );
-               // Bug 12395 - update the watch checkbox on edit pages when the 
page is watched or unwatched via the tab.
-               if ( response.watched !== undefined ) {
-                       $j("#wpWatchthis").attr( 'checked', '1' );
-               } else {
-                       $j("#wpWatchthis").removeAttr( 'checked' );
-               }
-       }
+       } );
 } );
 
 /* Initialization */
@@ -116,4 +133,4 @@
        mw.legacy.wgAjaxWatch.$links = $links;
 } );
 
-} )( jQuery );
\ No newline at end of file
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.block.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.block.js      
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.block.js      
2010-07-29 18:33:10 UTC (rev 70155)
@@ -1,12 +1,15 @@
 /*
- * Legacy emulation for the now depricated block.js
- * 
- * Ported by: Trevor Parscal
+ * Legacy emulation for the now depricated skins/common/block.js
  */
 
-( function( $ ) {
+( function( $, mw ) {
 
+/* Extension */
+
 $.extend( mw.legacy, {
+       
+       /* Functions */
+       
        'considerChangingExpiryFocus': function() {
                var $expiry = $( '#wpBlockExpiry' );
                var $other = $( '#wpBlockOther' );
@@ -25,7 +28,6 @@
                        var isEmpty = address.match( /^\s*$/ );
                        var isIp = address.match( 
/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?$/
 );
                        var isIpRange = isIp && address.match( /\/\d+$/ );
-
                        $( '#wpAnonOnlyRow' ).css( 'display', !isIp && !isEmpty 
? 'none' : '' );
                        $( '#wpEnableAutoblockRow,#wpEnableHideUser' ).css( 
'display', isIp && !isEmpty ? 'none' : '' );
                        $( '#wpEnableWatchUser' ).css( 'display', isIpRange && 
!isEmpty ? 'none' : '' );
@@ -39,4 +41,4 @@
        mw.legacy.considerChangingExpiryFocus();
 } );
 
-} )( jQuery );
\ No newline at end of file
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: 
branches/resourceloader/phase3/resources/mw/mw.legacy.changepassword.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.changepassword.js     
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.changepassword.js     
2010-07-29 18:33:10 UTC (rev 70155)
@@ -1,12 +1,15 @@
 /*
- * Legacy emulation for the now depricated changepassword.js
- * 
- * Ported by: Trevor Parscal
+ * Legacy emulation for the now depricated skins/common/changepassword.js
  */
 
-( function( $ ) {
+( function( $, mw ) {
 
+/* Extension */
+
 $.extend( mw.legacy, {
+       
+       /* Functions */
+       
        'onNameChange': function() {
                var state = mw.legacy.wgUserName != $( '#wpName' ).val();
                $( '#wpPassword' ).attr( 'disabled', state );
@@ -23,4 +26,4 @@
        mw.legacy.onNameChangeHook();
 } );
 
-} )( jQuery );
\ No newline at end of file
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.edit.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.edit.js       
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.edit.js       
2010-07-29 18:33:10 UTC (rev 70155)
@@ -1,13 +1,19 @@
 /*
- * Legacy emulation for the now depricated edit.js
- * 
- * Ported by: Trevor Parscal
+ * Legacy emulation for the now depricated skins/common/edit.js
  */
 
-( function( $ ) {
+( function( $, mw ) {
 
+/* Extension */
+
 $.extend( mw.legacy, {
+       
+       /* Global Variables */
+       
        'currentFocused': null,
+       
+       /* Functions */
+       
        /**
         * Generates the actual toolbar buttons with localized text we use it 
to avoid creating the toolbar
         * where javascript is not enabled
@@ -255,4 +261,4 @@
        } );
 } );
 
-} )( jQuery );
\ No newline at end of file
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: 
branches/resourceloader/phase3/resources/mw/mw.legacy.enhancedchanges.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.enhancedchanges.js    
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.enhancedchanges.js    
2010-07-29 18:33:10 UTC (rev 70155)
@@ -1,16 +1,19 @@
 /*
- * Legacy emulation for the now enhancedchanges edit.js
- * 
- * Ported by: Trevor Parscal
+ * Legacy emulation for the now depricated skins/common/enhancedchanges.js
  */
 
-( function( $ ) {
+( function( $, mw ) {
 
+/* Extension */
+
 $.extend( mw.legacy, {
+       
+       /* Functions */
+       
        /**
         * Switch an RC line between hidden/shown
         * 
-        * @param int idNumber : the id number of the RC group
+        * @param integer idNumber : the id number of the RC group
         */ 
        'toggleVisibility': function( idNumber ) {
                var elements = [
@@ -22,6 +25,8 @@
        }
 } );
 
+/* Initialization */
+
 $( document ).ready( function() {
        /*
        * Add the CSS to hide parts that should be collapsed
@@ -38,4 +43,4 @@
        );
 } );
 
-} )( jQuery );
\ No newline at end of file
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.history.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.history.js    
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.history.js    
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,115 @@
+/*
+ * Legacy emulation for the now depricated skins/common/history.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       
+       /* Functions */
+       
+       'historyRadios': function( parent ) {
+               var inputs = parent.getElementsByTagName('input');
+               var radios = [];
+               for (var i = 0; i < inputs.length; i++) {
+                       if (inputs[i].name == "diff" || inputs[i].name == 
"oldid") {
+                               radios[radios.length] = inputs[i];
+                       }
+               }
+               return radios;
+       },
+       /*
+        * Check selection and tweak visibility/class onclick
+        */
+       'diffcheck': function() {
+               var dli = false; // the li where the diff radio is checked
+               var oli = false; // the li where the oldid radio is checked
+               var hf = document.getElementById('pagehistory');
+               if (!hf) {
+                       return true;
+               }
+               var lis = hf.getElementsByTagName('li');
+               for (var i=0;i<lis.length;i++) {
+                       var inputs = historyRadios(lis[i]);
+                       if (inputs[1] && inputs[0]) {
+                               if (inputs[1].checked || inputs[0].checked) { 
// this row has a checked radio button
+                                       if (inputs[1].checked && 
inputs[0].checked && inputs[0].value == inputs[1].value) {
+                                               return false;
+                                       }
+                                       if (oli) { // it's the second checked 
radio
+                                               if (inputs[1].checked) {
+                                                       if ( (typeof 
oli.className) != 'undefined') {
+                                                               
oli.classNameOriginal = oli.className.replace( 'selected', '' );
+                                                       } else {
+                                                               
oli.classNameOriginal = '';
+                                                       }
+                                                       
+                                                       oli.className = 
"selected "+oli.classNameOriginal;
+                                                       return false;
+                                               }
+                                       } else if (inputs[0].checked) {
+                                               return false;
+                                       }
+                                       if (inputs[0].checked) {
+                                               dli = lis[i];
+                                       }
+                                       if (!oli) {
+                                               inputs[0].style.visibility = 
'hidden';
+                                       }
+                                       if (dli) {
+                                               inputs[1].style.visibility = 
'hidden';
+                                       }
+                                       if ( (typeof lis[i].className) != 
'undefined') {
+                                               lis[i].classNameOriginal = 
lis[i].className.replace( 'selected', '' );
+                                       } else {
+                                               lis[i].classNameOriginal = '';
+                                       }
+                                                       
+                                       lis[i].className = "selected 
"+lis[i].classNameOriginal;
+                                       oli = lis[i];
+                               }  else { // no radio is checked in this row
+                                       if (!oli) {
+                                               inputs[0].style.visibility = 
'hidden';
+                                       } else {
+                                               inputs[0].style.visibility = 
'visible';
+                                       }
+                                       if (dli) {
+                                               inputs[1].style.visibility = 
'hidden';
+                                       } else {
+                                               inputs[1].style.visibility = 
'visible';
+                                       }
+                                       if ( typeof lis[i].classNameOriginal != 
'undefined' ) {
+                                               lis[i].className = 
lis[i].classNameOriginal;
+                                       }
+                               }
+                       }
+               }
+               return true;
+       },
+       /*
+        * Attach event handlers to the input elements on history page
+        */
+       'histrowinit': function() {
+               var hf = document.getElementById('pagehistory');
+               if (!hf) return;
+               var lis = hf.getElementsByTagName('li');
+               for (var i = 0; i < lis.length; i++) {
+                       var inputs = historyRadios(lis[i]);
+                       if (inputs[0] && inputs[1]) {
+                               inputs[0].onclick = diffcheck;
+                               inputs[1].onclick = diffcheck;
+                       }
+               }
+               diffcheck();
+       }
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       mw.legacy.histrowinit();
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.htmlform.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.htmlform.js   
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.htmlform.js   
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/htmlform.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.metadata.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.metadata.js   
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.metadata.js   
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/metadata.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.mwsuggest.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.mwsuggest.js  
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.mwsuggest.js  
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/mwsuggest.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.prefs.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.prefs.js      
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.prefs.js      
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/prefs.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.preview.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.preview.js    
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.preview.js    
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/preview.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.protect.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.protect.js    
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.protect.js    
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/protect.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: 
branches/resourceloader/phase3/resources/mw/mw.legacy.rightclickedit.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.rightclickedit.js     
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.rightclickedit.js     
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/rightclick.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.search.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.search.js     
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.search.js     
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/search.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.upload.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.upload.js     
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.upload.js     
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/upload.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Modified: branches/resourceloader/phase3/resources/mw/mw.legacy.wikibits.js
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.legacy.wikibits.js   
2010-07-29 18:25:13 UTC (rev 70154)
+++ branches/resourceloader/phase3/resources/mw/mw.legacy.wikibits.js   
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,19 @@
+/*
+ * Legacy emulation for the now depricated skins/common/wikibits.js
+ */
+
+( function( $, mw ) {
+
+/* Extension */
+
+$.extend( mw.legacy, {
+       //
+} );
+
+/* Initialization */
+
+$( document ).ready( function() {
+       //
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Copied: branches/resourceloader/phase3/resources/mw/mw.views.diff.js (from rev 
70106, branches/resourceloader/phase3/resources/mw/mw.diff.js)
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.views.diff.js                
                (rev 0)
+++ branches/resourceloader/phase3/resources/mw/mw.views.diff.js        
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,28 @@
+/*
+ * Diff-view progressive enhancement (ported from skins/common/diff.js)
+ */
+
+( function( $, mw ) {
+
+/* Initialization */
+
+$( document ).ready( function() {
+       /*
+        * Workaround for overflow bug in Mozilla 1.1 and earlier, where 
scrolling <div>s in <td> cells collapse their
+        * height to a single line.
+        * 
+        * Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've 
tried with overflow-x disable the scrolling
+        * all the way until Mozilla 1.8 / FF 1.5 and break Opera as well.
+        * 
+        * So... we check for reaaaally old Gecko and hack in an alternate rule 
to let the wide cells spill instead of
+        * scrolling them. Not ideal as it won't work if JS is disabled, of 
course.
+        */
+       if ( window.navigator && window.navigator.product == 'Gecko' && 
window.navigator.productSub < '20021130' ) {
+               document.styleSheets[document.styleSheets.length - 
1].insertRule(
+                       'table.diff td div { overflow: visible; }',
+                       document.styleSheets[document.styleSheets.length - 
1].cssRules.length
+               );
+       }
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file

Copied: branches/resourceloader/phase3/resources/mw/mw.views.installer.js (from 
rev 70106, branches/resourceloader/phase3/resources/mw/mw.installer.js)
===================================================================
--- branches/resourceloader/phase3/resources/mw/mw.views.installer.js           
                (rev 0)
+++ branches/resourceloader/phase3/resources/mw/mw.views.installer.js   
2010-07-29 18:33:10 UTC (rev 70155)
@@ -0,0 +1,100 @@
+/*
+ * Web-installer progressive enhancement (ported from skins/common/config.js)
+ * 
+ * Makes elements in the configuration form interactive and hides portions of 
the form when not in-use
+ */
+
+( function( $, mw ) {
+
+/* Initialization */
+
+$( document ).ready( function() {
+       // Show/hide code for help text
+       $( '.config-show-help a' ).click( function() {
+               $(this).parent().siblings( '.config-help-message' ).show( 
'slow' );
+               $(this).parent().siblings( '.config-hide-help' ).show();
+               $(this).parent().hide();
+               return false;
+       } );
+       $( '.config-hide-help a' ).click( function() {
+               $(this).parent().siblings( '.config-help-message' ).hide( 
'slow' );
+               $(this).parent().siblings( '.config-show-help' ).show();
+               $(this).parent().hide();
+               return false;
+       } );    
+       // Show/hide code for DB-specific options
+       // FIXME: Do we want slow, fast, or even non-animated (instantaneous) 
showing/hiding here?
+       $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) 
).hide(); } );
+       $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show();
+       $( '.dbRadio' ).click( function() {
+               var $checked = $( '.dbRadio:checked' );
+               var $wrapper = $( '#' + $checked.attr( 'rel' ) );
+               if ( !$wrapper.is( ':visible' ) ) {
+                       $( '.dbWrapper' ).hide( 'slow' );
+                       $wrapper.show( 'slow' );
+               }
+       } );    
+       // Scroll to the bottom of upgrade log
+       $( "#config-update-log" ).each( function() { this.scrollTop = 
this.scrollHeight; } );
+       // Show/hide Creative Commons thingy
+       $( '.licenseRadio' ).click( function() {
+               var $wrapper = $( '#config-cc-wrapper' );
+               if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
+                       $wrapper.show( 'slow' );
+               } else {
+                       $wrapper.hide( 'slow' );
+               }
+       } );
+       // Show/hide random stuff (email, upload)
+       $( '.showHideRadio' ).click( function() {
+               var $wrapper = $( '#' + $(this).attr( 'rel' ) );
+               if ( $(this).is( ':checked' ) ) {
+                       $wrapper.show( 'slow' );
+               } else {
+                       $wrapper.hide( 'slow' );
+               }
+       } );
+       $( '.hideShowRadio' ).click( function() {
+               var $wrapper = $( '#' + $(this).attr( 'rel' ) );
+               if ( $(this).is( ':checked' ) ) {
+                       $wrapper.hide( 'slow' );
+               } else {
+                       $wrapper.show( 'slow' );
+               }
+       } );
+       // Enable/disable "other" textboxes
+       $( '.enableForOther' ).click( function() {
+               var $textbox = $( '#' + $(this).attr( 'rel' ) );
+               if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly
+                       $textbox.removeAttr( 'disabled' );
+               } else {
+                       $textbox.attr( 'disabled', 'disabled' );
+               }
+       } );
+       // Synchronize radio button label for sitename with textbox
+       $label = $( 'label[for=config__NamespaceType_site-name]' );
+       labelText = $label.text();
+       $label.text( labelText.replace( '$1', '' ) );
+       $( '#config_wgSitename' ).bind( 'keyup change', syncText ).each( 
syncText );
+       function syncText() {
+               var value = $(this).val()
+                       .replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
+                       .replace( /&/, '&amp;' )
+                       .replace( /__+/g, '_' )
+                       .replace( /^_+/, '' )
+                       .replace( /_+$/, '' );
+               value = value.substr( 0, 1 ).toUpperCase() + value.substr( 1 );
+               $label.text( labelText.replace( '$1', value ) );
+       }
+       // Show/Hide memcached servers when needed
+       $( "input[name$='config_wgMainCacheType']" ).change( function() {
+               var $memc = $( "#config-memcachewrapper" );
+               if ( $( "input[name$='config_wgMainCacheType']:checked" ).val() 
== 'memcached' ) {
+                       $memc.show( 'slow' );
+               } else {
+                       $memc.hide( 'slow' );
+               }
+       } );
+} );
+
+} )( jQuery, MediaWiki );
\ No newline at end of file



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to