Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -5,9 +5,9 @@ |
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 | // Tests for chrome here, to avoid breaking old scripts safari left alone |
14 | 14 | // This is here for accesskeys |
— | — | @@ -19,9 +19,9 @@ |
20 | 20 | var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC ); |
21 | 21 | var ff2_bugs = /firefox\/2/.test( clientPC ); |
22 | 22 | // These aren't used here, but some custom scripts rely on them |
23 | | -var is_ff2_win = is_ff2 && clientPC.indexOf('windows') !== -1; |
24 | | -var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') !== -1; |
25 | | -if (clientPC.indexOf('opera') !== -1) { |
| 23 | +var is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1; |
| 24 | +var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1; |
| 25 | +if (clientPC.indexOf('opera') != -1) { |
26 | 26 | var is_opera = true; |
27 | 27 | var is_opera_preseven = window.opera && !document.childNodes; |
28 | 28 | var is_opera_seven = window.opera && document.childNodes; |
— | — | @@ -33,7 +33,11 @@ |
34 | 34 | // As recommended by <http://msdn.microsoft.com/en-us/library/ms537509.aspx>, |
35 | 35 | // avoiding false positives from moronic extensions that append to the IE UA |
36 | 36 | // string (bug 23171) |
37 | | -var ie6_bugs = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec( clientPC ) && parseFloat( RegExp.$1 ) <= 6.0 ); |
| 37 | +var ie6_bugs = false; |
| 38 | +if ( /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec( clientPC ) != null |
| 39 | +&& parseFloat( RegExp.$1 ) <= 6.0 ) { |
| 40 | + ie6_bugs = true; |
| 41 | +} |
38 | 42 | |
39 | 43 | // Global external objects used by this script. |
40 | 44 | /*extern ta, stylepath, skin */ |
— | — | @@ -69,7 +73,7 @@ |
70 | 74 | var loadedScripts = {}; // included-scripts tracker |
71 | 75 | function importScriptURI( url ) { |
72 | 76 | if ( loadedScripts[url] ) { |
73 | | - return; |
| 77 | + return null; |
74 | 78 | } |
75 | 79 | loadedScripts[url] = true; |
76 | 80 | var s = document.createElement( 'script' ); |
— | — | @@ -109,7 +113,7 @@ |
110 | 114 | } |
111 | 115 | |
112 | 116 | // Special stylesheet links for Monobook only (see bug 14717) |
113 | | -if ( typeof stylepath !== 'undefined' && skin === 'monobook' ) { |
| 117 | +if ( typeof stylepath != 'undefined' && skin == 'monobook' ) { |
114 | 118 | if ( opera6_bugs ) { |
115 | 119 | importStylesheetURI( stylepath + '/' + skin + '/Opera6Fixes.css' ); |
116 | 120 | } else if ( opera7_bugs ) { |
— | — | @@ -159,7 +163,7 @@ |
160 | 164 | linkHolder.appendChild( outerSpan ); |
161 | 165 | |
162 | 166 | var cookiePos = document.cookie.indexOf( "hidetoc=" ); |
163 | | - if ( cookiePos > -1 && document.cookie.charAt( cookiePos + 8 ) === 1 ) { |
| 167 | + if ( cookiePos > -1 && document.cookie.charAt( cookiePos + 8 ) == 1 ) { |
164 | 168 | toggleToc(); |
165 | 169 | } |
166 | 170 | } |
— | — | @@ -176,7 +180,7 @@ |
177 | 181 | |
178 | 182 | function killEvt( evt ) { |
179 | 183 | evt = evt || window.event || window.Event; // W3C, IE, Netscape |
180 | | - if ( typeof ( evt.preventDefault ) !== 'undefined' ) { |
| 184 | + if ( typeof ( evt.preventDefault ) != 'undefined' ) { |
181 | 185 | evt.preventDefault(); // Don't follow the link |
182 | 186 | evt.stopPropagation(); |
183 | 187 | } else { |
— | — | @@ -190,7 +194,7 @@ |
191 | 195 | var toc = document.getElementById('toc').getElementsByTagName('ul')[0]; |
192 | 196 | var toggleLink = document.getElementById( 'togglelink' ); |
193 | 197 | |
194 | | - if ( toc && toggleLink && toc.style.display === 'none' ) { |
| 198 | + if ( toc && toggleLink && toc.style.display == 'none' ) { |
195 | 199 | changeText( toggleLink, tocHideText ); |
196 | 200 | toc.style.display = 'block'; |
197 | 201 | document.cookie = "hidetoc=0"; |
— | — | @@ -238,8 +242,8 @@ |
239 | 243 | } else if ( !is_safari_win && is_safari && webkit_version > 526 ) { |
240 | 244 | tooltipAccessKeyPrefix = 'ctrl-alt-'; |
241 | 245 | } else if ( !is_safari_win && ( is_safari |
242 | | - || clientPC.indexOf('mac') !== -1 |
243 | | - || clientPC.indexOf('konqueror') !== -1 ) ) { |
| 246 | + || clientPC.indexOf('mac') != -1 |
| 247 | + || clientPC.indexOf('konqueror') != -1 ) ) { |
244 | 248 | tooltipAccessKeyPrefix = 'ctrl-'; |
245 | 249 | } else if ( is_ff2 ) { |
246 | 250 | tooltipAccessKeyPrefix = 'alt-shift-'; |
— | — | @@ -317,11 +321,11 @@ |
318 | 322 | function addPortletLink( portlet, href, text, id, tooltip, accesskey, nextnode ) { |
319 | 323 | var root = document.getElementById( portlet ); |
320 | 324 | if ( !root ) { |
321 | | - return; |
| 325 | + return null; |
322 | 326 | } |
323 | 327 | var node = root.getElementsByTagName( 'ul' )[0]; |
324 | 328 | if ( !node ) { |
325 | | - return; |
| 329 | + return null; |
326 | 330 | } |
327 | 331 | |
328 | 332 | // unhide portlet if it was hidden before |
— | — | @@ -351,7 +355,7 @@ |
352 | 356 | updateTooltipAccessKeys( new Array( link ) ); |
353 | 357 | } |
354 | 358 | |
355 | | - if ( nextnode && nextnode.parentNode === node ) { |
| 359 | + if ( nextnode && nextnode.parentNode == node ) { |
356 | 360 | node.insertBefore( item, nextnode ); |
357 | 361 | } else { |
358 | 362 | node.appendChild( item ); // IE compatibility (?) |
— | — | @@ -361,10 +365,10 @@ |
362 | 366 | } |
363 | 367 | |
364 | 368 | function getInnerText( el ) { |
365 | | - if ( typeof el === 'string' ) { |
| 369 | + if ( typeof el == 'string' ) { |
366 | 370 | return el; |
367 | 371 | } |
368 | | - if ( typeof el === 'undefined' ) { |
| 372 | + if ( typeof el == 'undefined' ) { |
369 | 373 | return el; |
370 | 374 | } |
371 | 375 | if ( el.textContent ) { |
— | — | @@ -400,7 +404,7 @@ |
401 | 405 | |
402 | 406 | function setupCheckboxShiftClick() { |
403 | 407 | checkboxes = []; |
404 | | - lastCheckbox = undefined; |
| 408 | + lastCheckbox = null; |
405 | 409 | var inputs = document.getElementsByTagName( 'input' ); |
406 | 410 | addCheckboxClickHandlers( inputs ); |
407 | 411 | } |
— | — | @@ -417,7 +421,7 @@ |
418 | 422 | |
419 | 423 | for ( var i = start; i < finish; i++ ) { |
420 | 424 | var cb = inputs[i]; |
421 | | - if ( !cb.type || cb.type.toLowerCase() !== 'checkbox' ) { |
| 425 | + if ( !cb.type || cb.type.toLowerCase() != 'checkbox' ) { |
422 | 426 | continue; |
423 | 427 | } |
424 | 428 | var end = checkboxes.length; |
— | — | @@ -434,10 +438,10 @@ |
435 | 439 | } |
436 | 440 | |
437 | 441 | function checkboxClickHandler( e ) { |
438 | | - if ( typeof e === 'undefined' ) { |
| 442 | + if ( typeof e == 'undefined' ) { |
439 | 443 | e = window.event; |
440 | 444 | } |
441 | | - if ( !e.shiftKey || lastCheckbox === undefined ) { |
| 445 | + if ( !e.shiftKey || lastCheckbox === null ) { |
442 | 446 | lastCheckbox = this.index; |
443 | 447 | return true; |
444 | 448 | } |
— | — | @@ -452,7 +456,7 @@ |
453 | 457 | } |
454 | 458 | for ( var i = start; i <= finish; ++i ) { |
455 | 459 | checkboxes[i].checked = endState; |
456 | | - if( i > start && typeof checkboxes[i].onchange === 'function' ) { |
| 460 | + if( i > start && typeof checkboxes[i].onchange == 'function' ) { |
457 | 461 | checkboxes[i].onchange(); // fire triggers |
458 | 462 | } |
459 | 463 | } |
— | — | @@ -469,22 +473,22 @@ |
470 | 474 | */ |
471 | 475 | function getElementsByClassName( oElm, strTagName, oClassNames ) { |
472 | 476 | var arrReturnElements = new Array(); |
473 | | - if ( typeof( oElm.getElementsByClassName ) === 'function' ) { |
| 477 | + if ( typeof( oElm.getElementsByClassName ) == 'function' ) { |
474 | 478 | /* Use a native implementation where possible FF3, Saf3.2, Opera 9.5 */ |
475 | 479 | var arrNativeReturn = oElm.getElementsByClassName( oClassNames ); |
476 | | - if ( strTagName === '*' ) { |
| 480 | + if ( strTagName == '*' ) { |
477 | 481 | return arrNativeReturn; |
478 | 482 | } |
479 | 483 | for ( var h = 0; h < arrNativeReturn.length; h++ ) { |
480 | | - if( arrNativeReturn[h].tagName.toLowerCase() === strTagName.toLowerCase() ) { |
| 484 | + if( arrNativeReturn[h].tagName.toLowerCase() == strTagName.toLowerCase() ) { |
481 | 485 | arrReturnElements[arrReturnElements.length] = arrNativeReturn[h]; |
482 | 486 | } |
483 | 487 | } |
484 | 488 | return arrReturnElements; |
485 | 489 | } |
486 | | - var arrElements = ( strTagName === '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName ); |
| 490 | + var arrElements = ( strTagName == '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName ); |
487 | 491 | var arrRegExpClassNames = new Array(); |
488 | | - if( typeof oClassNames === 'object' ) { |
| 492 | + if( typeof oClassNames == 'object' ) { |
489 | 493 | for( var i = 0; i < oClassNames.length; i++ ) { |
490 | 494 | arrRegExpClassNames[arrRegExpClassNames.length] = |
491 | 495 | new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"); |
— | — | @@ -521,7 +525,7 @@ |
522 | 526 | return; |
523 | 527 | } |
524 | 528 | } |
525 | | - if ( window.location.hash === '' ) { |
| 529 | + if ( window.location.hash == '' ) { |
526 | 530 | window.location.hash = fragment; |
527 | 531 | |
528 | 532 | // Mozilla needs to wait until after load, otherwise the window doesn't |
— | — | @@ -532,7 +536,7 @@ |
533 | 537 | // well. |
534 | 538 | if ( is_gecko ) { |
535 | 539 | addOnloadHook(function() { |
536 | | - if ( window.location.hash === fragment ) { |
| 540 | + if ( window.location.hash == fragment ) { |
537 | 541 | window.location.hash = fragment; |
538 | 542 | } |
539 | 543 | }); |
— | — | @@ -555,10 +559,10 @@ |
556 | 560 | var ts_image_up = 'sort_up.gif'; |
557 | 561 | var ts_image_down = 'sort_down.gif'; |
558 | 562 | var ts_image_none = 'sort_none.gif'; |
559 | | -var ts_europeandate = wgContentLanguage !== 'en'; // The non-American-inclined can change to "true" |
| 563 | +var ts_europeandate = wgContentLanguage != 'en'; // The non-American-inclined can change to "true" |
560 | 564 | var ts_alternate_row_colors = false; |
561 | | -var ts_number_transform_table; |
562 | | -var ts_number_regex; |
| 565 | +var ts_number_transform_table = null; |
| 566 | +var ts_number_regex = null; |
563 | 567 | |
564 | 568 | function sortables_init() { |
565 | 569 | var idnum = 0; |
— | — | @@ -589,7 +593,7 @@ |
590 | 594 | // We have a first row: assume it's the header, and make its contents clickable links |
591 | 595 | for ( var i = 0; i < firstRow.cells.length; i++ ) { |
592 | 596 | var cell = firstRow.cells[i]; |
593 | | - if ( (' ' + cell.className + ' ').indexOf(' unsortable ') === -1 ) { |
| 597 | + if ( (' ' + cell.className + ' ').indexOf(' unsortable ') == -1 ) { |
594 | 598 | cell.innerHTML += '<a href="#" class="sortheader" ' |
595 | 599 | + 'onclick="ts_resortTable(this);return false;">' |
596 | 600 | + '<span class="sortarrow">' |
— | — | @@ -617,7 +621,7 @@ |
618 | 622 | var column = td.cellIndex; |
619 | 623 | |
620 | 624 | var table = tr.parentNode; |
621 | | - while ( table && !( table.tagName && table.tagName.toLowerCase() === 'table' ) ) { |
| 625 | + while ( table && !( table.tagName && table.tagName.toLowerCase() == 'table' ) ) { |
622 | 626 | table = table.parentNode; |
623 | 627 | } |
624 | 628 | if ( !table ) { |
— | — | @@ -629,7 +633,7 @@ |
630 | 634 | } |
631 | 635 | |
632 | 636 | // Generate the number transform table if it's not done already |
633 | | - if ( ts_number_transform_table === undefined ) { |
| 637 | + if ( ts_number_transform_table === null ) { |
634 | 638 | ts_initTransformTable(); |
635 | 639 | } |
636 | 640 | |
— | — | @@ -637,7 +641,7 @@ |
638 | 642 | // Skip the first row if that's where the headings are |
639 | 643 | var rowStart = ( table.tHead && table.tHead.rows.length > 0 ? 0 : 1 ); |
640 | 644 | var bodyRows = 0; |
641 | | - if (rowStart === 0 && table.tBodies) { |
| 645 | + if (rowStart == 0 && table.tBodies) { |
642 | 646 | for (var i=0; i < table.tBodies.length; i++ ) { |
643 | 647 | bodyRows += table.tBodies[i].rows.length; |
644 | 648 | } |
— | — | @@ -650,7 +654,7 @@ |
651 | 655 | if ( table.rows[i].cells.length > column ) { |
652 | 656 | itm = ts_getInnerText(table.rows[i].cells[column]); |
653 | 657 | itm = itm.replace(/^[\s\xa0]+/, '').replace(/[\s\xa0]+$/, ''); |
654 | | - if ( itm !== '' ) { |
| 658 | + if ( itm != '' ) { |
655 | 659 | break; |
656 | 660 | } |
657 | 661 | } |
— | — | @@ -672,7 +676,7 @@ |
673 | 677 | preprocessor = ts_parseFloat; |
674 | 678 | } |
675 | 679 | |
676 | | - var reverse = ( span.getAttribute( 'sortdir' ) === 'down' ); |
| 680 | + var reverse = ( span.getAttribute( 'sortdir' ) == 'down' ); |
677 | 681 | |
678 | 682 | var newRows = new Array(); |
679 | 683 | var staticRows = new Array(); |
— | — | @@ -712,13 +716,13 @@ |
713 | 717 | // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones |
714 | 718 | // don't do sortbottom rows |
715 | 719 | for ( var i = 0; i < newRows.length; i++ ) { |
716 | | - if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') === -1 ) { |
| 720 | + if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') == -1 ) { |
717 | 721 | table.tBodies[0].appendChild( newRows[i][0] ); |
718 | 722 | } |
719 | 723 | } |
720 | 724 | // do sortbottom rows only |
721 | 725 | for ( var i = 0; i < newRows.length; i++ ) { |
722 | | - if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') !== -1 ) { |
| 726 | + if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') != -1 ) { |
723 | 727 | table.tBodies[0].appendChild( newRows[i][0] ); |
724 | 728 | } |
725 | 729 | } |
— | — | @@ -736,8 +740,8 @@ |
737 | 741 | } |
738 | 742 | |
739 | 743 | function ts_initTransformTable() { |
740 | | - if ( typeof wgSeparatorTransformTable === 'undefined' |
741 | | - || ( wgSeparatorTransformTable[0] === '' && wgDigitTransformTable[2] === '' ) ) |
| 744 | + if ( typeof wgSeparatorTransformTable == 'undefined' |
| 745 | + || ( wgSeparatorTransformTable[0] == '' && wgDigitTransformTable[2] == '' ) ) |
742 | 746 | { |
743 | 747 | var digitClass = "[0-9,.]"; |
744 | 748 | ts_number_transform_table = false; |
— | — | @@ -794,7 +798,7 @@ |
795 | 799 | |
796 | 800 | function ts_dateToSortKey( date ) { |
797 | 801 | // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX |
798 | | - if ( date.length === 11 ) { |
| 802 | + if ( date.length == 11 ) { |
799 | 803 | switch ( date.substr( 3, 3 ).toLowerCase() ) { |
800 | 804 | case 'jan': |
801 | 805 | var month = '01'; |
— | — | @@ -835,20 +839,20 @@ |
836 | 840 | // default: var month = '00'; |
837 | 841 | } |
838 | 842 | return date.substr( 7, 4 ) + month + date.substr( 0, 2 ); |
839 | | - } else if ( date.length === 10 ) { |
840 | | - if ( ts_europeandate === false ) { |
| 843 | + } else if ( date.length == 10 ) { |
| 844 | + if ( ts_europeandate == false ) { |
841 | 845 | return date.substr( 6, 4 ) + date.substr( 0, 2 ) + date.substr( 3, 2 ); |
842 | 846 | } else { |
843 | 847 | return date.substr( 6, 4 ) + date.substr( 3, 2 ) + date.substr( 0, 2 ); |
844 | 848 | } |
845 | | - } else if ( date.length === 8 ) { |
| 849 | + } else if ( date.length == 8 ) { |
846 | 850 | var yr = date.substr( 6, 2 ); |
847 | 851 | if ( parseInt( yr ) < 50 ) { |
848 | 852 | yr = '20' + yr; |
849 | 853 | } else { |
850 | 854 | yr = '19' + yr; |
851 | 855 | } |
852 | | - if ( ts_europeandate === true ) { |
| 856 | + if ( ts_europeandate == true ) { |
853 | 857 | return yr + date.substr( 3, 2 ) + date.substr( 0, 2 ); |
854 | 858 | } else { |
855 | 859 | return yr + date.substr( 0, 2 ) + date.substr( 3, 2 ); |
— | — | @@ -861,7 +865,7 @@ |
862 | 866 | if ( !s ) { |
863 | 867 | return 0; |
864 | 868 | } |
865 | | - if ( ts_number_transform_table !== false ) { |
| 869 | + if ( ts_number_transform_table != false ) { |
866 | 870 | var newNum = '', c; |
867 | 871 | |
868 | 872 | for ( var p = 0; p < s.length; p++ ) { |
— | — | @@ -900,11 +904,11 @@ |
901 | 905 | var oldClasses = tableRows[j].className.split(' '); |
902 | 906 | var newClassName = ''; |
903 | 907 | for ( var k = 0; k < oldClasses.length; k++ ) { |
904 | | - if ( oldClasses[k] !== '' && oldClasses[k] !== 'even' && oldClasses[k] !== 'odd' ) { |
| 908 | + if ( oldClasses[k] != '' && oldClasses[k] != 'even' && oldClasses[k] != 'odd' ) { |
905 | 909 | newClassName += oldClasses[k] + ' '; |
906 | 910 | } |
907 | 911 | } |
908 | | - tableRows[j].className = newClassName + ( j % 2 === 0 ? 'even' : 'odd' ); |
| 912 | + tableRows[j].className = newClassName + ( j % 2 == 0 ? 'even' : 'odd' ); |
909 | 913 | } |
910 | 914 | } |
911 | 915 | } |