Index: trunk/extensions/UploadWizard/resources/language/mw.Language.js |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | for ( var i in msgSet ) { |
35 | 35 | messageCache[ i ] = msgSet[i]; |
36 | 36 | } |
37 | | - } |
| 37 | + }; |
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Returns a transformed msg string |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | } |
81 | 81 | } |
82 | 82 | // Fast check message text return ( no arguments and no parsing needed ) |
83 | | - if( ( !args || args.length == 0 ) |
| 83 | + if( ( !args || args.length === 0 ) |
84 | 84 | && messageCache[ messageKey ].indexOf( '{{' ) === -1 |
85 | 85 | && messageCache[ messageKey ].indexOf( '[' ) === -1 |
86 | 86 | ) { |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | |
93 | 93 | // Return the jQuery object or message string |
94 | 94 | return messageSwap.getMsg(); |
95 | | - } |
| 95 | + }; |
96 | 96 | |
97 | 97 | /** |
98 | 98 | * A message Swap Object |
— | — | @@ -103,16 +103,14 @@ |
104 | 104 | |
105 | 105 | mw.Language.messageSwapObject = function( message, arguments ){ |
106 | 106 | this.init( message, arguments ); |
107 | | - } |
| 107 | + }; |
108 | 108 | |
109 | 109 | mw.Language.messageSwapObject.prototype= { |
110 | 110 | /* constructor */ |
111 | 111 | init: function( message, arguments ){ |
112 | 112 | this.message = message; |
113 | 113 | this.arguments = arguments; |
114 | | - |
115 | | - // Set the includesjQueryArgs flag to false |
116 | | - includesjQueryArgs: false; |
| 114 | + this.includesjQueryArgs = false; |
117 | 115 | }, |
118 | 116 | |
119 | 117 | // Return the transformed message text or jQuery object |
— | — | @@ -126,7 +124,7 @@ |
127 | 125 | && ! this.includesjQueryArgs ) |
128 | 126 | { |
129 | 127 | // replaceStringArgs is all we need, return the msg |
130 | | - return this.message |
| 128 | + return this.message; |
131 | 129 | } |
132 | 130 | |
133 | 131 | // Else Send the messageText through the parser |
— | — | @@ -165,12 +163,12 @@ |
166 | 164 | var replaceValue = this.arguments[ v ]; |
167 | 165 | |
168 | 166 | // Convert number if applicable |
169 | | - if( parseInt( replaceValue ) == replaceValue ) { |
| 167 | + if( parseInt( replaceValue, 10 ) == replaceValue ) { |
170 | 168 | replaceValue = mw.Language.convertNumber( replaceValue ); |
171 | 169 | } |
172 | 170 | |
173 | 171 | // Message test replace arguments start at 1 instead of zero: |
174 | | - var argumentRegExp = new RegExp( '\\$' + ( parseInt( v ) + 1 ), 'g' ); |
| 172 | + var argumentRegExp = new RegExp( '\\$' + ( parseInt( v, 10 ) + 1 ), 'g' ); |
175 | 173 | |
176 | 174 | // Check if we got passed in a jQuery object: |
177 | 175 | if( replaceValue instanceof jQuery) { |
— | — | @@ -215,7 +213,7 @@ |
216 | 214 | continue; |
217 | 215 | } |
218 | 216 | |
219 | | - if( $swapTarget.html() != '' ) { |
| 217 | + if( $swapTarget.html() !== '' ) { |
220 | 218 | $replaceValue.html( $swapTarget.html() ); |
221 | 219 | } |
222 | 220 | |
— | — | @@ -226,7 +224,7 @@ |
227 | 225 | // Return the jQuery object ( if no jQuery substitution occurred we return false ) |
228 | 226 | return $jQueryMessage; |
229 | 227 | } |
230 | | - } |
| 228 | + }; |
231 | 229 | |
232 | 230 | /** |
233 | 231 | * Get msg content without transformation |
— | — | @@ -234,12 +232,12 @@ |
235 | 233 | * @returns string The msg key without transforming it |
236 | 234 | */ |
237 | 235 | mw.Language.msgNoTrans = function( key ) { |
238 | | - if ( messageCache[ key ] ) |
239 | | - return messageCache[ key ] |
240 | | - |
| 236 | + if ( messageCache[ key ] ) { |
| 237 | + return messageCache[ key ]; |
| 238 | + } |
241 | 239 | // Missing key placeholder |
242 | 240 | return '<' + key + '>'; |
243 | | - } |
| 241 | + }; |
244 | 242 | |
245 | 243 | /** |
246 | 244 | * Add Supported Magic Words to parser |
— | — | @@ -251,12 +249,12 @@ |
252 | 250 | mw.addTemplateTransform ( { |
253 | 251 | 'PLURAL' : mw.Language.procPLURAL, |
254 | 252 | 'GENDER' : mw.Language.procGENDER |
255 | | - } ) |
| 253 | + } ); |
256 | 254 | |
257 | 255 | mw.Language.doneSetup = true; |
258 | 256 | } |
259 | 257 | |
260 | | - } |
| 258 | + }; |
261 | 259 | |
262 | 260 | /** |
263 | 261 | * List of all languages mediaWiki supports ( Avoid an api call to get this same info ) |
— | — | @@ -668,14 +666,14 @@ |
669 | 667 | |
670 | 668 | if( templateObject.arg && templateObject.param && mw.Language.convertPlural) { |
671 | 669 | // Check if we have forms to replace |
672 | | - if ( templateObject.param.length == 0 ) { |
| 670 | + if ( templateObject.param.length === 0 ) { |
673 | 671 | return ''; |
674 | 672 | } |
675 | 673 | // Restore the count into a Number ( if it got converted earlier ) |
676 | 674 | var count = mw.Language.convertNumber( templateObject.arg, true ); |
677 | 675 | |
678 | 676 | // Do convertPlural call |
679 | | - return mw.Language.convertPlural( parseInt( count ), templateObject.param ); |
| 677 | + return mw.Language.convertPlural( parseInt( count, 10 ), templateObject.param ); |
680 | 678 | |
681 | 679 | } |
682 | 680 | // Could not process plural return first form or nothing |
— | — | @@ -688,15 +686,15 @@ |
689 | 687 | // NOTE:: add gender support here |
690 | 688 | mw.Language.procGENDER = function( templateObject ){ |
691 | 689 | return 'gender-not-supported-in-js-yet'; |
692 | | - } |
| 690 | + }; |
693 | 691 | /* |
694 | 692 | * Base convertPlural function: |
695 | 693 | */ |
696 | 694 | mw.Language.convertPlural = function( count, forms ){ |
697 | | - if ( !forms || forms.length == 0 ) { |
| 695 | + if ( !forms || forms.length === 0 ) { |
698 | 696 | return ''; |
699 | 697 | } |
700 | | - return ( parseInt( count ) == 1 ) ? forms[0] : forms[1]; |
| 698 | + return ( parseInt( count, 10 ) === 1 ) ? forms[0] : forms[1]; |
701 | 699 | }; |
702 | 700 | /** |
703 | 701 | * Checks that convertPlural was given an array and pads it to requested |
— | — | @@ -732,7 +730,7 @@ |
733 | 731 | |
734 | 732 | // Check if the "restore" to latin number flag is set: |
735 | 733 | if( typeInt ) { |
736 | | - if( parseInt( number ) == number ) |
| 734 | + if( parseInt( number, 10 ) === number ) |
737 | 735 | return number; |
738 | 736 | var tmp = []; |
739 | 737 | for( var i in transformTable ) { |
— | — | @@ -743,15 +741,15 @@ |
744 | 742 | |
745 | 743 | var numberString = '' + number; |
746 | 744 | var convertedNumber = ''; |
747 | | - for( var i =0; i < numberString.length; i++) { |
| 745 | + for( var i = 0; i < numberString.length; i++) { |
748 | 746 | if( transformTable[ numberString[i] ] ) { |
749 | 747 | convertedNumber += transformTable[ numberString[i] ]; |
750 | | - }else{ |
| 748 | + } else { |
751 | 749 | convertedNumber += numberString[i]; |
752 | 750 | } |
753 | 751 | } |
754 | | - return ( typeInt )? parseInt( convertedNumber) : convertedNumber; |
755 | | - } |
| 752 | + return ( typeInt ) ? parseInt( convertedNumber, 10 ) : convertedNumber; |
| 753 | + }; |
756 | 754 | |
757 | 755 | /** |
758 | 756 | * Checks if a language key is valid ( is part of languageCodeList ) |
— | — | @@ -760,7 +758,7 @@ |
761 | 759 | */ |
762 | 760 | mw.isValidLang = function( langKey ) { |
763 | 761 | return ( mw.Language.names[ langKey ] )? true : false; |
764 | | - } |
| 762 | + }; |
765 | 763 | |
766 | 764 | /** |
767 | 765 | * Format a number |
— | — | @@ -790,7 +788,7 @@ |
791 | 789 | } |
792 | 790 | // @@todo read language code and give periods or comas: |
793 | 791 | return addSeparatorsNF( num, '.', ',' ); |
794 | | - } |
| 792 | + }; |
795 | 793 | |
796 | 794 | }) ( window.mediaWiki ); |
797 | 795 | |