Index: trunk/phase3/skins/common/mwsuggest.js |
— | — | @@ -24,8 +24,8 @@ |
25 | 25 | // delay between keypress and suggestion (in ms) |
26 | 26 | var os_search_timeout = 250; |
27 | 27 | // these pairs of inputs/forms will be autoloaded at startup |
28 | | -var os_autoload_inputs = new Array('searchInput', 'searchInput2', 'powerSearchText', 'searchText'); |
29 | | -var os_autoload_forms = new Array('searchform', 'searchform2', 'powersearch', 'search' ); |
| 28 | +var os_autoload_inputs = ['searchInput', 'searchInput2', 'powerSearchText', 'searchText']; |
| 29 | +var os_autoload_forms = ['searchform', 'searchform2', 'powersearch', 'search']; |
30 | 30 | // if we stopped the service |
31 | 31 | var os_is_stopped = false; |
32 | 32 | // max lines to show in suggest table |
— | — | @@ -364,7 +364,7 @@ |
365 | 365 | var c = document.getElementById(r.container); |
366 | 366 | var width = c.offsetWidth - os_operaWidthFix(c.offsetWidth); |
367 | 367 | var html = "<table class=\"os-suggest-results\" id=\""+r.resultTable+"\" style=\"width: "+width+"px;\">"; |
368 | | - r.results = new Array(); |
| 368 | + r.results = []; |
369 | 369 | r.resultCount = results.length; |
370 | 370 | for(i=0;i<results.length;i++){ |
371 | 371 | var title = os_decodeValue(results[i]); |
Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -181,23 +181,14 @@ |
182 | 182 | var mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js |
183 | 183 | |
184 | 184 | function escapeQuotes(text) { |
185 | | - var re = new RegExp("'","g"); |
186 | | - text = text.replace(re,"\\'"); |
187 | | - re = new RegExp("\\n","g"); |
188 | | - text = text.replace(re,"\\n"); |
189 | | - return escapeQuotesHTML(text); |
| 185 | + return escapeQuotesHTML(text.replace(/'/g,"\\'").replace(/\n/g,"\\n")); |
190 | 186 | } |
191 | 187 | |
192 | 188 | function escapeQuotesHTML(text) { |
193 | | - var re = new RegExp('&',"g"); |
194 | | - text = text.replace(re,"&"); |
195 | | - re = new RegExp('"',"g"); |
196 | | - text = text.replace(re,"""); |
197 | | - re = new RegExp('<',"g"); |
198 | | - text = text.replace(re,"<"); |
199 | | - re = new RegExp('>',"g"); |
200 | | - text = text.replace(re,">"); |
201 | | - return text; |
| 189 | + return text.replace(/&/g,"&") |
| 190 | + .replace(/"/g,""") |
| 191 | + .replace(/</gre,"<") |
| 192 | + .replace(/>/g,">"); |
202 | 193 | } |
203 | 194 | |
204 | 195 | |
— | — | @@ -308,7 +299,7 @@ |
309 | 300 | link.setAttribute( "title", tooltip ); |
310 | 301 | } |
311 | 302 | if ( accesskey && tooltip ) { |
312 | | - updateTooltipAccessKeys( new Array( link ) ); |
| 303 | + updateTooltipAccessKeys( [link] ); |
313 | 304 | } |
314 | 305 | |
315 | 306 | if ( nextnode && nextnode.parentNode == node ) |
— | — | @@ -354,7 +345,7 @@ |
355 | 346 | // A lot of user scripts (and some of the code below) break if |
356 | 347 | // ta isn't defined, so we make sure it is. Explictly using |
357 | 348 | // window.ta avoids a "ta is not defined" error. |
358 | | - if (!window.ta) window.ta = new Array; |
| 349 | + if (!window.ta) window.ta = []; |
359 | 350 | |
360 | 351 | // Make a local, possibly restricted, copy to avoid clobbering |
361 | 352 | // the original. |
— | — | @@ -367,7 +358,7 @@ |
368 | 359 | |
369 | 360 | // Now deal with evil deprecated ta |
370 | 361 | var watchCheckboxExists = document.getElementById( 'wpWatchthis' ) ? true : false; |
371 | | - for (var id in ta) { |
| 362 | + for (var id = 0; id < ta.length; id++) { |
372 | 363 | var n = document.getElementById(id); |
373 | 364 | if (n) { |
374 | 365 | var a = null; |
— | — | @@ -498,7 +489,7 @@ |
499 | 490 | From http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/ |
500 | 491 | */ |
501 | 492 | function getElementsByClassName(oElm, strTagName, oClassNames){ |
502 | | - var arrReturnElements = new Array(); |
| 493 | + var arrReturnElements = []; |
503 | 494 | if ( typeof( oElm.getElementsByClassName ) == "function" ) { |
504 | 495 | /* Use a native implementation where possible FF3, Saf3.2, Opera 9.5 */ |
505 | 496 | var arrNativeReturn = oElm.getElementsByClassName( oClassNames ); |
— | — | @@ -511,7 +502,7 @@ |
512 | 503 | return arrReturnElements; |
513 | 504 | } |
514 | 505 | var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName); |
515 | | - var arrRegExpClassNames = new Array(); |
| 506 | + var arrRegExpClassNames = []; |
516 | 507 | if(typeof oClassNames == "object"){ |
517 | 508 | for(var i=0; i<oClassNames.length; i++){ |
518 | 509 | arrRegExpClassNames[arrRegExpClassNames.length] = |
— | — | @@ -680,8 +671,8 @@ |
681 | 672 | |
682 | 673 | var reverse = (span.getAttribute("sortdir") == 'down'); |
683 | 674 | |
684 | | - var newRows = new Array(); |
685 | | - var staticRows = new Array(); |
| 675 | + var newRows = new []; |
| 676 | + var staticRows = new []; |
686 | 677 | for (var j = rowStart; j < table.rows.length; j++) { |
687 | 678 | var row = table.rows[j]; |
688 | 679 | if((" "+row.className+" ").indexOf(" unsortable ") < 0) { |
— | — | @@ -689,8 +680,8 @@ |
690 | 681 | var oldIndex = (reverse ? -j : j); |
691 | 682 | var preprocessed = preprocessor( keyText.replace(/^[\s\xa0]+/, "").replace(/[\s\xa0]+$/, "") ); |
692 | 683 | |
693 | | - newRows[newRows.length] = new Array(row, preprocessed, oldIndex); |
694 | | - } else staticRows[staticRows.length] = new Array(row, false, j-rowStart); |
| 684 | + newRows[newRows.length] = new [row, preprocessed, oldIndex]; |
| 685 | + } else staticRows[staticRows.length] = [row, false, j-rowStart]; |
695 | 686 | } |
696 | 687 | |
697 | 688 | newRows.sort(sortfn); |
Index: trunk/phase3/skins/common/protect.js |
— | — | @@ -250,7 +250,7 @@ |
251 | 251 | */ |
252 | 252 | 'getLevelSelectors': function() { |
253 | 253 | var all = document.getElementsByTagName("select"); |
254 | | - var ours = new Array(); |
| 254 | + var ours = []; |
255 | 255 | for (var i = 0; i < all.length; i++) { |
256 | 256 | var element = all[i]; |
257 | 257 | if (element.id.match(/^mwProtect-level-/)) { |
— | — | @@ -279,7 +279,7 @@ |
280 | 280 | */ |
281 | 281 | 'getExpiryInputs': function() { |
282 | 282 | var all = document.getElementsByTagName("input"); |
283 | | - var ours = new Array(); |
| 283 | + var ours = []; |
284 | 284 | for (var i = 0; i < all.length; i++) { |
285 | 285 | var element = all[i]; |
286 | 286 | if (element.name.match(/^mwProtect-expiry-/)) { |
— | — | @@ -307,7 +307,7 @@ |
308 | 308 | */ |
309 | 309 | 'getExpirySelectors': function() { |
310 | 310 | var all = document.getElementsByTagName("select"); |
311 | | - var ours = new Array(); |
| 311 | + var ours = []; |
312 | 312 | for (var i = 0; i < all.length; i++) { |
313 | 313 | var element = all[i]; |
314 | 314 | if (element.id.match(/^mwProtectExpirySelection-/)) { |