Removing unneeded wraps and using $ and mw instead of jQuery or mediaWiki since r7924...
authorKrinkle <krinkle@users.mediawiki.org>
Mon, 10 Jan 2011 05:33:03 +0000 (05:33 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Mon, 10 Jan 2011 05:33:03 +0000 (05:33 +0000)
(the wraps had an extra indention, hence the diff will probably look huge)

resources/jquery/jquery.checkboxShiftClick.js
resources/jquery/jquery.client.js
resources/jquery/jquery.color.js
resources/jquery/jquery.colorUtil.js
resources/jquery/jquery.hoverIntent.js
resources/jquery/jquery.localize.js
resources/jquery/jquery.placeholder.js
resources/jquery/jquery.suggestions.js
resources/jquery/jquery.tabIndex.js
resources/jquery/jquery.textSelection.js
resources/mediawiki.special/mediawiki.special.changeslist.css

index b0f96f0..2d965b0 100644 (file)
@@ -7,21 +7,21 @@
  * @license GPL v2
  */
 
-jQuery.fn.checkboxShiftClick = function( text ) {
+$.fn.checkboxShiftClick = function( text ) {
        var prevCheckbox = null;
        var $box = this;
        // When our boxes are clicked..
-       $box.click(function (e) {
+       $box.click( function( e ) {
                // And one has been clicked before...
-               if (prevCheckbox !== null && e.shiftKey) {
+               if ( prevCheckbox !== null && e.shiftKey ) {
                        // Check or uncheck this one and all in-between checkboxes
                        $box.slice(
-                         Math.min($box.index(prevCheckbox), $box.index(e.target)),
-                         Math.max($box.index(prevCheckbox), $box.index(e.target)) + 1
-                       ).attr({checked: e.target.checked ? 'checked' : ''});
+                         Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
+                         Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
+                       ).attr( {checked: e.target.checked ? 'checked' : ''} );
                }
                // Either way, update the prevCheckbox variable to the one clicked now
                prevCheckbox = e.target;
-       });
+       } );
        return $box;
 };
\ No newline at end of file
index 10ac11f..81f220e 100644 (file)
@@ -1,7 +1,7 @@
-/*
+/**
  * User-agent detection
  */
-jQuery.client = new ( function() {
+$.client = new ( function() {
 
        /* Private Members */
 
@@ -166,8 +166,8 @@ jQuery.client = new ( function() {
         * @return Boolean true if browser known or assumed to be supported, false if blacklisted
         */
        this.test = function( map ) {
-               var profile = jQuery.client.profile();
-               var dir = jQuery( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr';
+               var profile = $.client.profile();
+               var dir = $( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr';
                // Check over each browser condition to determine if we are running in a compatible client
                if ( typeof map[dir] !== 'object' || map[dir][profile.name] !== 'object' ) {
                        // Unknown, so we assume it's working
index 3866107..59b8c82 100644 (file)
@@ -1,43 +1,44 @@
-/*
+/**
  * jQuery Color Animations
  * Copyright 2007 John Resig
  * Released under the MIT and GPL licenses.
  *
- * - 2011-01-05: Modified by Krinkle to use the jQuery.colorUtil plugin (needs to be loaded first)
+ * - 2011-01-05: Modified by Krinkle to use the jQuery.colorUtil plugin (has to be loaded first)
  */
-
-(function(jQuery){
+(function( $ ) {
 
        // We override the animation for all of these color styles
-       jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
-               jQuery.fx.step[attr] = function(fx){
-                       if ( fx.state == 0 ) {
-                               fx.start = getColor( fx.elem, attr );
-                               fx.end = $.colorUtil.getRGB( fx.end );
+       $.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'],
+               function( i, attr ) {
+                       $.fx.step[attr] = function( fx ) {
+                               if ( fx.state == 0 ) {
+                                       fx.start = getColor( fx.elem, attr );
+                                       fx.end = $.colorUtil.getRGB( fx.end );
+                               }
+               
+                               fx.elem.style[attr] = 'rgb(' + [
+                                       Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
+                                       Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
+                                       Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
+                               ].join( ',' ) + ')';
                        }
-
-                       fx.elem.style[attr] = "rgb(" + [
-                               Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
-                               Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
-                               Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
-                       ].join(",") + ")";
                }
-       });
+       );
        
        function getColor(elem, attr) {
                var color;
 
                do {
-                       color = jQuery.curCSS(elem, attr);
+                       color = $.curCSS(elem, attr);
 
                        // Keep going until we find an element that has color, or we hit the body
-                       if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
+                       if ( color != '' && color != 'transparent' || $.nodeName(elem, 'body') )
                                break; 
 
-                       attr = "backgroundColor";
+                       attr = 'backgroundColor';
                } while ( elem = elem.parentNode );
 
                return $.colorUtil.getRGB(color);
        };
        
-})(jQuery);
+} )( jQuery );
index 39c4fc2..00a76ed 100644 (file)
-/*
+/**
  * jQuery Color Utilities
  * Written by Krinkle in 2011
  * Released under the MIT and GPL licenses.
  * Mostly based on other plugins and functions (taken through JSLint and optimized a little).
  * Sources cited locally.
  */
-( function( $ ) {
-
-       $.colorUtil = {
-
-               // Color Conversion function from highlightFade
-               // By Blair Mitchelmore
-               // http://jquery.offput.ca/highlightFade/
-               // Parse strings looking for color tuples [255,255,255]
-               getRGB : function( color ) {
-                       var result;
-
-                       // Check if we're already dealing with an array of colors
-                       if ( color && color.constructor == Array && color.length == 3 ){
-                               return color;
-                       }
-
-                       // Look for rgb(num,num,num)
-                       if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
-                               return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
-                       }
-
-                       // Look for rgb(num%,num%,num%)
-                       if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) {
-                               return [parseFloat(result[1],10)*2.55, parseFloat(result[2],10)*2.55, parseFloat(result[3])*2.55];
-                       }
-
-                       // Look for #a0b1c2
-                       if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) {
-                               return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
-                       }
-
-                       // Look for #fff
-                       if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) {
-                               return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
-                       }
-
-                       // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
-                       if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) {
-                               return $.colorUtil.colors.transparent;
-                       }
+$.colorUtil = {
+
+       // Color Conversion function from highlightFade
+       // By Blair Mitchelmore
+       // http://jquery.offput.ca/highlightFade/
+       // Parse strings looking for color tuples [255,255,255]
+       getRGB : function( color ) {
+               var result;
+
+               // Check if we're already dealing with an array of colors
+               if ( color && color.constructor == Array && color.length == 3 ){
+                       return color;
+               }
 
-                       // Otherwise, we're most likely dealing with a named color
-                       return $.colorUtil.colors[jQuery.trim(color).toLowerCase()];
-               },
+               // Look for rgb(num,num,num)
+               if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
+                       return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
+               }
 
-               // Some named colors to work with
-               // From Interface by Stefan Petre
-               // http://interface.eyecon.ro/
-               colors: {
-                       aqua:[0,255,255],
-                       azure:[240,255,255],
-                       beige:[245,245,220],
-                       black:[0,0,0],
-                       blue:[0,0,255],
-                       brown:[165,42,42],
-                       cyan:[0,255,255],
-                       darkblue:[0,0,139],
-                       darkcyan:[0,139,139],
-                       darkgrey:[169,169,169],
-                       darkgreen:[0,100,0],
-                       darkkhaki:[189,183,107],
-                       darkmagenta:[139,0,139],
-                       darkolivegreen:[85,107,47],
-                       darkorange:[255,140,0],
-                       darkorchid:[153,50,204],
-                       darkred:[139,0,0],
-                       darksalmon:[233,150,122],
-                       darkviolet:[148,0,211],
-                       fuchsia:[255,0,255],
-                       gold:[255,215,0],
-                       green:[0,128,0],
-                       indigo:[75,0,130],
-                       khaki:[240,230,140],
-                       lightblue:[173,216,230],
-                       lightcyan:[224,255,255],
-                       lightgreen:[144,238,144],
-                       lightgrey:[211,211,211],
-                       lightpink:[255,182,193],
-                       lightyellow:[255,255,224],
-                       lime:[0,255,0],
-                       magenta:[255,0,255],
-                       maroon:[128,0,0],
-                       navy:[0,0,128],
-                       olive:[128,128,0],
-                       orange:[255,165,0],
-                       pink:[255,192,203],
-                       purple:[128,0,128],
-                       violet:[128,0,128],
-                       red:[255,0,0],
-                       silver:[192,192,192],
-                       white:[255,255,255],
-                       yellow:[255,255,0],
-                       transparent: [255,255,255]
-               },
-               /**
-                * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
-                * Converts an RGB color value to HSL. Conversion formula
-                * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
-                * Assumes r, g, and b are contained in the set [0, 255] and
-                * returns h, s, and l in the set [0, 1].
-                *
-                * @param       Number  R               The red color value
-                * @param       Number  G               The green color value
-                * @param       Number  B               The blue color value
-                * @return      Array                   The HSL representation
-                */
-               rgbToHsl: function( R, G, B ) {
-                       var     r = R / 255,
-                               g = G / 255,
-                               b = B / 255;
-                       var max = Math.max(r, g, b), min = Math.min(r, g, b);
-                       var h, s, l = (max + min) / 2;
+               // Look for rgb(num%,num%,num%)
+               if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) {
+                       return [parseFloat(result[1],10)*2.55, parseFloat(result[2],10)*2.55, parseFloat(result[3])*2.55];
+               }
 
-                       if(max == min){
-                               h = s = 0; // achromatic
-                       }else{
-                               var d = max - min;
-                               s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
-                               switch(max){
-                                       case r: h = (g - b) / d + (g < b ? 6 : 0); break;
-                                       case g: h = (b - r) / d + 2; break;
-                                       case b: h = (r - g) / d + 4; break;
-                               }
-                               h /= 6;
-                       }
+               // Look for #a0b1c2
+               if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) {
+                       return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
+               }
 
-                       return [h, s, l];
-               },
-               /**
-                * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
-                * Converts an HSL color value to RGB. Conversion formula
-                * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
-                * Assumes h, s, and l are contained in the set [0, 1] and
-                * returns r, g, and b in the set [0, 255].
-                *
-                * @param       Number  h               The hue
-                * @param       Number  s               The saturation
-                * @param       Number  l               The lightness
-                * @return      Array                   The RGB representation
-                */
-               hslToRgb: function( h, s, l ) {
-                       var r, g, b;
+               // Look for #fff
+               if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) {
+                       return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
+               }
 
-                       if(s === 0){
-                               r = g = b = l; // achromatic
-                       }else{
-                               var hue2rgb = function(p, q, t){
-                                       if(t < 0){ t += 1; }
-                                       if(t > 1){ t -= 1; }
-                                       if(t < 1/6){ return p + (q - p) * 6 * t; }
-                                       if(t < 1/2){ return q; }
-                                       if(t < 2/3){ return p + (q - p) * (2/3 - t) * 6; }
-                                       return p;
-                               };
+               // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
+               if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) {
+                       return $.colorUtil.colors.transparent;
+               }
 
-                               var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
-                               var p = 2 * l - q;
-                               r = hue2rgb(p, q, h + 1/3);
-                               g = hue2rgb(p, q, h);
-                               b = hue2rgb(p, q, h - 1/3);
+               // Otherwise, we're most likely dealing with a named color
+               return $.colorUtil.colors[jQuery.trim(color).toLowerCase()];
+       },
+
+       // Some named colors to work with
+       // From Interface by Stefan Petre
+       // http://interface.eyecon.ro/
+       colors: {
+               aqua:[0,255,255],
+               azure:[240,255,255],
+               beige:[245,245,220],
+               black:[0,0,0],
+               blue:[0,0,255],
+               brown:[165,42,42],
+               cyan:[0,255,255],
+               darkblue:[0,0,139],
+               darkcyan:[0,139,139],
+               darkgrey:[169,169,169],
+               darkgreen:[0,100,0],
+               darkkhaki:[189,183,107],
+               darkmagenta:[139,0,139],
+               darkolivegreen:[85,107,47],
+               darkorange:[255,140,0],
+               darkorchid:[153,50,204],
+               darkred:[139,0,0],
+               darksalmon:[233,150,122],
+               darkviolet:[148,0,211],
+               fuchsia:[255,0,255],
+               gold:[255,215,0],
+               green:[0,128,0],
+               indigo:[75,0,130],
+               khaki:[240,230,140],
+               lightblue:[173,216,230],
+               lightcyan:[224,255,255],
+               lightgreen:[144,238,144],
+               lightgrey:[211,211,211],
+               lightpink:[255,182,193],
+               lightyellow:[255,255,224],
+               lime:[0,255,0],
+               magenta:[255,0,255],
+               maroon:[128,0,0],
+               navy:[0,0,128],
+               olive:[128,128,0],
+               orange:[255,165,0],
+               pink:[255,192,203],
+               purple:[128,0,128],
+               violet:[128,0,128],
+               red:[255,0,0],
+               silver:[192,192,192],
+               white:[255,255,255],
+               yellow:[255,255,0],
+               transparent: [255,255,255]
+       },
+       /**
+        * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
+        * Converts an RGB color value to HSL. Conversion formula
+        * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
+        * Assumes r, g, and b are contained in the set [0, 255] and
+        * returns h, s, and l in the set [0, 1].
+        *
+        * @param       Number  R               The red color value
+        * @param       Number  G               The green color value
+        * @param       Number  B               The blue color value
+        * @return      Array                   The HSL representation
+        */
+       rgbToHsl: function( R, G, B ) {
+               var     r = R / 255,
+                       g = G / 255,
+                       b = B / 255;
+               var max = Math.max(r, g, b), min = Math.min(r, g, b);
+               var h, s, l = (max + min) / 2;
+
+               if(max == min){
+                       h = s = 0; // achromatic
+               }else{
+                       var d = max - min;
+                       s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
+                       switch(max){
+                               case r: h = (g - b) / d + (g < b ? 6 : 0); break;
+                               case g: h = (b - r) / d + 2; break;
+                               case b: h = (r - g) / d + 4; break;
                        }
-
-                       return [r * 255, g * 255, b * 255];
-               },
-               /**
-                * Get's a brighter or darker rgb() value string.
-                *
-                * @author Krinkle
-                *
-                * @example     getCSSColorMod( 'red', +0.1 )
-                * @example     getCSSColorMod( 'rgb(200,50,50)', -0.2 )
-                *
-                * @param       Mixed   currentColor current value in css
-                * @param       Number  mod wanted brightness modification between -1 and 1
-                * @return      String 'rgb(r,g,b)'
-                */
-               getColorBrightness: function( currentColor, mod ) {
-                       var     rgbArr = $.colorUtil.getRGB( currentColor ),
-                               hslArr = $.colorUtil.rgbToHsl(rgbArr[0], rgbArr[1], rgbArr[2] );
-                       rgbArr = $.colorUtil.hslToRgb(hslArr[0], hslArr[1], hslArr[2]+mod);
-                       return 'rgb(' +
-                               [parseInt( rgbArr[0], 10), parseInt( rgbArr[1], 10 ), parseInt( rgbArr[2], 10 )].join( ',' ) +
-                               ')';
+                       h /= 6;
                }
 
-       };
+               return [h, s, l];
+       },
+       /**
+        * http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
+        * Converts an HSL color value to RGB. Conversion formula
+        * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
+        * Assumes h, s, and l are contained in the set [0, 1] and
+        * returns r, g, and b in the set [0, 255].
+        *
+        * @param       Number  h               The hue
+        * @param       Number  s               The saturation
+        * @param       Number  l               The lightness
+        * @return      Array                   The RGB representation
+        */
+       hslToRgb: function( h, s, l ) {
+               var r, g, b;
+
+               if(s === 0){
+                       r = g = b = l; // achromatic
+               }else{
+                       var hue2rgb = function(p, q, t){
+                               if(t < 0){ t += 1; }
+                               if(t > 1){ t -= 1; }
+                               if(t < 1/6){ return p + (q - p) * 6 * t; }
+                               if(t < 1/2){ return q; }
+                               if(t < 2/3){ return p + (q - p) * (2/3 - t) * 6; }
+                               return p;
+                       };
+
+                       var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
+                       var p = 2 * l - q;
+                       r = hue2rgb(p, q, h + 1/3);
+                       g = hue2rgb(p, q, h);
+                       b = hue2rgb(p, q, h - 1/3);
+               }
 
-} )( jQuery );
\ No newline at end of file
+               return [r * 255, g * 255, b * 255];
+       },
+       /**
+        * Get's a brighter or darker rgb() value string.
+        *
+        * @author Krinkle
+        *
+        * @example     getCSSColorMod( 'red', +0.1 )
+        * @example     getCSSColorMod( 'rgb(200,50,50)', -0.2 )
+        *
+        * @param       Mixed   currentColor current value in css
+        * @param       Number  mod wanted brightness modification between -1 and 1
+        * @return      String 'rgb(r,g,b)'
+        */
+       getColorBrightness: function( currentColor, mod ) {
+               var     rgbArr = $.colorUtil.getRGB( currentColor ),
+                       hslArr = $.colorUtil.rgbToHsl(rgbArr[0], rgbArr[1], rgbArr[2] );
+               rgbArr = $.colorUtil.hslToRgb(hslArr[0], hslArr[1], hslArr[2]+mod);
+               return 'rgb(' +
+                       [parseInt( rgbArr[0], 10), parseInt( rgbArr[1], 10 ), parseInt( rgbArr[2], 10 )].join( ',' ) +
+                       ')';
+       }
+
+};
\ No newline at end of file
index d145a8a..adf948d 100644 (file)
@@ -81,7 +81,7 @@
                        if ( p == this ) { return false; }
 
                        // copy objects to be passed into t (required for event object to be passed in IE)
-                       var ev = jQuery.extend({},e);
+                       var ev = $.extend({},e);
                        var ob = this;
 
                        // cancel hoverIntent timer if it exists
index 1f65833..29f606f 100644 (file)
@@ -1,58 +1,53 @@
 /**
- * Simple Placeholder-based Localization 
- * 
+ * Simple Placeholder-based Localization
+ *
  * Call on a selection of HTML which contains <msg key="message-key" /> elements or elements with
  * title-msg="message-key" or alt-msg="message-key" attributes. <msg /> elements will be replaced
  * with localized text, elements with title-msg and alt-msg attributes will receive localized title
  * and alt attributes.
- * 
+ *
  * Example:
- * 
- *             <p class="somethingCool">
- *                     <msg key="my-message" />
- *                     <img src="something.jpg" title-msg="my-title-message" alt-msg="my-alt-message" />
- *             </p>
- * 
+ *             <p class="somethingCool">
+ *                     <msg key="my-message" />
+ *                     <img src="something.jpg" title-msg="my-title-message" alt-msg="my-alt-message" />
+ *             </p>
+ *
  * Localizes to...
- * 
- *             <p class="somethingCool">
- *                     My Message
- *                     <img src="something.jpg" title="My Title Message" alt="My Alt Message" />
- *             </p>
+ *             <p class="somethingCool">
+ *                     My Message
+ *                     <img src="something.jpg" title="My Title Message" alt="My Alt Message" />
+ *             </p>
  */
-
-( function( $, mw ) {
-       /**
-        * Localizes a DOM selection by replacing <msg /> elements with localized text and adding
-        * localized title and alt attributes to elements with title-msg and alt-msg attributes
-        * respectively.
-        * 
-        * @param Object: options Map of options
-        *      * prefix: Message prefix to use when localizing elements and attributes
-        */
-       $.fn.localize = function( options ) {
-               options = $.extend( { 'prefix': '' }, options );
-               return $(this)
-                       .find( 'msg' )
-                               .each( function() {
-                                       $(this)
-                                               .text( mediaWiki.msg( options.prefix + $(this).attr( 'key' ) ) )
-                                               .replaceWith( $(this).html() );
-                               } )
-                               .end()
-                       .find( '[title-msg]' )
-                               .each( function() {
-                                       $(this)
-                                               .attr( 'title', mw.msg( options.prefix + $(this).attr( 'title-msg' ) ) )
-                                               .removeAttr( 'title-msg' );
-                               } )
-                               .end()
-                       .find( '[alt-msg]' )
-                               .each( function() {
-                                       $(this)
-                                               .attr( 'alt', mw.msg( options.prefix + $(this).attr( 'alt-msg' ) ) )
-                                               .removeAttr( 'alt-msg' );
-                               } )
-                               .end();
-       };
-} )( jQuery, mediaWiki );
+/**
+ * Localizes a DOM selection by replacing <msg /> elements with localized text and adding
+ * localized title and alt attributes to elements with title-msg and alt-msg attributes
+ * respectively.
+ *
+ * @param Object: options Map of options
+ *  * prefix: Message prefix to use when localizing elements and attributes
+ */
+$.fn.localize = function( options ) {
+       options = $.extend( { 'prefix': '' }, options );
+       return $(this)
+               .find( 'msg' )
+                       .each( function() {
+                               $(this)
+                                       .text( mediaWiki.msg( options.prefix + $(this).attr( 'key' ) ) )
+                                       .replaceWith( $(this).html() );
+                       } )
+                       .end()
+               .find( '[title-msg]' )
+                       .each( function() {
+                               $(this)
+                                       .attr( 'title', mw.msg( options.prefix + $(this).attr( 'title-msg' ) ) )
+                                       .removeAttr( 'title-msg' );
+                       } )
+                       .end()
+               .find( '[alt-msg]' )
+                       .each( function() {
+                               $(this)
+                                       .attr( 'alt', mw.msg( options.prefix + $(this).attr( 'alt-msg' ) ) )
+                                       .removeAttr( 'alt-msg' );
+                       } )
+                       .end();
+};
\ No newline at end of file
index 988a09d..8daa462 100644 (file)
@@ -9,7 +9,7 @@
  * @license GPL v2
  */
 
-jQuery.fn.placeholder = function() {
+$.fn.placeholder = function() {
 
        return this.each( function() {
 
@@ -19,7 +19,7 @@ jQuery.fn.placeholder = function() {
                }
 
                var placeholder = this.getAttribute('placeholder');
-               var $input = jQuery(this);
+               var $input = $(this);
 
                // Show initially, if empty
                if ( this.value === '' || this.value == placeholder ) {
index 9fc8a47..8dbd77a 100644 (file)
@@ -41,7 +41,6 @@
  * highlightInput: Whether to hightlight matched portions of the input or not
  *             Type: Boolean, Default: false
  */
-( function( $ ) {
 
 $.suggestions = {
        /**
@@ -516,6 +515,4 @@ $.fn.suggestions = function() {
                $(this).data( 'suggestions-context', context );
        } );
        return returnValue !== null ? returnValue : $(this);
-};
-
-} )( jQuery );
+};
\ No newline at end of file
index 3a33dfb..3ae1a5c 100644 (file)
@@ -1,27 +1,28 @@
 /**
  * Finds the lowerst tabindex in use within a selection
  * 
- * @return Integer of lowest tabindex on the page
+ * @return number Lowest tabindex on the page
  */
-jQuery.fn.firstTabIndex = function() {
+$.fn.firstTabIndex = function() {
        var minTabIndex = 0;
-       jQuery(this).find( '[tabindex]' ).each( function() {
-               var tabIndex = parseInt( jQuery(this).attr( 'tabindex' ) );
+       $(this).find( '[tabindex]' ).each( function() {
+               var tabIndex = parseInt( $(this).attr( 'tabindex' ) );
                if ( tabIndex > minTabIndex ) {
                        minTabIndex = tabIndex;
                }
        } );
        return minTabIndex;
 };
+
 /**
  * Finds the highest tabindex in use within a selection
  * 
- * @return Integer of highest tabindex on the page
+ * @return number Highest tabindex on the page
  */
-jQuery.fn.lastTabIndex = function() {
+$.fn.lastTabIndex = function() {
        var maxTabIndex = 0;
-       jQuery(this).find( '[tabindex]' ).each( function() {
-               var tabIndex = parseInt( jQuery(this).attr( 'tabindex' ) );
+       $(this).find( '[tabindex]' ).each( function() {
+               var tabIndex = parseInt( $(this).attr( 'tabindex' ) );
                if ( tabIndex > maxTabIndex ) {
                        maxTabIndex = tabIndex;
                }
index e21768e..1f2a1dd 100644 (file)
@@ -1,7 +1,6 @@
 /**
  * These plugins provide extra functionality for interaction with textareas.
  */
-( function( $ ) {
 $.fn.textSelection = function( command, options ) {
 var fn = {
 /**
@@ -399,6 +398,4 @@ scrollToCaretPosition: function( options ) {
                context.fn.saveSelection();
        }
        return retval;
-};
-
-} )( jQuery );
+};
\ No newline at end of file
index 9f07b2f..4722dbd 100644 (file)
@@ -4,18 +4,18 @@
 
 table.mw-enhanced-rc {
        background: none;
-       border:0;
-       border-spacing:0;
+       border: 0;
+       border-spacing: 0;
 }
 
 table.mw-enhanced-rc th, table.mw-enhanced-rc td {
-       padding:0;
-       vertical-align:top;
+       padding: 0;
+       vertical-align: top;
 }
 
 td.mw-enhanced-rc {
-       white-space:nowrap;
-       font-family:monospace;
+       white-space: nowrap;
+       font-family: monospace;
 }
 
 .mw-enhanced-rc-time {
@@ -32,7 +32,7 @@ table.mw-enhanced-rc td.mw-enhanced-rc-nested {
 }
 
 /* If JS is disabled, the arrow is still needed
-   for spacing, but ideally shouldn't be shown    */
+   for spacing, but ideally shouldn't be shown */
 .mw-enhanced-rc .mw-rc-openarrow {
        visibility: hidden;
 }