r70155 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70154‎ | r70155 | r70156 >
Date:18:33, 29 July 2010
Author:tparscal
Status:deferred
Tags:
Comment:
Ported more js from skins/common
Modified paths:
  • /branches/resourceloader/phase3/resources/mw/mw.diff.js (deleted) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.installer.js (deleted) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.IEFixes.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.ajax.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.ajaxwatch.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.block.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.changepassword.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.edit.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.enhancedchanges.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.history.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.htmlform.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.metadata.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.mwsuggest.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.prefs.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.preview.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.protect.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.rightclickedit.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.search.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.upload.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.legacy.wikibits.js (modified) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.views.diff.js (added) (history)
  • /branches/resourceloader/phase3/resources/mw/mw.views.installer.js (added) (history)

Diff [purge]

Index: branches/resourceloader/phase3/resources/mw/mw.installer.js
@@ -1,100 +0,0 @@
2 -/*
3 - * Installer configuration (used to be config.js)
4 - *
5 - * Ported by: Trevor Parscal
6 - */
7 -
8 -( function( $ ) {
9 -
10 -/* Initialization */
11 -
12 -$( document ).ready( function() {
13 - // Show/hide code for help text
14 - $( '.config-show-help a' ).click( function() {
15 - $(this).parent().siblings( '.config-help-message' ).show( 'slow' );
16 - $(this).parent().siblings( '.config-hide-help' ).show();
17 - $(this).parent().hide();
18 - return false;
19 - } );
20 - $( '.config-hide-help a' ).click( function() {
21 - $(this).parent().siblings( '.config-help-message' ).hide( 'slow' );
22 - $(this).parent().siblings( '.config-show-help' ).show();
23 - $(this).parent().hide();
24 - return false;
25 - } );
26 - // Show/hide code for DB-specific options
27 - // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
28 - $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) ).hide(); } );
29 - $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show();
30 - $( '.dbRadio' ).click( function() {
31 - var $checked = $( '.dbRadio:checked' );
32 - var $wrapper = $( '#' + $checked.attr( 'rel' ) );
33 - if ( !$wrapper.is( ':visible' ) ) {
34 - $( '.dbWrapper' ).hide( 'slow' );
35 - $wrapper.show( 'slow' );
36 - }
37 - } );
38 - // Scroll to the bottom of upgrade log
39 - $( "#config-update-log" ).each( function() { this.scrollTop = this.scrollHeight; } );
40 - // Show/hide Creative Commons thingy
41 - $( '.licenseRadio' ).click( function() {
42 - var $wrapper = $( '#config-cc-wrapper' );
43 - if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
44 - $wrapper.show( 'slow' );
45 - } else {
46 - $wrapper.hide( 'slow' );
47 - }
48 - } );
49 - // Show/hide random stuff (email, upload)
50 - $( '.showHideRadio' ).click( function() {
51 - var $wrapper = $( '#' + $(this).attr( 'rel' ) );
52 - if ( $(this).is( ':checked' ) ) {
53 - $wrapper.show( 'slow' );
54 - } else {
55 - $wrapper.hide( 'slow' );
56 - }
57 - } );
58 - $( '.hideShowRadio' ).click( function() {
59 - var $wrapper = $( '#' + $(this).attr( 'rel' ) );
60 - if ( $(this).is( ':checked' ) ) {
61 - $wrapper.hide( 'slow' );
62 - } else {
63 - $wrapper.show( 'slow' );
64 - }
65 - } );
66 - // Enable/disable "other" textboxes
67 - $( '.enableForOther' ).click( function() {
68 - var $textbox = $( '#' + $(this).attr( 'rel' ) );
69 - if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly
70 - $textbox.removeAttr( 'disabled' );
71 - } else {
72 - $textbox.attr( 'disabled', 'disabled' );
73 - }
74 - } );
75 - // Synchronize radio button label for sitename with textbox
76 - $label = $( 'label[for=config__NamespaceType_site-name]' );
77 - labelText = $label.text();
78 - $label.text( labelText.replace( '$1', '' ) );
79 - $( '#config_wgSitename' ).bind( 'keyup change', syncText ).each( syncText );
80 - function syncText() {
81 - var value = $(this).val()
82 - .replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
83 - .replace( /&/, '&amp;' )
84 - .replace( /__+/g, '_' )
85 - .replace( /^_+/, '' )
86 - .replace( /_+$/, '' );
87 - value = value.substr( 0, 1 ).toUpperCase() + value.substr( 1 );
88 - $label.text( labelText.replace( '$1', value ) );
89 - }
90 - // Show/Hide memcached servers when needed
91 - $( "input[name$='config_wgMainCacheType']" ).change( function() {
92 - var $memc = $( "#config-memcachewrapper" );
93 - if ( $( "input[name$='config_wgMainCacheType']:checked" ).val() == 'memcached' ) {
94 - $memc.show( 'slow' );
95 - } else {
96 - $memc.hide( 'slow' );
97 - }
98 - } );
99 -} );
100 -
101 -} )( jQuery );
Index: branches/resourceloader/phase3/resources/mw/mw.diff.js
@@ -1,30 +0,0 @@
2 -/*
3 - * Diff tweaks (used to be diff.js)
4 - *
5 - * Ported by: Trevor Parscal
6 - */
7 -
8 -( function( $ ) {
9 -
10 -/* Initialization */
11 -
12 -$( document ).ready( function() {
13 - /*
14 - * Workaround for overflow bug in Mozilla 1.1 and earlier, where scrolling <div>s in <td> cells collapse their
15 - * height to a single line.
16 - *
17 - * Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've tried with overflow-x disable the scrolling
18 - * all the way until Mozilla 1.8 / FF 1.5 and break Opera as well.
19 - *
20 - * So... we check for reaaaally old Gecko and hack in an alternate rule to let the wide cells spill instead of
21 - * scrolling them. Not ideal as it won't work if JS is disabled, of course.
22 - */
23 - if ( window.navigator && window.navigator.product == 'Gecko' && window.navigator.productSub < '20021130' ) {
24 - document.styleSheets[document.styleSheets.length - 1].insertRule(
25 - 'table.diff td div { overflow: visible; }',
26 - document.styleSheets[document.styleSheets.length - 1].cssRules.length
27 - );
28 - }
29 -} );
30 -
31 -} )( jQuery );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.prefs.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/prefs.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.metadata.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/metadata.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.protect.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/protect.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.preview.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/preview.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.ajax.js
@@ -1,15 +1,15 @@
22 /*
3 - * Legacy emulation for the now depricated ajax.js
 3+ * Legacy emulation for the now depricated skins/common/ajax.js
44 *
55 * Original licensing information:
6 - * remote scripting library
7 - * (c) copyright 2005 modernmethod, inc
8 - *
9 - * Ported by: Trevor Parscal
 6+ * Remote Scripting Library
 7+ * (c) Copyright 2005 ModernMethod, Inc.
108 */
119
12 -( function( $ ) {
 10+( function( $, mw ) {
1311
 12+/* Extension */
 13+
1414 $.extend( mw.legacy, {
1515
1616 /* Global Variables */
@@ -36,7 +36,7 @@
3737 return true;
3838 }
3939 return false;
40 - }
 40+ },
4141 /**
4242 * Gets an XMLHttpRequest or equivilant ActiveXObject
4343 *
@@ -173,4 +173,4 @@
174174 }
175175 } );
176176
177 -} )( jQuery );
\ No newline at end of file
 177+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.upload.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/upload.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.wikibits.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/wikibits.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.edit.js
@@ -1,13 +1,19 @@
22 /*
3 - * Legacy emulation for the now depricated edit.js
4 - *
5 - * Ported by: Trevor Parscal
 3+ * Legacy emulation for the now depricated skins/common/edit.js
64 */
75
8 -( function( $ ) {
 6+( function( $, mw ) {
97
 8+/* Extension */
 9+
1010 $.extend( mw.legacy, {
 11+
 12+ /* Global Variables */
 13+
1114 'currentFocused': null,
 15+
 16+ /* Functions */
 17+
1218 /**
1319 * Generates the actual toolbar buttons with localized text we use it to avoid creating the toolbar
1420 * where javascript is not enabled
@@ -255,4 +261,4 @@
256262 } );
257263 } );
258264
259 -} )( jQuery );
\ No newline at end of file
 265+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.mwsuggest.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/mwsuggest.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.views.installer.js
@@ -0,0 +1,100 @@
 2+/*
 3+ * Web-installer progressive enhancement (ported from skins/common/config.js)
 4+ *
 5+ * Makes elements in the configuration form interactive and hides portions of the form when not in-use
 6+ */
 7+
 8+( function( $, mw ) {
 9+
 10+/* Initialization */
 11+
 12+$( document ).ready( function() {
 13+ // Show/hide code for help text
 14+ $( '.config-show-help a' ).click( function() {
 15+ $(this).parent().siblings( '.config-help-message' ).show( 'slow' );
 16+ $(this).parent().siblings( '.config-hide-help' ).show();
 17+ $(this).parent().hide();
 18+ return false;
 19+ } );
 20+ $( '.config-hide-help a' ).click( function() {
 21+ $(this).parent().siblings( '.config-help-message' ).hide( 'slow' );
 22+ $(this).parent().siblings( '.config-show-help' ).show();
 23+ $(this).parent().hide();
 24+ return false;
 25+ } );
 26+ // Show/hide code for DB-specific options
 27+ // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
 28+ $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) ).hide(); } );
 29+ $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show();
 30+ $( '.dbRadio' ).click( function() {
 31+ var $checked = $( '.dbRadio:checked' );
 32+ var $wrapper = $( '#' + $checked.attr( 'rel' ) );
 33+ if ( !$wrapper.is( ':visible' ) ) {
 34+ $( '.dbWrapper' ).hide( 'slow' );
 35+ $wrapper.show( 'slow' );
 36+ }
 37+ } );
 38+ // Scroll to the bottom of upgrade log
 39+ $( "#config-update-log" ).each( function() { this.scrollTop = this.scrollHeight; } );
 40+ // Show/hide Creative Commons thingy
 41+ $( '.licenseRadio' ).click( function() {
 42+ var $wrapper = $( '#config-cc-wrapper' );
 43+ if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
 44+ $wrapper.show( 'slow' );
 45+ } else {
 46+ $wrapper.hide( 'slow' );
 47+ }
 48+ } );
 49+ // Show/hide random stuff (email, upload)
 50+ $( '.showHideRadio' ).click( function() {
 51+ var $wrapper = $( '#' + $(this).attr( 'rel' ) );
 52+ if ( $(this).is( ':checked' ) ) {
 53+ $wrapper.show( 'slow' );
 54+ } else {
 55+ $wrapper.hide( 'slow' );
 56+ }
 57+ } );
 58+ $( '.hideShowRadio' ).click( function() {
 59+ var $wrapper = $( '#' + $(this).attr( 'rel' ) );
 60+ if ( $(this).is( ':checked' ) ) {
 61+ $wrapper.hide( 'slow' );
 62+ } else {
 63+ $wrapper.show( 'slow' );
 64+ }
 65+ } );
 66+ // Enable/disable "other" textboxes
 67+ $( '.enableForOther' ).click( function() {
 68+ var $textbox = $( '#' + $(this).attr( 'rel' ) );
 69+ if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly
 70+ $textbox.removeAttr( 'disabled' );
 71+ } else {
 72+ $textbox.attr( 'disabled', 'disabled' );
 73+ }
 74+ } );
 75+ // Synchronize radio button label for sitename with textbox
 76+ $label = $( 'label[for=config__NamespaceType_site-name]' );
 77+ labelText = $label.text();
 78+ $label.text( labelText.replace( '$1', '' ) );
 79+ $( '#config_wgSitename' ).bind( 'keyup change', syncText ).each( syncText );
 80+ function syncText() {
 81+ var value = $(this).val()
 82+ .replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
 83+ .replace( /&/, '&amp;' )
 84+ .replace( /__+/g, '_' )
 85+ .replace( /^_+/, '' )
 86+ .replace( /_+$/, '' );
 87+ value = value.substr( 0, 1 ).toUpperCase() + value.substr( 1 );
 88+ $label.text( labelText.replace( '$1', value ) );
 89+ }
 90+ // Show/Hide memcached servers when needed
 91+ $( "input[name$='config_wgMainCacheType']" ).change( function() {
 92+ var $memc = $( "#config-memcachewrapper" );
 93+ if ( $( "input[name$='config_wgMainCacheType']:checked" ).val() == 'memcached' ) {
 94+ $memc.show( 'slow' );
 95+ } else {
 96+ $memc.hide( 'slow' );
 97+ }
 98+ } );
 99+} );
 100+
 101+} )( jQuery, MediaWiki );
\ No newline at end of file
Property changes on: branches/resourceloader/phase3/resources/mw/mw.views.installer.js
___________________________________________________________________
Added: svn:eol-style
1102 + native
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.htmlform.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/htmlform.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.rightclickedit.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/rightclick.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.block.js
@@ -1,12 +1,15 @@
22 /*
3 - * Legacy emulation for the now depricated block.js
4 - *
5 - * Ported by: Trevor Parscal
 3+ * Legacy emulation for the now depricated skins/common/block.js
64 */
75
8 -( function( $ ) {
 6+( function( $, mw ) {
97
 8+/* Extension */
 9+
1010 $.extend( mw.legacy, {
 11+
 12+ /* Functions */
 13+
1114 'considerChangingExpiryFocus': function() {
1215 var $expiry = $( '#wpBlockExpiry' );
1316 var $other = $( '#wpBlockOther' );
@@ -25,7 +28,6 @@
2629 var isEmpty = address.match( /^\s*$/ );
2730 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+)?$/ );
2831 var isIpRange = isIp && address.match( /\/\d+$/ );
29 -
3032 $( '#wpAnonOnlyRow' ).css( 'display', !isIp && !isEmpty ? 'none' : '' );
3133 $( '#wpEnableAutoblockRow,#wpEnableHideUser' ).css( 'display', isIp && !isEmpty ? 'none' : '' );
3234 $( '#wpEnableWatchUser' ).css( 'display', isIpRange && !isEmpty ? 'none' : '' );
@@ -39,4 +41,4 @@
4042 mw.legacy.considerChangingExpiryFocus();
4143 } );
4244
43 -} )( jQuery );
\ No newline at end of file
 45+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.IEFixes.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/IEFixes.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.js
@@ -40,7 +40,7 @@
4141 * the browser does have a console available
4242 *
4343 * @author Michael Dale <mdale@wikimedia.org>, Trevor Parscal <tparscal@wikimedia.org>
44 - * @param {String} string String to output to console
 44+ * @param string string message to output to console
4545 */
4646 this.log = function( string ) {
4747 // Allow log messages to use a configured prefix
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.enhancedchanges.js
@@ -1,16 +1,19 @@
22 /*
3 - * Legacy emulation for the now enhancedchanges edit.js
4 - *
5 - * Ported by: Trevor Parscal
 3+ * Legacy emulation for the now depricated skins/common/enhancedchanges.js
64 */
75
8 -( function( $ ) {
 6+( function( $, mw ) {
97
 8+/* Extension */
 9+
1010 $.extend( mw.legacy, {
 11+
 12+ /* Functions */
 13+
1114 /**
1215 * Switch an RC line between hidden/shown
1316 *
14 - * @param int idNumber : the id number of the RC group
 17+ * @param integer idNumber : the id number of the RC group
1518 */
1619 'toggleVisibility': function( idNumber ) {
1720 var elements = [
@@ -22,6 +25,8 @@
2326 }
2427 } );
2528
 29+/* Initialization */
 30+
2631 $( document ).ready( function() {
2732 /*
2833 * Add the CSS to hide parts that should be collapsed
@@ -38,4 +43,4 @@
3944 );
4045 } );
4146
42 -} )( jQuery );
\ No newline at end of file
 47+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.history.js
@@ -0,0 +1,115 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/history.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+
 12+ /* Functions */
 13+
 14+ 'historyRadios': function( parent ) {
 15+ var inputs = parent.getElementsByTagName('input');
 16+ var radios = [];
 17+ for (var i = 0; i < inputs.length; i++) {
 18+ if (inputs[i].name == "diff" || inputs[i].name == "oldid") {
 19+ radios[radios.length] = inputs[i];
 20+ }
 21+ }
 22+ return radios;
 23+ },
 24+ /*
 25+ * Check selection and tweak visibility/class onclick
 26+ */
 27+ 'diffcheck': function() {
 28+ var dli = false; // the li where the diff radio is checked
 29+ var oli = false; // the li where the oldid radio is checked
 30+ var hf = document.getElementById('pagehistory');
 31+ if (!hf) {
 32+ return true;
 33+ }
 34+ var lis = hf.getElementsByTagName('li');
 35+ for (var i=0;i<lis.length;i++) {
 36+ var inputs = historyRadios(lis[i]);
 37+ if (inputs[1] && inputs[0]) {
 38+ if (inputs[1].checked || inputs[0].checked) { // this row has a checked radio button
 39+ if (inputs[1].checked && inputs[0].checked && inputs[0].value == inputs[1].value) {
 40+ return false;
 41+ }
 42+ if (oli) { // it's the second checked radio
 43+ if (inputs[1].checked) {
 44+ if ( (typeof oli.className) != 'undefined') {
 45+ oli.classNameOriginal = oli.className.replace( 'selected', '' );
 46+ } else {
 47+ oli.classNameOriginal = '';
 48+ }
 49+
 50+ oli.className = "selected "+oli.classNameOriginal;
 51+ return false;
 52+ }
 53+ } else if (inputs[0].checked) {
 54+ return false;
 55+ }
 56+ if (inputs[0].checked) {
 57+ dli = lis[i];
 58+ }
 59+ if (!oli) {
 60+ inputs[0].style.visibility = 'hidden';
 61+ }
 62+ if (dli) {
 63+ inputs[1].style.visibility = 'hidden';
 64+ }
 65+ if ( (typeof lis[i].className) != 'undefined') {
 66+ lis[i].classNameOriginal = lis[i].className.replace( 'selected', '' );
 67+ } else {
 68+ lis[i].classNameOriginal = '';
 69+ }
 70+
 71+ lis[i].className = "selected "+lis[i].classNameOriginal;
 72+ oli = lis[i];
 73+ } else { // no radio is checked in this row
 74+ if (!oli) {
 75+ inputs[0].style.visibility = 'hidden';
 76+ } else {
 77+ inputs[0].style.visibility = 'visible';
 78+ }
 79+ if (dli) {
 80+ inputs[1].style.visibility = 'hidden';
 81+ } else {
 82+ inputs[1].style.visibility = 'visible';
 83+ }
 84+ if ( typeof lis[i].classNameOriginal != 'undefined' ) {
 85+ lis[i].className = lis[i].classNameOriginal;
 86+ }
 87+ }
 88+ }
 89+ }
 90+ return true;
 91+ },
 92+ /*
 93+ * Attach event handlers to the input elements on history page
 94+ */
 95+ 'histrowinit': function() {
 96+ var hf = document.getElementById('pagehistory');
 97+ if (!hf) return;
 98+ var lis = hf.getElementsByTagName('li');
 99+ for (var i = 0; i < lis.length; i++) {
 100+ var inputs = historyRadios(lis[i]);
 101+ if (inputs[0] && inputs[1]) {
 102+ inputs[0].onclick = diffcheck;
 103+ inputs[1].onclick = diffcheck;
 104+ }
 105+ }
 106+ diffcheck();
 107+ }
 108+} );
 109+
 110+/* Initialization */
 111+
 112+$( document ).ready( function() {
 113+ mw.legacy.histrowinit();
 114+} );
 115+
 116+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.views.diff.js
@@ -0,0 +1,28 @@
 2+/*
 3+ * Diff-view progressive enhancement (ported from skins/common/diff.js)
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Initialization */
 9+
 10+$( document ).ready( function() {
 11+ /*
 12+ * Workaround for overflow bug in Mozilla 1.1 and earlier, where scrolling <div>s in <td> cells collapse their
 13+ * height to a single line.
 14+ *
 15+ * Known to be fixed in 1.2.1 (Gecko 20021130), but the CSS hacks I've tried with overflow-x disable the scrolling
 16+ * all the way until Mozilla 1.8 / FF 1.5 and break Opera as well.
 17+ *
 18+ * So... we check for reaaaally old Gecko and hack in an alternate rule to let the wide cells spill instead of
 19+ * scrolling them. Not ideal as it won't work if JS is disabled, of course.
 20+ */
 21+ if ( window.navigator && window.navigator.product == 'Gecko' && window.navigator.productSub < '20021130' ) {
 22+ document.styleSheets[document.styleSheets.length - 1].insertRule(
 23+ 'table.diff td div { overflow: visible; }',
 24+ document.styleSheets[document.styleSheets.length - 1].cssRules.length
 25+ );
 26+ }
 27+} );
 28+
 29+} )( jQuery, MediaWiki );
\ No newline at end of file
Property changes on: branches/resourceloader/phase3/resources/mw/mw.views.diff.js
___________________________________________________________________
Added: svn:eol-style
130 + native
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.search.js
@@ -0,0 +1,19 @@
 2+/*
 3+ * Legacy emulation for the now depricated skins/common/search.js
 4+ */
 5+
 6+( function( $, mw ) {
 7+
 8+/* Extension */
 9+
 10+$.extend( mw.legacy, {
 11+ //
 12+} );
 13+
 14+/* Initialization */
 15+
 16+$( document ).ready( function() {
 17+ //
 18+} );
 19+
 20+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.changepassword.js
@@ -1,12 +1,15 @@
22 /*
3 - * Legacy emulation for the now depricated changepassword.js
4 - *
5 - * Ported by: Trevor Parscal
 3+ * Legacy emulation for the now depricated skins/common/changepassword.js
64 */
75
8 -( function( $ ) {
 6+( function( $, mw ) {
97
 8+/* Extension */
 9+
1010 $.extend( mw.legacy, {
 11+
 12+ /* Functions */
 13+
1114 'onNameChange': function() {
1215 var state = mw.legacy.wgUserName != $( '#wpName' ).val();
1316 $( '#wpPassword' ).attr( 'disabled', state );
@@ -23,4 +26,4 @@
2427 mw.legacy.onNameChangeHook();
2528 } );
2629
27 -} )( jQuery );
\ No newline at end of file
 30+} )( jQuery, MediaWiki );
\ No newline at end of file
Index: branches/resourceloader/phase3/resources/mw/mw.legacy.ajaxwatch.js
@@ -1,68 +1,85 @@
22 /*
3 - * Legacy emulation for the now depricated ajaxwatch.js
 3+ * Legacy emulation for the now depricated skins/common/ajaxwatch.js
44 *
5 - * Ported by: Trevor Parscal
 5+ * AJAX functionality for the watch/unwatch link
66 *
7 - * Animate watch/unwatch links to use asynchronous API requests to watch pages, rather than clicking on links
8 - *
9 - * Warning: Uses mw.legacy.jsMsg() from mw.legacy.wikibits.js
 7+ * @depends mw.legacy.jsMsg() from mw.legacy.wikibits.js
108 */
119
12 -( function( $ ) {
 10+( function( $, mw ) {
1311
14 -if ( typeof mw.legacy.wgAjaxWatch === "undefined" || !mw.legacy.wgAjaxWatch ) {
15 - $.extend( mw.legacy, {
16 - 'wgAjaxWatch': {
17 - 'watchMsg': 'Watch',
18 - 'unwatchMsg': 'Unwatch',
19 - 'watchingMsg': 'Watching...',
20 - 'unwatchingMsg': 'Unwatching...',
21 - 'tooltip-ca-watchMsg': 'Add this page to your watchlist',
22 - 'tooltip-ca-unwatchMsg': 'Remove this page from your watchlist'
23 - }
24 - } );
25 -}
26 -$.extend( mw.legacy.wgAjaxWatch, {
27 - 'setLinkText': function( $link, action ) {
28 - if ( action == 'watch' || action == 'unwatch' ) {
29 - // save the accesskey from the title
30 - var keyCommand = $link.attr( 'title' ).match( /\[.*?\]$/ ) ?
31 - $link.attr( 'title' ).match( /\[.*?\]$/ )[0] : '';
32 - $link.attr( 'title', wgAjaxWatch['tooltip-ca-' + action + 'Msg'] + ' ' + keyCommand );
33 - }
34 - if ( $link.data( 'icon' ) ) {
35 - $link.attr( 'alt', wgAjaxWatch[action + 'Msg'] );
36 - if ( action == 'watching' || action == 'unwatching' ) {
37 - $link.addClass( 'loading' );
 12+/* Extension */
 13+
 14+$.extend( mw.legacy, {
 15+
 16+ /* Global Variables */
 17+
 18+ 'wgAjaxWatch': {
 19+
 20+ /* Global Variables */
 21+
 22+ 'watchMsg': 'Watch',
 23+ 'unwatchMsg': 'Unwatch',
 24+ 'watchingMsg': 'Watching...',
 25+ 'unwatchingMsg': 'Unwatching...',
 26+ 'tooltip-ca-watchMsg': 'Add this page to your watchlist',
 27+ 'tooltip-ca-unwatchMsg': 'Remove this page from your watchlist',
 28+
 29+ /* Functions */
 30+
 31+ /**
 32+ * Sets the text of the watch/unwatch link
 33+ *
 34+ * @param object link DOM node or jQuery selection of link to set text of
 35+ * @param string action message to use ('watch', 'unwatch', 'watching' or 'unwatching')
 36+ */
 37+ 'setLinkText': function( link, action ) {
 38+ var $link = $( link );
 39+ if ( action == 'watch' || action == 'unwatch' ) {
 40+ // save the accesskey from the title
 41+ var keyCommand = $link.attr( 'title' ).match( /\[.*?\]$/ ) ?
 42+ $link.attr( 'title' ).match( /\[.*?\]$/ )[0] : '';
 43+ $link.attr( 'title', wgAjaxWatch['tooltip-ca-' + action + 'Msg'] + ' ' + keyCommand );
 44+ }
 45+ if ( $link.data( 'icon' ) ) {
 46+ $link.attr( 'alt', wgAjaxWatch[action + 'Msg'] );
 47+ if ( action == 'watching' || action == 'unwatching' ) {
 48+ $link.addClass( 'loading' );
 49+ } else {
 50+ $link.removeClass( 'loading' );
 51+ }
3852 } else {
39 - $link.removeClass( 'loading' );
 53+ $link.html( wgAjaxWatch[action+'Msg'] );
4054 }
41 - } else {
42 - $link.html( wgAjaxWatch[action+'Msg'] );
 55+ },
 56+ /**
 57+ * Processes responses from the server
 58+ *
 59+ * @param object response data from server
 60+ */
 61+ 'processResult': function( response ) {
 62+ response = response.watch;
 63+ var $link = $(this);
 64+ // To ensure we set the same status for all watch links with the same target we trigger a custom event on
 65+ // *all* watch links.
 66+ if ( response.watched !== undefined ) {
 67+ wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'watch'] );
 68+ } else if ( response.unwatched !== undefined ){
 69+ wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'unwatch'] );
 70+ } else {
 71+ // Either we got an error code or it just plain broke.
 72+ window.location.href = $link.attr( 'href' );
 73+ return;
 74+ }
 75+ mw.legacy.jsMsg( response.message, 'watch' );
 76+ // Bug 12395 - update the watch checkbox on edit pages when the page is watched or unwatched via the tab.
 77+ if ( response.watched !== undefined ) {
 78+ $j("#wpWatchthis").attr( 'checked', '1' );
 79+ } else {
 80+ $j("#wpWatchthis").removeAttr( 'checked' );
 81+ }
4382 }
44 - },
45 - 'processResult': function( response ) {
46 - response = response.watch;
47 - var $link = $(this);
48 - // To ensure we set the same status for all watch links with the same target we trigger a custom event on
49 - // *all* watch links.
50 - if ( response.watched !== undefined ) {
51 - wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'watch'] );
52 - } else if ( response.unwatched !== undefined ){
53 - wgAjaxWatch.$links.trigger( 'mw-ajaxwatch', [response.title, 'unwatch'] );
54 - } else {
55 - // Either we got an error code or it just plain broke.
56 - window.location.href = $link.attr( 'href' );
57 - return;
58 - }
59 - mw.legacy.jsMsg( response.message, 'watch' );
60 - // Bug 12395 - update the watch checkbox on edit pages when the page is watched or unwatched via the tab.
61 - if ( response.watched !== undefined ) {
62 - $j("#wpWatchthis").attr( 'checked', '1' );
63 - } else {
64 - $j("#wpWatchthis").removeAttr( 'checked' );
65 - }
66 - }
 83+ } );
6784 } );
6885
6986 /* Initialization */
@@ -116,4 +133,4 @@
117134 mw.legacy.wgAjaxWatch.$links = $links;
118135 } );
119136
120 -} )( jQuery );
\ No newline at end of file
 137+} )( jQuery, MediaWiki );
\ No newline at end of file

Status & tagging log