Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -5,18 +5,18 @@ |
6 | 6 | !/khtml|spoofer|netscape\/7\.0/.test(clientPC); |
7 | 7 | var webkit_match = clientPC.match(/applewebkit\/(\d+)/); |
8 | 8 | if (webkit_match) { |
9 | | - var is_safari = clientPC.indexOf('applewebkit') != -1 && |
10 | | - clientPC.indexOf('spoofer') == -1; |
11 | | - var is_safari_win = is_safari && clientPC.indexOf('windows') != -1; |
| 9 | + var is_safari = clientPC.indexOf('applewebkit') !== -1 && |
| 10 | + clientPC.indexOf('spoofer') === -1; |
| 11 | + var is_safari_win = is_safari && clientPC.indexOf('windows') !== -1; |
12 | 12 | var webkit_version = parseInt(webkit_match[1]); |
13 | 13 | } |
14 | 14 | // For accesskeys; note that FF3+ is included here! |
15 | 15 | var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC ); |
16 | 16 | var ff2_bugs = /firefox\/2/.test( clientPC ); |
17 | 17 | // These aren't used here, but some custom scripts rely on them |
18 | | -var is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1; |
19 | | -var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1; |
20 | | -if (clientPC.indexOf('opera') != -1) { |
| 18 | +var is_ff2_win = is_ff2 && clientPC.indexOf('windows') !== -1; |
| 19 | +var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') !== -1; |
| 20 | +if (clientPC.indexOf('opera') !== -1) { |
21 | 21 | var is_opera = true; |
22 | 22 | var is_opera_preseven = window.opera && !document.childNodes; |
23 | 23 | var is_opera_seven = window.opera && document.childNodes; |
— | — | @@ -28,11 +28,7 @@ |
29 | 29 | // As recommended by <http://msdn.microsoft.com/en-us/library/ms537509.aspx>, |
30 | 30 | // avoiding false positives from moronic extensions that append to the IE UA |
31 | 31 | // string (bug 23171) |
32 | | -var ie6_bugs = false; |
33 | | -if ( /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec( clientPC ) != null |
34 | | -&& parseFloat( RegExp.$1 ) <= 6.0 ) { |
35 | | - ie6_bugs = true; |
36 | | -} |
| 32 | +var ie6_bugs = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec( clientPC ) && parseFloat( RegExp.$1 ) <= 6.0 ); |
37 | 33 | |
38 | 34 | // Global external objects used by this script. |
39 | 35 | /*extern ta, stylepath, skin */ |
— | — | @@ -68,7 +64,7 @@ |
69 | 65 | var loadedScripts = {}; // included-scripts tracker |
70 | 66 | function importScriptURI( url ) { |
71 | 67 | if ( loadedScripts[url] ) { |
72 | | - return null; |
| 68 | + return; |
73 | 69 | } |
74 | 70 | loadedScripts[url] = true; |
75 | 71 | var s = document.createElement( 'script' ); |
— | — | @@ -108,7 +104,7 @@ |
109 | 105 | } |
110 | 106 | |
111 | 107 | // Special stylesheet links for Monobook only (see bug 14717) |
112 | | -if ( typeof stylepath != 'undefined' && skin == 'monobook' ) { |
| 108 | +if ( typeof stylepath !== 'undefined' && skin === 'monobook' ) { |
113 | 109 | if ( opera6_bugs ) { |
114 | 110 | importStylesheetURI( stylepath + '/' + skin + '/Opera6Fixes.css' ); |
115 | 111 | } else if ( opera7_bugs ) { |
— | — | @@ -158,7 +154,7 @@ |
159 | 155 | linkHolder.appendChild( outerSpan ); |
160 | 156 | |
161 | 157 | var cookiePos = document.cookie.indexOf( "hidetoc=" ); |
162 | | - if ( cookiePos > -1 && document.cookie.charAt( cookiePos + 8 ) == 1 ) { |
| 158 | + if ( cookiePos > -1 && document.cookie.charAt( cookiePos + 8 ) === 1 ) { |
163 | 159 | toggleToc(); |
164 | 160 | } |
165 | 161 | } |
— | — | @@ -175,7 +171,7 @@ |
176 | 172 | |
177 | 173 | function killEvt( evt ) { |
178 | 174 | evt = evt || window.event || window.Event; // W3C, IE, Netscape |
179 | | - if ( typeof ( evt.preventDefault ) != 'undefined' ) { |
| 175 | + if ( typeof ( evt.preventDefault ) !== 'undefined' ) { |
180 | 176 | evt.preventDefault(); // Don't follow the link |
181 | 177 | evt.stopPropagation(); |
182 | 178 | } else { |
— | — | @@ -189,7 +185,7 @@ |
190 | 186 | var toc = document.getElementById('toc').getElementsByTagName('ul')[0]; |
191 | 187 | var toggleLink = document.getElementById( 'togglelink' ); |
192 | 188 | |
193 | | - if ( toc && toggleLink && toc.style.display == 'none' ) { |
| 189 | + if ( toc && toggleLink && toc.style.display === 'none' ) { |
194 | 190 | changeText( toggleLink, tocHideText ); |
195 | 191 | toc.style.display = 'block'; |
196 | 192 | document.cookie = "hidetoc=0"; |
— | — | @@ -235,8 +231,8 @@ |
236 | 232 | } else if ( !is_safari_win && is_safari && webkit_version > 526 ) { |
237 | 233 | tooltipAccessKeyPrefix = 'ctrl-alt-'; |
238 | 234 | } else if ( !is_safari_win && ( is_safari |
239 | | - || clientPC.indexOf('mac') != -1 |
240 | | - || clientPC.indexOf('konqueror') != -1 ) ) { |
| 235 | + || clientPC.indexOf('mac') !== -1 |
| 236 | + || clientPC.indexOf('konqueror') !== -1 ) ) { |
241 | 237 | tooltipAccessKeyPrefix = 'ctrl-'; |
242 | 238 | } else if ( is_ff2 ) { |
243 | 239 | tooltipAccessKeyPrefix = 'alt-shift-'; |
— | — | @@ -314,11 +310,11 @@ |
315 | 311 | function addPortletLink( portlet, href, text, id, tooltip, accesskey, nextnode ) { |
316 | 312 | var root = document.getElementById( portlet ); |
317 | 313 | if ( !root ) { |
318 | | - return null; |
| 314 | + return; |
319 | 315 | } |
320 | 316 | var node = root.getElementsByTagName( 'ul' )[0]; |
321 | 317 | if ( !node ) { |
322 | | - return null; |
| 318 | + return; |
323 | 319 | } |
324 | 320 | |
325 | 321 | // unhide portlet if it was hidden before |
— | — | @@ -348,7 +344,7 @@ |
349 | 345 | updateTooltipAccessKeys( new Array( link ) ); |
350 | 346 | } |
351 | 347 | |
352 | | - if ( nextnode && nextnode.parentNode == node ) { |
| 348 | + if ( nextnode && nextnode.parentNode === node ) { |
353 | 349 | node.insertBefore( item, nextnode ); |
354 | 350 | } else { |
355 | 351 | node.appendChild( item ); // IE compatibility (?) |
— | — | @@ -358,10 +354,10 @@ |
359 | 355 | } |
360 | 356 | |
361 | 357 | function getInnerText( el ) { |
362 | | - if ( typeof el == 'string' ) { |
| 358 | + if ( typeof el === 'string' ) { |
363 | 359 | return el; |
364 | 360 | } |
365 | | - if ( typeof el == 'undefined' ) { |
| 361 | + if ( typeof el === 'undefined' ) { |
366 | 362 | return el; |
367 | 363 | } |
368 | 364 | if ( el.textContent ) { |
— | — | @@ -397,7 +393,7 @@ |
398 | 394 | |
399 | 395 | function setupCheckboxShiftClick() { |
400 | 396 | checkboxes = []; |
401 | | - lastCheckbox = null; |
| 397 | + lastCheckbox = undefined; |
402 | 398 | var inputs = document.getElementsByTagName( 'input' ); |
403 | 399 | addCheckboxClickHandlers( inputs ); |
404 | 400 | } |
— | — | @@ -414,7 +410,7 @@ |
415 | 411 | |
416 | 412 | for ( var i = start; i < finish; i++ ) { |
417 | 413 | var cb = inputs[i]; |
418 | | - if ( !cb.type || cb.type.toLowerCase() != 'checkbox' ) { |
| 414 | + if ( !cb.type || cb.type.toLowerCase() !== 'checkbox' ) { |
419 | 415 | continue; |
420 | 416 | } |
421 | 417 | var end = checkboxes.length; |
— | — | @@ -431,10 +427,10 @@ |
432 | 428 | } |
433 | 429 | |
434 | 430 | function checkboxClickHandler( e ) { |
435 | | - if ( typeof e == 'undefined' ) { |
| 431 | + if ( typeof e === 'undefined' ) { |
436 | 432 | e = window.event; |
437 | 433 | } |
438 | | - if ( !e.shiftKey || lastCheckbox === null ) { |
| 434 | + if ( !e.shiftKey || lastCheckbox === undefined ) { |
439 | 435 | lastCheckbox = this.index; |
440 | 436 | return true; |
441 | 437 | } |
— | — | @@ -449,7 +445,7 @@ |
450 | 446 | } |
451 | 447 | for ( var i = start; i <= finish; ++i ) { |
452 | 448 | checkboxes[i].checked = endState; |
453 | | - if( i > start && typeof checkboxes[i].onchange == 'function' ) { |
| 449 | + if( i > start && typeof checkboxes[i].onchange === 'function' ) { |
454 | 450 | checkboxes[i].onchange(); // fire triggers |
455 | 451 | } |
456 | 452 | } |
— | — | @@ -466,22 +462,22 @@ |
467 | 463 | */ |
468 | 464 | function getElementsByClassName( oElm, strTagName, oClassNames ) { |
469 | 465 | var arrReturnElements = new Array(); |
470 | | - if ( typeof( oElm.getElementsByClassName ) == 'function' ) { |
| 466 | + if ( typeof( oElm.getElementsByClassName ) === 'function' ) { |
471 | 467 | /* Use a native implementation where possible FF3, Saf3.2, Opera 9.5 */ |
472 | 468 | var arrNativeReturn = oElm.getElementsByClassName( oClassNames ); |
473 | | - if ( strTagName == '*' ) { |
| 469 | + if ( strTagName === '*' ) { |
474 | 470 | return arrNativeReturn; |
475 | 471 | } |
476 | 472 | for ( var h = 0; h < arrNativeReturn.length; h++ ) { |
477 | | - if( arrNativeReturn[h].tagName.toLowerCase() == strTagName.toLowerCase() ) { |
| 473 | + if( arrNativeReturn[h].tagName.toLowerCase() === strTagName.toLowerCase() ) { |
478 | 474 | arrReturnElements[arrReturnElements.length] = arrNativeReturn[h]; |
479 | 475 | } |
480 | 476 | } |
481 | 477 | return arrReturnElements; |
482 | 478 | } |
483 | | - var arrElements = ( strTagName == '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName ); |
| 479 | + var arrElements = ( strTagName === '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName ); |
484 | 480 | var arrRegExpClassNames = new Array(); |
485 | | - if( typeof oClassNames == 'object' ) { |
| 481 | + if( typeof oClassNames === 'object' ) { |
486 | 482 | for( var i = 0; i < oClassNames.length; i++ ) { |
487 | 483 | arrRegExpClassNames[arrRegExpClassNames.length] = |
488 | 484 | new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"); |
— | — | @@ -518,7 +514,7 @@ |
519 | 515 | return; |
520 | 516 | } |
521 | 517 | } |
522 | | - if ( window.location.hash == '' ) { |
| 518 | + if ( window.location.hash === '' ) { |
523 | 519 | window.location.hash = fragment; |
524 | 520 | |
525 | 521 | // Mozilla needs to wait until after load, otherwise the window doesn't |
— | — | @@ -529,7 +525,7 @@ |
530 | 526 | // well. |
531 | 527 | if ( is_gecko ) { |
532 | 528 | addOnloadHook(function() { |
533 | | - if ( window.location.hash == fragment ) { |
| 529 | + if ( window.location.hash === fragment ) { |
534 | 530 | window.location.hash = fragment; |
535 | 531 | } |
536 | 532 | }); |
— | — | @@ -552,10 +548,10 @@ |
553 | 549 | var ts_image_up = 'sort_up.gif'; |
554 | 550 | var ts_image_down = 'sort_down.gif'; |
555 | 551 | var ts_image_none = 'sort_none.gif'; |
556 | | -var ts_europeandate = wgContentLanguage != 'en'; // The non-American-inclined can change to "true" |
| 552 | +var ts_europeandate = wgContentLanguage !== 'en'; // The non-American-inclined can change to "true" |
557 | 553 | var ts_alternate_row_colors = false; |
558 | | -var ts_number_transform_table = null; |
559 | | -var ts_number_regex = null; |
| 554 | +var ts_number_transform_table; |
| 555 | +var ts_number_regex; |
560 | 556 | |
561 | 557 | function sortables_init() { |
562 | 558 | var idnum = 0; |
— | — | @@ -586,7 +582,7 @@ |
587 | 583 | // We have a first row: assume it's the header, and make its contents clickable links |
588 | 584 | for ( var i = 0; i < firstRow.cells.length; i++ ) { |
589 | 585 | var cell = firstRow.cells[i]; |
590 | | - if ( (' ' + cell.className + ' ').indexOf(' unsortable ') == -1 ) { |
| 586 | + if ( (' ' + cell.className + ' ').indexOf(' unsortable ') === -1 ) { |
591 | 587 | cell.innerHTML += '<a href="#" class="sortheader" ' |
592 | 588 | + 'onclick="ts_resortTable(this);return false;">' |
593 | 589 | + '<span class="sortarrow">' |
— | — | @@ -614,7 +610,7 @@ |
615 | 611 | var column = td.cellIndex; |
616 | 612 | |
617 | 613 | var table = tr.parentNode; |
618 | | - while ( table && !( table.tagName && table.tagName.toLowerCase() == 'table' ) ) { |
| 614 | + while ( table && !( table.tagName && table.tagName.toLowerCase() === 'table' ) ) { |
619 | 615 | table = table.parentNode; |
620 | 616 | } |
621 | 617 | if ( !table ) { |
— | — | @@ -626,7 +622,7 @@ |
627 | 623 | } |
628 | 624 | |
629 | 625 | // Generate the number transform table if it's not done already |
630 | | - if ( ts_number_transform_table === null ) { |
| 626 | + if ( ts_number_transform_table === undefined ) { |
631 | 627 | ts_initTransformTable(); |
632 | 628 | } |
633 | 629 | |
— | — | @@ -634,7 +630,7 @@ |
635 | 631 | // Skip the first row if that's where the headings are |
636 | 632 | var rowStart = ( table.tHead && table.tHead.rows.length > 0 ? 0 : 1 ); |
637 | 633 | var bodyRows = 0; |
638 | | - if (rowStart == 0 && table.tBodies) { |
| 634 | + if (rowStart === 0 && table.tBodies) { |
639 | 635 | for (var i=0; i < table.tBodies.length; i++ ) { |
640 | 636 | bodyRows += table.tBodies[i].rows.length; |
641 | 637 | } |
— | — | @@ -647,7 +643,7 @@ |
648 | 644 | if ( table.rows[i].cells.length > column ) { |
649 | 645 | itm = ts_getInnerText(table.rows[i].cells[column]); |
650 | 646 | itm = itm.replace(/^[\s\xa0]+/, '').replace(/[\s\xa0]+$/, ''); |
651 | | - if ( itm != '' ) { |
| 647 | + if ( itm !== '' ) { |
652 | 648 | break; |
653 | 649 | } |
654 | 650 | } |
— | — | @@ -669,7 +665,7 @@ |
670 | 666 | preprocessor = ts_parseFloat; |
671 | 667 | } |
672 | 668 | |
673 | | - var reverse = ( span.getAttribute( 'sortdir' ) == 'down' ); |
| 669 | + var reverse = ( span.getAttribute( 'sortdir' ) === 'down' ); |
674 | 670 | |
675 | 671 | var newRows = new Array(); |
676 | 672 | var staticRows = new Array(); |
— | — | @@ -709,13 +705,13 @@ |
710 | 706 | // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones |
711 | 707 | // don't do sortbottom rows |
712 | 708 | for ( var i = 0; i < newRows.length; i++ ) { |
713 | | - if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') == -1 ) { |
| 709 | + if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') === -1 ) { |
714 | 710 | table.tBodies[0].appendChild( newRows[i][0] ); |
715 | 711 | } |
716 | 712 | } |
717 | 713 | // do sortbottom rows only |
718 | 714 | for ( var i = 0; i < newRows.length; i++ ) { |
719 | | - if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') != -1 ) { |
| 715 | + if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') !== -1 ) { |
720 | 716 | table.tBodies[0].appendChild( newRows[i][0] ); |
721 | 717 | } |
722 | 718 | } |
— | — | @@ -733,8 +729,8 @@ |
734 | 730 | } |
735 | 731 | |
736 | 732 | function ts_initTransformTable() { |
737 | | - if ( typeof wgSeparatorTransformTable == 'undefined' |
738 | | - || ( wgSeparatorTransformTable[0] == '' && wgDigitTransformTable[2] == '' ) ) |
| 733 | + if ( typeof wgSeparatorTransformTable === 'undefined' |
| 734 | + || ( wgSeparatorTransformTable[0] === '' && wgDigitTransformTable[2] === '' ) ) |
739 | 735 | { |
740 | 736 | var digitClass = "[0-9,.]"; |
741 | 737 | ts_number_transform_table = false; |
— | — | @@ -791,7 +787,7 @@ |
792 | 788 | |
793 | 789 | function ts_dateToSortKey( date ) { |
794 | 790 | // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX |
795 | | - if ( date.length == 11 ) { |
| 791 | + if ( date.length === 11 ) { |
796 | 792 | switch ( date.substr( 3, 3 ).toLowerCase() ) { |
797 | 793 | case 'jan': |
798 | 794 | var month = '01'; |
— | — | @@ -832,20 +828,20 @@ |
833 | 829 | // default: var month = '00'; |
834 | 830 | } |
835 | 831 | return date.substr( 7, 4 ) + month + date.substr( 0, 2 ); |
836 | | - } else if ( date.length == 10 ) { |
837 | | - if ( ts_europeandate == false ) { |
| 832 | + } else if ( date.length === 10 ) { |
| 833 | + if ( ts_europeandate === false ) { |
838 | 834 | return date.substr( 6, 4 ) + date.substr( 0, 2 ) + date.substr( 3, 2 ); |
839 | 835 | } else { |
840 | 836 | return date.substr( 6, 4 ) + date.substr( 3, 2 ) + date.substr( 0, 2 ); |
841 | 837 | } |
842 | | - } else if ( date.length == 8 ) { |
| 838 | + } else if ( date.length === 8 ) { |
843 | 839 | var yr = date.substr( 6, 2 ); |
844 | 840 | if ( parseInt( yr ) < 50 ) { |
845 | 841 | yr = '20' + yr; |
846 | 842 | } else { |
847 | 843 | yr = '19' + yr; |
848 | 844 | } |
849 | | - if ( ts_europeandate == true ) { |
| 845 | + if ( ts_europeandate === true ) { |
850 | 846 | return yr + date.substr( 3, 2 ) + date.substr( 0, 2 ); |
851 | 847 | } else { |
852 | 848 | return yr + date.substr( 0, 2 ) + date.substr( 3, 2 ); |
— | — | @@ -858,7 +854,7 @@ |
859 | 855 | if ( !s ) { |
860 | 856 | return 0; |
861 | 857 | } |
862 | | - if ( ts_number_transform_table != false ) { |
| 858 | + if ( ts_number_transform_table !== false ) { |
863 | 859 | var newNum = '', c; |
864 | 860 | |
865 | 861 | for ( var p = 0; p < s.length; p++ ) { |
— | — | @@ -897,11 +893,11 @@ |
898 | 894 | var oldClasses = tableRows[j].className.split(' '); |
899 | 895 | var newClassName = ''; |
900 | 896 | for ( var k = 0; k < oldClasses.length; k++ ) { |
901 | | - if ( oldClasses[k] != '' && oldClasses[k] != 'even' && oldClasses[k] != 'odd' ) { |
| 897 | + if ( oldClasses[k] !== '' && oldClasses[k] !== 'even' && oldClasses[k] !== 'odd' ) { |
902 | 898 | newClassName += oldClasses[k] + ' '; |
903 | 899 | } |
904 | 900 | } |
905 | | - tableRows[j].className = newClassName + ( j % 2 == 0 ? 'even' : 'odd' ); |
| 901 | + tableRows[j].className = newClassName + ( j % 2 === 0 ? 'even' : 'odd' ); |
906 | 902 | } |
907 | 903 | } |
908 | 904 | } |