From bc0f9cac32c1fed8c2c7127c1aa37dd415c9c129 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Mon, 31 Jan 2011 19:33:16 +0000 Subject: [PATCH] Wrapping core modules (FIXME from r79929) (Touch: r74088, r73046) --- resources/jquery/jquery.autoEllipsis.js | 2 +- resources/jquery/jquery.checkboxShiftClick.js | 5 +++-- resources/jquery/jquery.client.js | 4 ++++ resources/jquery/jquery.color.js | 2 +- resources/jquery/jquery.colorUtil.js | 6 ++++-- resources/jquery/jquery.delayedBind.js | 2 +- resources/jquery/jquery.form.js | 2 +- resources/jquery/jquery.localize.js | 2 ++ resources/jquery/jquery.makeCollapsible.js | 4 +++- resources/jquery/jquery.placeholder.js | 2 ++ resources/jquery/jquery.suggestions.js | 4 +++- resources/jquery/jquery.tabIndex.js | 7 ++++++- resources/jquery/jquery.textSelection.js | 2 ++ resources/mediawiki.language/mediawiki.language.js | 14 ++++++++------ .../mediawiki.special.preferences.js | 2 ++ .../mediawiki.special/mediawiki.special.search.js | 5 ++++- .../mediawiki.util/mediawiki.util.jpegmeta.js | 2 +- resources/mediawiki.util/mediawiki.util.js | 7 +++---- resources/mediawiki.util/mediawiki.util.test.js | 6 +++--- 19 files changed, 54 insertions(+), 26 deletions(-) diff --git a/resources/jquery/jquery.autoEllipsis.js b/resources/jquery/jquery.autoEllipsis.js index 1af65a69e1..4993118d84 100644 --- a/resources/jquery/jquery.autoEllipsis.js +++ b/resources/jquery/jquery.autoEllipsis.js @@ -128,4 +128,4 @@ $.fn.autoEllipsis = function( options ) { } ); }; -} )( jQuery ); +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.checkboxShiftClick.js b/resources/jquery/jquery.checkboxShiftClick.js index 2d965b0fc4..cfa696d479 100644 --- a/resources/jquery/jquery.checkboxShiftClick.js +++ b/resources/jquery/jquery.checkboxShiftClick.js @@ -6,7 +6,7 @@ * @author Krinkle * @license GPL v2 */ - +( function( $ ) { $.fn.checkboxShiftClick = function( text ) { var prevCheckbox = null; var $box = this; @@ -24,4 +24,5 @@ $.fn.checkboxShiftClick = function( text ) { prevCheckbox = e.target; } ); return $box; -}; \ No newline at end of file +}; +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.client.js b/resources/jquery/jquery.client.js index 38aa61552b..93c05bb4e8 100644 --- a/resources/jquery/jquery.client.js +++ b/resources/jquery/jquery.client.js @@ -1,6 +1,8 @@ /** * User-agent detection */ + */ +( function( $ ) { $.client = new ( function() { /* Private Members */ @@ -201,3 +203,5 @@ $( document ).ready( function() { .addClass( 'client-' + profile.layout ) .addClass( 'client-' + profile.platform ); } ); + +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.color.js b/resources/jquery/jquery.color.js index 59b8c82f06..b0419428ec 100644 --- a/resources/jquery/jquery.color.js +++ b/resources/jquery/jquery.color.js @@ -3,7 +3,7 @@ * Copyright 2007 John Resig * Released under the MIT and GPL licenses. * - * - 2011-01-05: Modified by Krinkle to use the jQuery.colorUtil plugin (has to be loaded first) + * - 2011-01-05: Modified by Krinkle to use the jQuery.colorUtil plugin (which has to be loaded first!) */ (function( $ ) { diff --git a/resources/jquery/jquery.colorUtil.js b/resources/jquery/jquery.colorUtil.js index 00a76ed2a1..1116aec620 100644 --- a/resources/jquery/jquery.colorUtil.js +++ b/resources/jquery/jquery.colorUtil.js @@ -5,6 +5,7 @@ * Mostly based on other plugins and functions (taken through JSLint and optimized a little). * Sources cited locally. */ +( function( $ ) { $.colorUtil = { // Color Conversion function from highlightFade @@ -45,7 +46,7 @@ $.colorUtil = { } // Otherwise, we're most likely dealing with a named color - return $.colorUtil.colors[jQuery.trim(color).toLowerCase()]; + return $.colorUtil.colors[$.trim(color).toLowerCase()]; }, // Some named colors to work with @@ -188,4 +189,5 @@ $.colorUtil = { ')'; } -}; \ No newline at end of file +}; +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.delayedBind.js b/resources/jquery/jquery.delayedBind.js index 49e1ac5cbd..6d97299623 100644 --- a/resources/jquery/jquery.delayedBind.js +++ b/resources/jquery/jquery.delayedBind.js @@ -65,4 +65,4 @@ $.fn.extend( { } ); } } ); -} )( jQuery ); +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.form.js b/resources/jquery/jquery.form.js index 4176e191a2..53c078f9f5 100644 --- a/resources/jquery/jquery.form.js +++ b/resources/jquery/jquery.form.js @@ -8,7 +8,7 @@ * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ -;(function($) { +(function($) { /* Usage Note: diff --git a/resources/jquery/jquery.localize.js b/resources/jquery/jquery.localize.js index a94dfe881a..b913f336e1 100644 --- a/resources/jquery/jquery.localize.js +++ b/resources/jquery/jquery.localize.js @@ -21,6 +21,7 @@ * My Alt Message *

*/ +( function( $ ) { /** * Localizes a DOM selection by replacing elements with localized text and adding * localized title and alt attributes to elements with title-msg and alt-msg attributes @@ -58,3 +59,4 @@ $.fn.localize = function( options ) { // Let IE know about the msg tag before it's used... document.createElement( 'msg' ); +} )( jQuery ); diff --git a/resources/jquery/jquery.makeCollapsible.js b/resources/jquery/jquery.makeCollapsible.js index 127cc8e6ca..86abe8d464 100644 --- a/resources/jquery/jquery.makeCollapsible.js +++ b/resources/jquery/jquery.makeCollapsible.js @@ -14,6 +14,7 @@ * @license CC-BY 3.0 * @license GPL2 */ +( function( $, mw ) { $.fn.makeCollapsible = function() { @@ -293,4 +294,5 @@ $.fn.makeCollapsible = function() { $toggleLink.click(); } } ); -}; \ No newline at end of file +}; +} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/jquery/jquery.placeholder.js b/resources/jquery/jquery.placeholder.js index 1d3fd674ac..bcff4e7c0a 100644 --- a/resources/jquery/jquery.placeholder.js +++ b/resources/jquery/jquery.placeholder.js @@ -8,6 +8,7 @@ * @version 0.2.0 * @license GPL v2 */ +( function( $ ) { $.fn.placeholder = function() { @@ -59,3 +60,4 @@ $.fn.placeholder = function() { }); }; +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.suggestions.js b/resources/jquery/jquery.suggestions.js index 8dbd77a1cb..64e06d90db 100644 --- a/resources/jquery/jquery.suggestions.js +++ b/resources/jquery/jquery.suggestions.js @@ -41,6 +41,7 @@ * highlightInput: Whether to hightlight matched portions of the input or not * Type: Boolean, Default: false */ +( function( $ ) { $.suggestions = { /** @@ -515,4 +516,5 @@ $.fn.suggestions = function() { $(this).data( 'suggestions-context', context ); } ); return returnValue !== null ? returnValue : $(this); -}; \ No newline at end of file +}; +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.tabIndex.js b/resources/jquery/jquery.tabIndex.js index 3ae1a5cf48..784f8c9938 100644 --- a/resources/jquery/jquery.tabIndex.js +++ b/resources/jquery/jquery.tabIndex.js @@ -1,3 +1,7 @@ +/** + * jQuery tabIndex + */ +( function( $ ) { /** * Finds the lowerst tabindex in use within a selection * @@ -28,4 +32,5 @@ $.fn.lastTabIndex = function() { } } ); return maxTabIndex; -}; \ No newline at end of file +}; +} )( jQuery ); \ No newline at end of file diff --git a/resources/jquery/jquery.textSelection.js b/resources/jquery/jquery.textSelection.js index 2d1633bceb..f31a1a7b55 100644 --- a/resources/jquery/jquery.textSelection.js +++ b/resources/jquery/jquery.textSelection.js @@ -1,6 +1,7 @@ /** * These plugins provide extra functionality for interaction with textareas. */ +( function( $ ) { $.fn.textSelection = function( command, options ) { var fn = { /** @@ -399,3 +400,4 @@ scrollToCaretPosition: function( options ) { } return retval; }; +} )( jQuery ); \ No newline at end of file diff --git a/resources/mediawiki.language/mediawiki.language.js b/resources/mediawiki.language/mediawiki.language.js index 4d5a0a796c..f199101be1 100644 --- a/resources/mediawiki.language/mediawiki.language.js +++ b/resources/mediawiki.language/mediawiki.language.js @@ -5,8 +5,9 @@ * Language.php in MediaWiki. This object contains methods for loading and * transforming message text. */ +( function( $, mw ) { -mediaWiki.language = { +mw.language = { /** * Process the PLURAL template substitution * @@ -19,15 +20,15 @@ mediaWiki.language = { * @example {{Template:title|params}} */ 'procPLURAL': function( template ) { - if ( template.title && template.parameters && mediaWiki.language.convertPlural ) { + if ( template.title && template.parameters && mw.language.convertPlural ) { // Check if we have forms to replace if ( template.parameters.length == 0 ) { return ''; } // Restore the count into a Number ( if it got converted earlier ) - var count = mediaWiki.language.convertNumber( template.title, true ); + var count = mw.language.convertNumber( template.title, true ); // Do convertPlural call - return mediaWiki.language.convertPlural( parseInt( count ), template.parameters ); + return mw.language.convertPlural( parseInt( count ), template.parameters ); } // Could not process plural return first form or nothing if ( template.parameters[0] ) { @@ -68,11 +69,11 @@ mediaWiki.language = { * @param {boolean} integer Convert the return value to an integer */ 'convertNumber': function( number, integer ) { - if ( !mediaWiki.language.digitTransformTable ) { + if ( !mw.language.digitTransformTable ) { return number; } // Set the target Transform table: - var transformTable = mediaWiki.language.digitTransformTable; + var transformTable = mw.language.digitTransformTable; // Check if the "restore" to Latin number flag is set: if ( integer ) { if ( parseInt( number ) == number ) { @@ -98,3 +99,4 @@ mediaWiki.language = { // Digit Transform Table, populated by language classes where applicable 'digitTransformTable': null }; +} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki.special/mediawiki.special.preferences.js b/resources/mediawiki.special/mediawiki.special.preferences.js index f919f395e5..1775bec450 100644 --- a/resources/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/mediawiki.special/mediawiki.special.preferences.js @@ -1,6 +1,7 @@ /* * JavaScript for Special:Preferences */ +( function( $, mw ) { $( '#prefsubmit' ).attr( 'id', 'prefcontrol' ); $( '#preferences' ) @@ -73,3 +74,4 @@ $( '#mw-input-wpemailaddress' ).one( 'blur', function() { updateMailValidityLabel( $(this).val() ); } ); } ); +} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki.special/mediawiki.special.search.js b/resources/mediawiki.special/mediawiki.special.search.js index 1b56857b86..d4317188bb 100644 --- a/resources/mediawiki.special/mediawiki.special.search.js +++ b/resources/mediawiki.special/mediawiki.special.search.js @@ -1,8 +1,11 @@ /* * JavaScript for Specical:Search */ +( function( $, mw ) { // Emulate HTML5 autofocus behavior in non HTML5 compliant browsers if ( !( 'autofocus' in document.createElement( 'input' ) ) ) { - $( 'input[autofocus]' ).focus(); + $( 'input[autofocus]:first' ).focus(); } + +} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki.util/mediawiki.util.jpegmeta.js b/resources/mediawiki.util/mediawiki.util.jpegmeta.js index c882d9a798..d9800c1dc0 100644 --- a/resources/mediawiki.util/mediawiki.util.jpegmeta.js +++ b/resources/mediawiki.util/mediawiki.util.jpegmeta.js @@ -735,4 +735,4 @@ return new JpegMeta.JpegFile( fileReaderResult, fileName ); }; -} )( jQuery, mediaWiki ); +} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki.util/mediawiki.util.js b/resources/mediawiki.util/mediawiki.util.js index 5bffc045d5..8c44b91921 100644 --- a/resources/mediawiki.util/mediawiki.util.js +++ b/resources/mediawiki.util/mediawiki.util.js @@ -1,8 +1,7 @@ /** * Utilities */ - -(function($, mw) { +( function( $, mw ) { mw.util = { @@ -13,7 +12,7 @@ this.initialised = true; // Any initialisation after the DOM is ready - $(function() { + $( function() { // Shortcut to client profile return var profile = $.client.profile(); @@ -516,4 +515,4 @@ mw.util.init(); -})(jQuery, mediaWiki); +} )( jQuery, mediaWiki ); \ No newline at end of file diff --git a/resources/mediawiki.util/mediawiki.util.test.js b/resources/mediawiki.util/mediawiki.util.test.js index e70842cf10..4d8a7d5355 100644 --- a/resources/mediawiki.util/mediawiki.util.test.js +++ b/resources/mediawiki.util/mediawiki.util.test.js @@ -8,7 +8,7 @@ ( function( $, mw ) { - mediaWiki.test = { + mw.test = { /* Variables */ '$table' : null, @@ -403,6 +403,6 @@ } }; - mediaWiki.test.init(); + mw.test.init(); -} )(jQuery, mediaWiki); +} )(jQuery, mediaWiki); \ No newline at end of file -- 2.20.1