Index: branches/resourceloader/phase3/skins/common/metadata.js |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | // |
7 | 7 | // attachMetadataToggle('mw_metadata', 'More...', 'Fewer...'); |
8 | 8 | |
9 | | -function attachMetadataToggle( tableId, showText, hideText ) { |
| 9 | +window.attachMetadataToggle = function( tableId, showText, hideText ) { |
10 | 10 | if ( document.createTextNode ) { |
11 | 11 | var box = document.getElementById( tableId ); |
12 | 12 | if ( !box ) { |
Index: branches/resourceloader/phase3/skins/common/protect.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | |
3 | | -var ProtectionForm = { |
| 3 | +window.ProtectionForm = { |
4 | 4 | 'existingMatch': false, |
5 | 5 | |
6 | 6 | /** |
Index: branches/resourceloader/phase3/skins/common/rightclickedit.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -function setupRightClickEdit() { |
| 2 | +window.setupRightClickEdit = function() { |
3 | 3 | if (document.getElementsByTagName) { |
4 | 4 | var spans = document.getElementsByTagName('span'); |
5 | 5 | for (var i = 0; i < spans.length; i++) { |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | | -function addRightClickEditHandler(el) { |
| 14 | +window.addRightClickEditHandler = function(el) { |
15 | 15 | for (var i = 0; i < el.childNodes.length; i++) { |
16 | 16 | var link = el.childNodes[i]; |
17 | 17 | if (link.nodeType == 1 && link.nodeName.toLowerCase() == 'a') { |
Index: branches/resourceloader/phase3/skins/common/block.js |
— | — | @@ -1,6 +1,4 @@ |
2 | | -addOnloadHook( considerChangingExpiryFocus ); |
3 | | - |
4 | | -function considerChangingExpiryFocus() { |
| 2 | +window.considerChangingExpiryFocus = function() { |
5 | 3 | if ( !document.getElementById ) { |
6 | 4 | return; |
7 | 5 | } |
— | — | @@ -19,8 +17,7 @@ |
20 | 18 | field.style.display = 'none'; |
21 | 19 | } |
22 | 20 | } |
23 | | - |
24 | | -function updateBlockOptions() { |
| 21 | +window.updateBlockOptions = function() { |
25 | 22 | if ( !document.getElementById ) { |
26 | 23 | return; |
27 | 24 | } |
— | — | @@ -55,3 +52,5 @@ |
56 | 53 | watchuserRow.style.display = isIpRange && !isEmpty ? 'none' : ''; |
57 | 54 | } |
58 | 55 | } |
| 56 | + |
| 57 | +addOnloadHook( considerChangingExpiryFocus ); |
\ No newline at end of file |
Index: branches/resourceloader/phase3/skins/common/IEFixes.js |
— | — | @@ -1,14 +1,14 @@ |
2 | 2 | // IE fixes javascript |
3 | 3 | |
4 | | -var isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup ); |
5 | | -var doneIETransform; |
6 | | -var doneIEAlphaFix; |
| 4 | +window.isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup ); |
| 5 | +window.doneIETransform; |
| 6 | +window.doneIEAlphaFix; |
7 | 7 | |
8 | 8 | if ( document.attachEvent ) { |
9 | 9 | document.attachEvent( 'onreadystatechange', hookit ); |
10 | 10 | } |
11 | 11 | |
12 | | -function hookit() { |
| 12 | +window.hookit = function() { |
13 | 13 | if ( !doneIETransform && document.getElementById && document.getElementById( 'bodyContent' ) ) { |
14 | 14 | doneIETransform = true; |
15 | 15 | relativeforfloats(); |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | } |
19 | 19 | |
20 | 20 | // png alpha transparency fixes |
21 | | -function fixalpha( logoId ) { |
| 21 | +window.fixalpha = function( logoId ) { |
22 | 22 | // bg |
23 | 23 | if ( isMSIE55 && !doneIEAlphaFix ) { |
24 | 24 | var plogo = document.getElementById( logoId || 'p-logo' ); |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | } |
66 | 66 | |
67 | 67 | // fix ie6 disappering float bug |
68 | | -function relativeforfloats() { |
| 68 | +window.relativeforfloats = function() { |
69 | 69 | var bc = document.getElementById( 'bodyContent' ); |
70 | 70 | if ( bc ) { |
71 | 71 | var tables = bc.getElementsByTagName( 'table' ); |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | setrelative( tables ); |
75 | 75 | setrelative( divs ); |
76 | 76 | } |
77 | | -function setrelative( nodes ) { |
| 77 | +window.setrelative = function( nodes ) { |
78 | 78 | var i = 0; |
79 | 79 | while ( i < nodes.length ) { |
80 | 80 | if( ( ( nodes[i].style.float && nodes[i].style.float != ( 'none' ) || |
— | — | @@ -97,9 +97,9 @@ |
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | |
101 | | -var expandedURLs; |
| 101 | +window.expandedURLs = undefined; |
102 | 102 | |
103 | | -onbeforeprint = function() { |
| 103 | +window.onbeforeprint = function() { |
104 | 104 | expandedURLs = []; |
105 | 105 | |
106 | 106 | var contentEl = document.getElementById( 'content' ); |
— | — | @@ -119,7 +119,7 @@ |
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | | -onafterprint = function() { |
| 123 | +window.onafterprint = function() { |
124 | 124 | for ( var i = 0; i < expandedURLs.length; i++ ) { |
125 | 125 | if ( expandedURLs[i] ) { |
126 | 126 | expandedURLs[i].removeNode( true ); |
Index: branches/resourceloader/phase3/skins/common/enhancedchanges.js |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | * Switch an RC line between hidden/shown |
26 | 26 | * @param int idNumber : the id number of the RC group |
27 | 27 | */ |
28 | | -function toggleVisibility(idNumber) { |
| 28 | +window.toggleVisibility = function(idNumber) { |
29 | 29 | var openarrow = document.getElementById("mw-rc-openarrow-"+idNumber); |
30 | 30 | var closearrow = document.getElementById("mw-rc-closearrow-"+idNumber); |
31 | 31 | var subentries = document.getElementById("mw-rc-subentries-"+idNumber); |
Index: branches/resourceloader/phase3/skins/common/password.js |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * @todo Check for popular passwords and keyboard sequences (QWERTY, etc) |
7 | 7 | */ |
8 | 8 | |
9 | | -function bruteForceComplexity( pwd ) { |
| 9 | +window.bruteForceComplexity = function( pwd ) { |
10 | 10 | var score = 0; |
11 | 11 | |
12 | 12 | if ( pwd.length < 16 ) { |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | return score; |
44 | 44 | } |
45 | 45 | |
46 | | -function repetitionScore( pwd ) { |
| 46 | +window.repetitionScore = function( pwd ) { |
47 | 47 | var unique = ''; |
48 | 48 | for ( var i=0; i< pwd.length; i++ ) { |
49 | 49 | if ( unique.indexOf( pwd[i] ) < 0 ) { |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | return 100 / ratio; |
56 | 56 | } |
57 | 57 | |
58 | | -function sequenceScore( pwd ) { |
| 58 | +window.sequenceScore = function( pwd ) { |
59 | 59 | pwd = pwd.concat( '\0' ); |
60 | 60 | var score = 100, sequence = 1; |
61 | 61 | for ( var i = 1; i < pwd.length; i++ ) { |
Index: branches/resourceloader/phase3/skins/common/search.js |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | // JS specific to Special:Search |
3 | 3 | |
4 | 4 | // change the search link to what user entered |
5 | | -function mwSearchHeaderClick( obj ) { |
| 5 | +window.mwSearchHeaderClick = function( obj ) { |
6 | 6 | var searchbox = document.getElementById( 'searchText' ); |
7 | 7 | if( searchbox === null ) { |
8 | 8 | searchbox = document.getElementById( 'powerSearchText' ); |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | obj.href = parts[0] + prefix + encodeURIComponent( searchterm ) + lastpart; |
24 | 24 | } |
25 | 25 | |
26 | | -function mwToggleSearchCheckboxes( btn ) { |
| 26 | +window.mwToggleSearchCheckboxes = function( btn ) { |
27 | 27 | if( !document.getElementById ) { |
28 | 28 | return; |
29 | 29 | } |
Index: branches/resourceloader/phase3/skins/common/changepassword.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | |
3 | | -function onNameChange() { |
| 3 | +window.onNameChange = function() { |
4 | 4 | if ( wgUserName != document.getElementById('wpName').value ) { |
5 | 5 | document.getElementById('wpPassword').disabled = true; |
6 | 6 | document.getElementById('wpComment').disabled = false; |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | } |
11 | 11 | } |
12 | 12 | |
13 | | -function onNameChangeHook() { |
| 13 | +window.onNameChangeHook = function() { |
14 | 14 | document.getElementById( 'wpName' ).onblur = onNameChange; |
15 | 15 | } |
16 | 16 | |
Index: branches/resourceloader/phase3/skins/common/ajaxwatch.js |
— | — | @@ -4,15 +4,8 @@ |
5 | 5 | * Uses jsMsg() from wikibits.js. |
6 | 6 | */ |
7 | 7 | |
8 | | -if( typeof wgAjaxWatch === 'undefined' || !wgAjaxWatch ) { |
9 | | - var wgAjaxWatch = { |
10 | | - watchMsg: 'Watch', |
11 | | - unwatchMsg: 'Unwatch', |
12 | | - watchingMsg: 'Watching...', |
13 | | - unwatchingMsg: 'Unwatching...', |
14 | | - 'tooltip-ca-watchMsg': 'Add this page to your watchlist', |
15 | | - 'tooltip-ca-unwatchMsg': 'Remove this page from your watchlist' |
16 | | - }; |
| 8 | +if ( typeof wgAjaxWatch === 'undefined' || !wgAjaxWatch ) { |
| 9 | + window.wgAjaxWatch = { }; |
17 | 10 | } |
18 | 11 | |
19 | 12 | wgAjaxWatch.setLinkText = function( $link, action ) { |
— | — | @@ -21,23 +14,23 @@ |
22 | 15 | var keyCommand = $link.attr( 'title' ).match( /\[.*?\]$/ ) |
23 | 16 | ? $link.attr( 'title' ).match( /\[.*?\]$/ )[0] |
24 | 17 | : ''; |
25 | | - $link.attr( 'title', wgAjaxWatch['tooltip-ca-' + action + 'Msg'] + ' ' + keyCommand ); |
| 18 | + $link.attr( 'title', mediaWiki.msg.get( 'tooltip-ca-' + action + 'Msg') + ' ' + keyCommand ); |
26 | 19 | } |
27 | 20 | if( $link.data( 'icon' ) ) { |
28 | | - $link.attr( 'alt', wgAjaxWatch[action + 'Msg'] ); |
| 21 | + $link.attr( 'alt', mediaWiki.msg.get( action + 'Msg' ) ); |
29 | 22 | if ( action == 'watching' || action == 'unwatching' ) { |
30 | 23 | $link.addClass( 'loading' ); |
31 | 24 | } else { |
32 | 25 | $link.removeClass( 'loading' ); |
33 | 26 | } |
34 | 27 | } else { |
35 | | - $link.html( wgAjaxWatch[action + 'Msg'] ); |
| 28 | + $link.html( mediaWiki.msg.get( action + 'Msg' ) ); |
36 | 29 | } |
37 | 30 | }; |
38 | 31 | |
39 | 32 | wgAjaxWatch.processResult = function( response ) { |
40 | 33 | response = response.watch; |
41 | | - var $link = $j( this ); |
| 34 | + var $link = $( this ); |
42 | 35 | // To ensure we set the same status for all watch links with the |
43 | 36 | // same target we trigger a custom event on *all* watch links. |
44 | 37 | if( response.watched !== undefined ) { |
— | — | @@ -55,23 +48,23 @@ |
56 | 49 | // Bug 12395 - update the watch checkbox on edit pages when the |
57 | 50 | // page is watched or unwatched via the tab. |
58 | 51 | if( response.watched !== undefined ) { |
59 | | - $j( '#wpWatchthis' ).attr( 'checked', '1' ); |
| 52 | + $( '#wpWatchthis' ).attr( 'checked', '1' ); |
60 | 53 | } else { |
61 | | - $j( '#wpWatchthis' ).removeAttr( 'checked' ); |
| 54 | + $( '#wpWatchthis' ).removeAttr( 'checked' ); |
62 | 55 | } |
63 | 56 | }; |
64 | 57 | |
65 | | -$j( document ).ready( function() { |
66 | | - var $links = $j( '.mw-watchlink a, a.mw-watchlink' ); |
| 58 | +$( document ).ready( function() { |
| 59 | + var $links = $( '.mw-watchlink a, a.mw-watchlink' ); |
67 | 60 | // BC with older skins |
68 | 61 | $links = $links |
69 | | - .add( $j( '#ca-watch a, #ca-unwatch a, a#mw-unwatch-link1' ) ) |
70 | | - .add( $j( 'a#mw-unwatch-link2, a#mw-watch-link2, a#mw-watch-link1' ) ); |
| 62 | + .add( $( '#ca-watch a, #ca-unwatch a, a#mw-unwatch-link1' ) ) |
| 63 | + .add( $( 'a#mw-unwatch-link2, a#mw-watch-link2, a#mw-watch-link1' ) ); |
71 | 64 | // allowing people to add inline animated links is a little scary |
72 | 65 | $links = $links.filter( ':not( #bodyContent *, #content * )' ); |
73 | 66 | |
74 | 67 | $links.each( function() { |
75 | | - var $link = $j( this ); |
| 68 | + var $link = $( this ); |
76 | 69 | $link |
77 | 70 | .data( 'icon', $link.parents( 'li' ).hasClass( 'icon' ) ) |
78 | 71 | .data( 'action', $link.attr( 'href' ).match( /[\?\&]action=unwatch/i ) ? 'unwatch' : 'watch' ); |
— | — | @@ -80,7 +73,7 @@ |
81 | 74 | }); |
82 | 75 | |
83 | 76 | $links.click( function( event ) { |
84 | | - var $link = $j( this ); |
| 77 | + var $link = $( this ); |
85 | 78 | |
86 | 79 | if( wgAjaxWatch.supported === false || !wgEnableWriteAPI || !wfSupportsAjax() ) { |
87 | 80 | // Lazy initialization so we don't toss up |
— | — | @@ -91,7 +84,7 @@ |
92 | 85 | } |
93 | 86 | |
94 | 87 | wgAjaxWatch.setLinkText( $link, $link.data( 'action' ) + 'ing' ); |
95 | | - $j.get( wgScriptPath |
| 88 | + $.get( wgScriptPath |
96 | 89 | + '/api' + wgScriptExtension + '?action=watch&format=json&title=' |
97 | 90 | + encodeURIComponent( $link.data( 'target' ) ) |
98 | 91 | + ( $link.data( 'action' ) == 'unwatch' ? '&unwatch' : '' ), |
— | — | @@ -106,7 +99,7 @@ |
107 | 100 | // When a request returns, a custom event 'mw-ajaxwatch' is triggered |
108 | 101 | // on *all* watch links, so they can be updated if necessary |
109 | 102 | $links.bind( 'mw-ajaxwatch', function( event, target, action ) { |
110 | | - var $link = $j( this ); |
| 103 | + var $link = $( this ); |
111 | 104 | var foo = $link.data( 'target' ); |
112 | 105 | if( $link.data( 'target' ) == target ) { |
113 | 106 | var otheraction = action == 'watch' |
— | — | @@ -119,7 +112,7 @@ |
120 | 113 | if( $link.parents( 'li' ).attr( 'id' ) == 'ca-' + action ) { |
121 | 114 | $link.parents( 'li' ).attr( 'id', 'ca-' + otheraction ); |
122 | 115 | // update the link text with the new message |
123 | | - $link.text( wgAjaxWatch[ otheraction + 'Msg'] ); |
| 116 | + $link.text( mediaWiki.msg.get( otheraction + 'Msg' ) ); |
124 | 117 | } |
125 | 118 | }; |
126 | 119 | return false; |
Index: branches/resourceloader/phase3/skins/common/prefs.js |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | // generate toc from prefs form, fold sections |
3 | 3 | // XXX: needs testing on IE/Mac and safari |
4 | 4 | // more comments to follow |
5 | | -function tabbedprefs() { |
| 5 | +window.tabbedprefs = function() { |
6 | 6 | var prefform = document.getElementById( 'preferences' ); |
7 | 7 | if ( !prefform || !document.createElement ) { |
8 | 8 | return; |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | document.getElementById( 'prefsubmit' ).id = 'prefcontrol'; |
61 | 61 | } |
62 | 62 | |
63 | | -function uncoversection() { |
| 63 | +window.uncoversection = function() { |
64 | 64 | var oldsecid = this.parentNode.parentNode.selectedid; |
65 | 65 | var newsec = document.getElementById( this.secid ); |
66 | 66 | if ( oldsecid != this.secid ) { |
— | — | @@ -78,7 +78,7 @@ |
79 | 79 | |
80 | 80 | // Timezone stuff |
81 | 81 | // tz in format [+-]HHMM |
82 | | -function checkTimezone( tz, msg ) { |
| 82 | +window.checkTimezone = function( tz, msg ) { |
83 | 83 | var localclock = new Date(); |
84 | 84 | // returns negative offset from GMT in minutes |
85 | 85 | var tzRaw = localclock.getTimezoneOffset(); |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | | -function timezoneSetup() { |
| 95 | +window.timezoneSetup = function() { |
96 | 96 | var tzSelect = document.getElementById( 'mw-input-timecorrection' ); |
97 | 97 | var tzTextbox = document.getElementById( 'mw-input-timecorrection-other' ); |
98 | 98 | |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | |
107 | 107 | // in [-]HH:MM format... |
108 | 108 | // won't yet work with non-even tzs |
109 | | -function fetchTimezone() { |
| 109 | +window.fetchTimezone = function() { |
110 | 110 | // FIXME: work around Safari bug |
111 | 111 | var localclock = new Date(); |
112 | 112 | // returns negative offset from GMT in minutes |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | return tzString; |
119 | 119 | } |
120 | 120 | |
121 | | -function guessTimezone() { |
| 121 | +window.guessTimezone = function() { |
122 | 122 | var textbox = document.getElementById( 'mw-input-timecorrection-other' ); |
123 | 123 | var selector = document.getElementById( 'mw-input-timecorrection' ); |
124 | 124 | |
— | — | @@ -127,7 +127,7 @@ |
128 | 128 | updateTimezoneSelection( true ); |
129 | 129 | } |
130 | 130 | |
131 | | -function updateTimezoneSelection( force_offset ) { |
| 131 | +window.updateTimezoneSelection = function( force_offset ) { |
132 | 132 | var selector = document.getElementById( 'mw-input-timecorrection' ); |
133 | 133 | |
134 | 134 | if ( selector.value == 'guess' ) { |
Index: branches/resourceloader/phase3/skins/common/preview.js |
— | — | @@ -2,12 +2,12 @@ |
3 | 3 | * Live preview script for MediaWiki |
4 | 4 | */ |
5 | 5 | |
6 | | -function doLivePreview( e ) { |
| 6 | +window.doLivePreview = function( e ) { |
7 | 7 | e.preventDefault(); |
8 | 8 | |
9 | | - $j( mw ).trigger( 'LivePreviewPrepare' ); |
| 9 | + $( mw ).trigger( 'LivePreviewPrepare' ); |
10 | 10 | |
11 | | - var postData = $j('#editform').formToArray(); |
| 11 | + var postData = $('#editform').formToArray(); |
12 | 12 | postData.push( { 'name' : 'wpPreview', 'value' : '1' } ); |
13 | 13 | |
14 | 14 | // Hide active diff, used templates, old preview if shown |
— | — | @@ -15,14 +15,14 @@ |
16 | 16 | '#catlinks']; |
17 | 17 | var copySelector = copyElements.join(','); |
18 | 18 | |
19 | | - $j.each( copyElements, function(k,v) { $j(v).fadeOut('fast'); } ); |
| 19 | + $.each( copyElements, function(k,v) { $(v).fadeOut('fast'); } ); |
20 | 20 | |
21 | 21 | // Display a loading graphic |
22 | | - var loadSpinner = $j('<div class="mw-ajax-loader"/>'); |
23 | | - $j('#wikiPreview').before( loadSpinner ); |
| 22 | + var loadSpinner = $('<div class="mw-ajax-loader"/>'); |
| 23 | + $('#wikiPreview').before( loadSpinner ); |
24 | 24 | |
25 | | - var page = $j('<div/>'); |
26 | | - var target = $j('#editform').attr('action'); |
| 25 | + var page = $('<div/>'); |
| 26 | + var target = $('#editform').attr('action'); |
27 | 27 | |
28 | 28 | if ( !target ) { |
29 | 29 | target = window.location.href; |
— | — | @@ -36,25 +36,25 @@ |
37 | 37 | // and the real page, empty the element in the real page, and fill it |
38 | 38 | // with the content of the loaded page |
39 | 39 | var copyContent = page.find( copyElements[i] ).contents(); |
40 | | - $j(copyElements[i]).empty().append( copyContent ); |
| 40 | + $(copyElements[i]).empty().append( copyContent ); |
41 | 41 | var newClasses = page.find( copyElements[i] ).attr('class'); |
42 | | - $j(copyElements[i]).attr( 'class', newClasses ); |
| 42 | + $(copyElements[i]).attr( 'class', newClasses ); |
43 | 43 | } |
44 | 44 | |
45 | | - $j.each( copyElements, function(k,v) { |
| 45 | + $.each( copyElements, function(k,v) { |
46 | 46 | // Don't belligerently show elements that are supposed to be hidden |
47 | | - $j(v).fadeIn( 'fast', function() { $j(this).css('display', ''); } ); |
| 47 | + $(v).fadeIn( 'fast', function() { $(this).css('display', ''); } ); |
48 | 48 | } ); |
49 | 49 | |
50 | 50 | loadSpinner.remove(); |
51 | 51 | |
52 | | - $j( mw ).trigger( 'LivePreviewDone', [copyElements] ); |
| 52 | + $( mw ).trigger( 'LivePreviewDone', [copyElements] ); |
53 | 53 | } ); |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Shamelessly stolen from the jQuery form plugin, which is licensed under the GPL. |
57 | 57 | // http://jquery.malsup.com/form/#download |
58 | | -$j.fn.formToArray = function() { |
| 58 | +$.fn.formToArray = function() { |
59 | 59 | var a = []; |
60 | 60 | if (this.length == 0) return a; |
61 | 61 | |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | var n = el.name; |
68 | 68 | if (!n) continue; |
69 | 69 | |
70 | | - var v = $j.fieldValue(el, true); |
| 70 | + var v = $.fieldValue(el, true); |
71 | 71 | if (v && v.constructor == Array) { |
72 | 72 | for(var j=0, jmax=v.length; j < jmax; j++) |
73 | 73 | a.push({name: n, value: v[j]}); |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | /** |
91 | 91 | * Returns the value of the field element. |
92 | 92 | */ |
93 | | -$j.fieldValue = function(el, successful) { |
| 93 | +$.fieldValue = function(el, successful) { |
94 | 94 | var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); |
95 | 95 | if (typeof successful == 'undefined') successful = true; |
96 | 96 | |
— | — | @@ -122,6 +122,6 @@ |
123 | 123 | return el.value; |
124 | 124 | }; |
125 | 125 | |
126 | | -$j(document).ready( function() { |
127 | | - $j('#wpPreview').click( doLivePreview ); |
| 126 | +$(document).ready( function() { |
| 127 | + $('#wpPreview').click( doLivePreview ); |
128 | 128 | } ); |
Index: branches/resourceloader/phase3/skins/common/ajax.js |
— | — | @@ -1,14 +1,14 @@ |
2 | 2 | // remote scripting library |
3 | 3 | // (c) copyright 2005 modernmethod, inc |
4 | | -var sajax_debug_mode = false; |
5 | | -var sajax_request_type = "GET"; |
| 4 | +window.sajax_debug_mode = false; |
| 5 | +window.sajax_request_type = "GET"; |
6 | 6 | |
7 | 7 | /** |
8 | 8 | * if sajax_debug_mode is true, this function outputs given the message into |
9 | 9 | * the element with id = sajax_debug; if no such element exists in the document, |
10 | 10 | * it is injected. |
11 | 11 | */ |
12 | | -function sajax_debug(text) { |
| 12 | +window.sajax_debug = function(text) { |
13 | 13 | if (!sajax_debug_mode) return false; |
14 | 14 | |
15 | 15 | var e= document.getElementById('sajax_debug'); |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | /** |
37 | 37 | * compatibility wrapper for creating a new XMLHttpRequest object. |
38 | 38 | */ |
39 | | -function sajax_init_object() { |
| 39 | +window.sajax_init_object = function() { |
40 | 40 | sajax_debug("sajax_init_object() called..") |
41 | 41 | var A; |
42 | 42 | try { |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | * (1, 2, 3) as the parameter list, and will show the result in the element |
78 | 78 | * with id = showFoo |
79 | 79 | */ |
80 | | -function sajax_do_call(func_name, args, target) { |
| 80 | +window.sajax_do_call = function(func_name, args, target) { |
81 | 81 | var i, x, n; |
82 | 82 | var uri; |
83 | 83 | var post_data; |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | /** |
160 | 160 | * @return boolean whether the browser supports XMLHttpRequest |
161 | 161 | */ |
162 | | -function wfSupportsAjax() { |
| 162 | +window.wfSupportsAjax = function() { |
163 | 163 | var request = sajax_init_object(); |
164 | 164 | var supportsAjax = request ? true : false; |
165 | 165 | delete request; |
Index: branches/resourceloader/phase3/skins/common/upload.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -function licenseSelectorCheck() { |
| 2 | +window.licenseSelectorCheck = function() { |
3 | 3 | var selector = document.getElementById( "wpLicense" ); |
4 | 4 | var selection = selector.options[selector.selectedIndex].value; |
5 | 5 | if( selector.selectedIndex > 0 ) { |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | wgUploadLicenseObj.fetchPreview( selection ); |
13 | 13 | } |
14 | 14 | |
15 | | -function wgUploadSetup() { |
| 15 | +window.wgUploadSetup = function() { |
16 | 16 | // Disable URL box if the URL copy upload source type is not selected |
17 | 17 | var e = document.getElementById( 'wpSourceTypeurl' ); |
18 | 18 | if( e ) { |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | * @param enabledId The id of the selected radio button |
94 | 94 | * @return emptiness |
95 | 95 | */ |
96 | | -function toggleUploadInputs() { |
| 96 | +window.toggleUploadInputs = function() { |
97 | 97 | // Iterate over all rows with UploadSourceField |
98 | 98 | var rows; |
99 | 99 | if ( document.getElementsByClassName ) { |
— | — | @@ -126,7 +126,7 @@ |
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | | -var wgUploadWarningObj = { |
| 130 | +window.wgUploadWarningObj = { |
131 | 131 | 'responseCache' : { '' : ' ' }, |
132 | 132 | 'nameToCheck' : '', |
133 | 133 | 'typing': false, |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | | -function fillDestFilename(id) { |
| 216 | +window.fillDestFilename = function(id) { |
217 | 217 | if (!wgUploadAutoFill) { |
218 | 218 | return; |
219 | 219 | } |
— | — | @@ -286,7 +286,7 @@ |
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
290 | | -function toggleFilenameFiller() { |
| 290 | +window.toggleFilenameFiller = function() { |
291 | 291 | if(!document.getElementById) return; |
292 | 292 | var upfield = document.getElementById('wpUploadFile'); |
293 | 293 | var destName = document.getElementById('wpDestFile').value; |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | } |
299 | 299 | } |
300 | 300 | |
301 | | -var wgUploadLicenseObj = { |
| 301 | +window.wgUploadLicenseObj = { |
302 | 302 | |
303 | 303 | 'responseCache' : { '' : '' }, |
304 | 304 | |
Index: branches/resourceloader/phase3/skins/common/mwsuggest.js |
— | — | @@ -8,38 +8,38 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | // search_box_id -> Results object |
12 | | -var os_map = {}; |
| 12 | +window.os_map = {}; |
13 | 13 | // cached data, url -> json_text |
14 | | -var os_cache = {}; |
| 14 | +window.os_cache = {}; |
15 | 15 | // global variables for suggest_keypress |
16 | | -var os_cur_keypressed = 0; |
17 | | -var os_keypressed_count = 0; |
| 16 | +window.os_cur_keypressed = 0; |
| 17 | +window.os_keypressed_count = 0; |
18 | 18 | // type: Timer |
19 | | -var os_timer = null; |
| 19 | +window.os_timer = null; |
20 | 20 | // tie mousedown/up events |
21 | | -var os_mouse_pressed = false; |
22 | | -var os_mouse_num = -1; |
| 21 | +window.os_mouse_pressed = false; |
| 22 | +window.os_mouse_num = -1; |
23 | 23 | // if true, the last change was made by mouse (and not keyboard) |
24 | | -var os_mouse_moved = false; |
| 24 | +window.os_mouse_moved = false; |
25 | 25 | // delay between keypress and suggestion (in ms) |
26 | | -var os_search_timeout = 250; |
| 26 | +window.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 | +window.os_autoload_inputs = new Array('searchInput', 'searchInput2', 'powerSearchText', 'searchText'); |
| 29 | +window.os_autoload_forms = new Array('searchform', 'searchform2', 'powersearch', 'search' ); |
30 | 30 | // if we stopped the service |
31 | | -var os_is_stopped = false; |
| 31 | +window.os_is_stopped = false; |
32 | 32 | // max lines to show in suggest table |
33 | | -var os_max_lines_per_suggest = 7; |
| 33 | +window.os_max_lines_per_suggest = 7; |
34 | 34 | // number of steps to animate expansion/contraction of container width |
35 | | -var os_animation_steps = 6; |
| 35 | +window.os_animation_steps = 6; |
36 | 36 | // num of pixels of smallest step |
37 | | -var os_animation_min_step = 2; |
| 37 | +window.os_animation_min_step = 2; |
38 | 38 | // delay between steps (in ms) |
39 | | -var os_animation_delay = 30; |
| 39 | +window.os_animation_delay = 30; |
40 | 40 | // max width of container in percent of normal size (1 == 100%) |
41 | | -var os_container_max_width = 2; |
| 41 | +window.os_container_max_width = 2; |
42 | 42 | // currently active animation timer |
43 | | -var os_animation_timer = null; |
| 43 | +window.os_animation_timer = null; |
44 | 44 | /** |
45 | 45 | * <datalist> is a new HTML5 element that allows you to manually supply |
46 | 46 | * suggestion lists and have them rendered according to the right platform |
— | — | @@ -50,17 +50,17 @@ |
51 | 51 | * (maybe with a UA check) when some browser has a better implementation. |
52 | 52 | */ |
53 | 53 | // var os_use_datalist = 'list' in document.createElement( 'input' ); |
54 | | -var os_use_datalist = false; |
| 54 | +window.os_use_datalist = false; |
55 | 55 | |
56 | 56 | /** Timeout timer class that will fetch the results */ |
57 | | -function os_Timer( id, r, query ) { |
| 57 | +window.os_Timer = function( id, r, query ) { |
58 | 58 | this.id = id; |
59 | 59 | this.r = r; |
60 | 60 | this.query = query; |
61 | 61 | } |
62 | 62 | |
63 | 63 | /** Property class for single search box */ |
64 | | -function os_Results( name, formname ) { |
| 64 | +window.os_Results = function( name, formname ) { |
65 | 65 | this.searchform = formname; // id of the searchform |
66 | 66 | this.searchbox = name; // id of the searchbox |
67 | 67 | this.container = name + 'Suggest'; // div that holds results |
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | } |
82 | 82 | |
83 | 83 | /** Timer user to animate expansion/contraction of container width */ |
84 | | -function os_AnimationTimer( r, target ) { |
| 84 | +window.os_AnimationTimer = function( r, target ) { |
85 | 85 | this.r = r; |
86 | 86 | var current = document.getElementById(r.container).offsetWidth; |
87 | 87 | this.inc = Math.round( ( target - current ) / os_animation_steps ); |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | ******************/ |
100 | 100 | |
101 | 101 | /** Initialization, call upon page onload */ |
102 | | -function os_MWSuggestInit() { |
| 102 | +window.os_MWSuggestInit = function() { |
103 | 103 | for( i = 0; i < os_autoload_inputs.length; i++ ) { |
104 | 104 | var id = os_autoload_inputs[i]; |
105 | 105 | var form = os_autoload_forms[i]; |
— | — | @@ -110,7 +110,7 @@ |
111 | 111 | } |
112 | 112 | |
113 | 113 | /** Init Result objects and event handlers */ |
114 | | -function os_initHandlers( name, formname, element ) { |
| 114 | +window.os_initHandlers = function( name, formname, element ) { |
115 | 115 | var r = new os_Results( name, formname ); |
116 | 116 | var formElement = document.getElementById( formname ); |
117 | 117 | if( !formElement ) { |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | |
161 | 161 | } |
162 | 162 | |
163 | | -function os_hookEvent( element, hookName, hookFunct ) { |
| 163 | +window.os_hookEvent = function( element, hookName, hookFunct ) { |
164 | 164 | if ( element.addEventListener ) { |
165 | 165 | element.addEventListener( hookName, hookFunct, false ); |
166 | 166 | } else if ( window.attachEvent ) { |
— | — | @@ -172,7 +172,7 @@ |
173 | 173 | ********************/ |
174 | 174 | |
175 | 175 | /** Event handler that will fetch results on keyup */ |
176 | | -function os_eventKeyup( e ) { |
| 176 | +window.os_eventKeyup = function( e ) { |
177 | 177 | var targ = os_getTarget( e ); |
178 | 178 | var r = os_map[targ.id]; |
179 | 179 | if( r == null ) { |
— | — | @@ -188,7 +188,7 @@ |
189 | 189 | } |
190 | 190 | |
191 | 191 | /** catch arrows up/down and escape to hide the suggestions */ |
192 | | -function os_processKey( r, keypressed, targ ) { |
| 192 | +window.os_processKey = function( r, keypressed, targ ) { |
193 | 193 | if ( keypressed == 40 && !r.visible && os_timer == null ) { |
194 | 194 | // If the user hits the down arrow, fetch results immediately if none |
195 | 195 | // are already displayed. |
— | — | @@ -218,7 +218,7 @@ |
219 | 219 | } |
220 | 220 | |
221 | 221 | /** When keys is held down use a timer to output regular events */ |
222 | | -function os_eventKeypress( e ) { |
| 222 | +window.os_eventKeypress = function( e ) { |
223 | 223 | var targ = os_getTarget( e ); |
224 | 224 | var r = os_map[targ.id]; |
225 | 225 | if( r == null ) { |
— | — | @@ -232,7 +232,7 @@ |
233 | 233 | } |
234 | 234 | |
235 | 235 | /** Catch the key code (Firefox bug) */ |
236 | | -function os_eventKeydown( e ) { |
| 236 | +window.os_eventKeydown = function( e ) { |
237 | 237 | if ( !e ) { |
238 | 238 | e = window.event; |
239 | 239 | } |
— | — | @@ -250,7 +250,7 @@ |
251 | 251 | |
252 | 252 | |
253 | 253 | /** When the form is submitted hide everything, cancel updates... */ |
254 | | -function os_eventOnsubmit( e ) { |
| 254 | +window.os_eventOnsubmit = function( e ) { |
255 | 255 | var targ = os_getTarget( e ); |
256 | 256 | |
257 | 257 | os_is_stopped = true; |
— | — | @@ -278,7 +278,7 @@ |
279 | 279 | |
280 | 280 | /** Hide results from the user, either making the div visibility=hidden or |
281 | 281 | * detaching the datalist from the input. */ |
282 | | -function os_hideResults( r ) { |
| 282 | +window.os_hideResults = function( r ) { |
283 | 283 | if ( os_use_datalist ) { |
284 | 284 | document.getElementById( r.searchbox ).setAttribute( 'list', '' ); |
285 | 285 | } else { |
— | — | @@ -291,7 +291,7 @@ |
292 | 292 | r.selected = -1; |
293 | 293 | } |
294 | 294 | |
295 | | -function os_decodeValue( value ) { |
| 295 | +window.os_decodeValue = function( value ) { |
296 | 296 | if ( decodeURIComponent ) { |
297 | 297 | return decodeURIComponent( value ); |
298 | 298 | } |
— | — | @@ -301,7 +301,7 @@ |
302 | 302 | return null; |
303 | 303 | } |
304 | 304 | |
305 | | -function os_encodeQuery( value ) { |
| 305 | +window.os_encodeQuery = function( value ) { |
306 | 306 | if ( encodeURIComponent ) { |
307 | 307 | return encodeURIComponent( value ); |
308 | 308 | } |
— | — | @@ -312,7 +312,7 @@ |
313 | 313 | } |
314 | 314 | |
315 | 315 | /** Handles data from XMLHttpRequest, and updates the suggest results */ |
316 | | -function os_updateResults( r, query, text, cacheKey ) { |
| 316 | +window.os_updateResults = function( r, query, text, cacheKey ) { |
317 | 317 | os_cache[cacheKey] = text; |
318 | 318 | r.query = query; |
319 | 319 | r.original = query; |
— | — | @@ -348,7 +348,7 @@ |
349 | 349 | * @param r os_Result object |
350 | 350 | * @param results Array of the new results to replace existing ones |
351 | 351 | */ |
352 | | -function os_setupDatalist( r, results ) { |
| 352 | +window.os_setupDatalist = function( r, results ) { |
353 | 353 | var s = document.getElementById( r.searchbox ); |
354 | 354 | var c = document.getElementById( r.container ); |
355 | 355 | if ( c == null ) { |
— | — | @@ -374,7 +374,7 @@ |
375 | 375 | |
376 | 376 | /** Fetch namespaces from checkboxes or hidden fields in the search form, |
377 | 377 | if none defined use wgSearchNamespaces global */ |
378 | | -function os_getNamespaces( r ) { |
| 378 | +window.os_getNamespaces = function( r ) { |
379 | 379 | var namespaces = ''; |
380 | 380 | var elements = document.forms[r.searchform].elements; |
381 | 381 | for( i = 0; i < elements.length; i++ ) { |
— | — | @@ -398,7 +398,7 @@ |
399 | 399 | } |
400 | 400 | |
401 | 401 | /** Update results if user hasn't already typed something else */ |
402 | | -function os_updateIfRelevant( r, query, text, cacheKey ) { |
| 402 | +window.os_updateIfRelevant = function( r, query, text, cacheKey ) { |
403 | 403 | var t = document.getElementById( r.searchbox ); |
404 | 404 | if( t != null && t.value == query ) { // check if response is still relevant |
405 | 405 | os_updateResults( r, query, text, cacheKey ); |
— | — | @@ -407,7 +407,7 @@ |
408 | 408 | } |
409 | 409 | |
410 | 410 | /** Fetch results after some timeout */ |
411 | | -function os_delayedFetch() { |
| 411 | +window.os_delayedFetch = function() { |
412 | 412 | if( os_timer == null ) { |
413 | 413 | return; |
414 | 414 | } |
— | — | @@ -444,7 +444,7 @@ |
445 | 445 | } |
446 | 446 | |
447 | 447 | /** Init timed update via os_delayedUpdate() */ |
448 | | -function os_fetchResults( r, query, timeout ) { |
| 448 | +window.os_fetchResults = function( r, query, timeout ) { |
449 | 449 | if( query == '' ) { |
450 | 450 | r.query = ''; |
451 | 451 | os_hideResults( r ); |
— | — | @@ -469,7 +469,7 @@ |
470 | 470 | } |
471 | 471 | |
472 | 472 | /** Find event target */ |
473 | | -function os_getTarget( e ) { |
| 473 | +window.os_getTarget = function( e ) { |
474 | 474 | if ( !e ) { |
475 | 475 | e = window.event; |
476 | 476 | } |
— | — | @@ -483,7 +483,7 @@ |
484 | 484 | } |
485 | 485 | |
486 | 486 | /** Check if x is a valid integer */ |
487 | | -function os_isNumber( x ) { |
| 487 | +window.os_isNumber = function( x ) { |
488 | 488 | if( x == '' || isNaN( x ) ) { |
489 | 489 | return false; |
490 | 490 | } |
— | — | @@ -497,12 +497,12 @@ |
498 | 498 | } |
499 | 499 | |
500 | 500 | /** Call this to enable suggestions on input (id=inputId), on a form (name=formName) */ |
501 | | -function os_enableSuggestionsOn( inputId, formName ) { |
| 501 | +window.os_enableSuggestionsOn = function( inputId, formName ) { |
502 | 502 | os_initHandlers( inputId, formName, document.getElementById( inputId ) ); |
503 | 503 | } |
504 | 504 | |
505 | 505 | /** Call this to disable suggestios on input box (id=inputId) */ |
506 | | -function os_disableSuggestionsOn( inputId ) { |
| 506 | +window.os_disableSuggestionsOn = function( inputId ) { |
507 | 507 | r = os_map[inputId]; |
508 | 508 | if( r != null ) { |
509 | 509 | // cancel/hide results |
— | — | @@ -526,7 +526,7 @@ |
527 | 527 | ************************************************/ |
528 | 528 | |
529 | 529 | /** Event: loss of focus of input box */ |
530 | | -function os_eventBlur( e ) { |
| 530 | +window.os_eventBlur = function( e ) { |
531 | 531 | var targ = os_getTarget( e ); |
532 | 532 | var r = os_map[targ.id]; |
533 | 533 | if( r == null ) { |
— | — | @@ -545,7 +545,7 @@ |
546 | 546 | } |
547 | 547 | |
548 | 548 | /** Event: focus (catch only when stopped) */ |
549 | | -function os_eventFocus( e ) { |
| 549 | +window.os_eventFocus = function( e ) { |
550 | 550 | var targ = os_getTarget( e ); |
551 | 551 | var r = os_map[targ.id]; |
552 | 552 | if( r == null ) { |
— | — | @@ -560,7 +560,7 @@ |
561 | 561 | * @param r os_Result object |
562 | 562 | * @param results Array of the new results to replace existing ones |
563 | 563 | */ |
564 | | -function os_setupDiv( r, results ) { |
| 564 | +window.os_setupDiv = function( r, results ) { |
565 | 565 | var c = document.getElementById( r.container ); |
566 | 566 | if ( c == null ) { |
567 | 567 | c = os_createContainer( r ); |
— | — | @@ -576,7 +576,7 @@ |
577 | 577 | } |
578 | 578 | |
579 | 579 | /** Create the result table to be placed in the container div */ |
580 | | -function os_createResultTable( r, results ) { |
| 580 | +window.os_createResultTable = function( r, results ) { |
581 | 581 | var c = document.getElementById( r.container ); |
582 | 582 | var width = c.offsetWidth - os_operaWidthFix( c.offsetWidth ); |
583 | 583 | var html = '<table class="os-suggest-results" id="' + r.resultTable + '" style="width: ' + width + 'px;">'; |
— | — | @@ -592,7 +592,7 @@ |
593 | 593 | } |
594 | 594 | |
595 | 595 | /** Show results div */ |
596 | | -function os_showResults( r ) { |
| 596 | +window.os_showResults = function( r ) { |
597 | 597 | if( os_is_stopped ) { |
598 | 598 | return; |
599 | 599 | } |
— | — | @@ -609,7 +609,7 @@ |
610 | 610 | } |
611 | 611 | } |
612 | 612 | |
613 | | -function os_operaWidthFix( x ) { |
| 613 | +window.os_operaWidthFix = function( x ) { |
614 | 614 | // For browsers that don't understand overflow-x, estimate scrollbar width |
615 | 615 | if( typeof document.body.style.overflowX != 'string' ) { |
616 | 616 | return 30; |
— | — | @@ -618,7 +618,7 @@ |
619 | 619 | } |
620 | 620 | |
621 | 621 | /** Brower-dependent functions to find window inner size, and scroll status */ |
622 | | -function f_clientWidth() { |
| 622 | +window.f_clientWidth = function() { |
623 | 623 | return f_filterResults( |
624 | 624 | window.innerWidth ? window.innerWidth : 0, |
625 | 625 | document.documentElement ? document.documentElement.clientWidth : 0, |
— | — | @@ -626,7 +626,7 @@ |
627 | 627 | ); |
628 | 628 | } |
629 | 629 | |
630 | | -function f_clientHeight() { |
| 630 | +window.f_clientHeight = function() { |
631 | 631 | return f_filterResults( |
632 | 632 | window.innerHeight ? window.innerHeight : 0, |
633 | 633 | document.documentElement ? document.documentElement.clientHeight : 0, |
— | — | @@ -634,7 +634,7 @@ |
635 | 635 | ); |
636 | 636 | } |
637 | 637 | |
638 | | -function f_scrollLeft() { |
| 638 | +window.f_scrollLeft = function() { |
639 | 639 | return f_filterResults( |
640 | 640 | window.pageXOffset ? window.pageXOffset : 0, |
641 | 641 | document.documentElement ? document.documentElement.scrollLeft : 0, |
— | — | @@ -642,7 +642,7 @@ |
643 | 643 | ); |
644 | 644 | } |
645 | 645 | |
646 | | -function f_scrollTop() { |
| 646 | +window.f_scrollTop = function() { |
647 | 647 | return f_filterResults( |
648 | 648 | window.pageYOffset ? window.pageYOffset : 0, |
649 | 649 | document.documentElement ? document.documentElement.scrollTop : 0, |
— | — | @@ -650,7 +650,7 @@ |
651 | 651 | ); |
652 | 652 | } |
653 | 653 | |
654 | | -function f_filterResults( n_win, n_docel, n_body ) { |
| 654 | +window.f_filterResults = function( n_win, n_docel, n_body ) { |
655 | 655 | var n_result = n_win ? n_win : 0; |
656 | 656 | if ( n_docel && ( !n_result || ( n_result > n_docel ) ) ) { |
657 | 657 | n_result = n_docel; |
— | — | @@ -659,7 +659,7 @@ |
660 | 660 | } |
661 | 661 | |
662 | 662 | /** Get the height available for the results container */ |
663 | | -function os_availableHeight( r ) { |
| 663 | +window.os_availableHeight = function( r ) { |
664 | 664 | var absTop = document.getElementById( r.container ).style.top; |
665 | 665 | var px = absTop.lastIndexOf( 'px' ); |
666 | 666 | if( px > 0 ) { |
— | — | @@ -669,7 +669,7 @@ |
670 | 670 | } |
671 | 671 | |
672 | 672 | /** Get element absolute position {left,top} */ |
673 | | -function os_getElementPosition( elemID ) { |
| 673 | +window.os_getElementPosition = function( elemID ) { |
674 | 674 | var offsetTrail = document.getElementById( elemID ); |
675 | 675 | var offsetLeft = 0; |
676 | 676 | var offsetTop = 0; |
— | — | @@ -686,7 +686,7 @@ |
687 | 687 | } |
688 | 688 | |
689 | 689 | /** Create the container div that will hold the suggested titles */ |
690 | | -function os_createContainer( r ) { |
| 690 | +window.os_createContainer = function( r ) { |
691 | 691 | var c = document.createElement( 'div' ); |
692 | 692 | var s = document.getElementById( r.searchbox ); |
693 | 693 | var pos = os_getElementPosition( r.searchbox ); |
— | — | @@ -712,7 +712,7 @@ |
713 | 713 | } |
714 | 714 | |
715 | 715 | /** change container height to fit to screen */ |
716 | | -function os_fitContainer( r ) { |
| 716 | +window.os_fitContainer = function( r ) { |
717 | 717 | var c = document.getElementById( r.container ); |
718 | 718 | var h = os_availableHeight( r ) - 20; |
719 | 719 | var inc = r.containerRow; |
— | — | @@ -733,7 +733,7 @@ |
734 | 734 | } |
735 | 735 | |
736 | 736 | /** If some entries are longer than the box, replace text with "..." */ |
737 | | -function os_trimResultText( r ) { |
| 737 | +window.os_trimResultText = function( r ) { |
738 | 738 | // find max width, first see if we could expand the container to fit it |
739 | 739 | var maxW = 0; |
740 | 740 | for( var i = 0; i < r.resultCount; i++ ) { |
— | — | @@ -799,7 +799,7 @@ |
800 | 800 | } |
801 | 801 | |
802 | 802 | /** Invoked on timer to animate change in container width */ |
803 | | -function os_animateChangeWidth() { |
| 803 | +window.os_animateChangeWidth = function() { |
804 | 804 | var r = os_animation_timer.r; |
805 | 805 | var c = document.getElementById( r.container ); |
806 | 806 | var w = c.offsetWidth; |
— | — | @@ -823,7 +823,7 @@ |
824 | 824 | } |
825 | 825 | |
826 | 826 | /** Change the highlighted row (i.e. suggestion), from position cur to next */ |
827 | | -function os_changeHighlight( r, cur, next, updateSearchBox ) { |
| 827 | +window.os_changeHighlight = function( r, cur, next, updateSearchBox ) { |
828 | 828 | if ( next >= r.resultCount ) { |
829 | 829 | next = r.resultCount - 1; |
830 | 830 | } |
— | — | @@ -870,7 +870,7 @@ |
871 | 871 | } |
872 | 872 | } |
873 | 873 | |
874 | | -function os_HighlightClass() { |
| 874 | +window.os_HighlightClass = function() { |
875 | 875 | var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/); |
876 | 876 | if ( match ) { |
877 | 877 | var webKitVersion = parseInt( match[1] ); |
— | — | @@ -884,7 +884,7 @@ |
885 | 885 | return 'os-suggest-result-hl'; |
886 | 886 | } |
887 | 887 | |
888 | | -function os_updateSearchQuery( r, newText ) { |
| 888 | +window.os_updateSearchQuery = function( r, newText ) { |
889 | 889 | document.getElementById( r.searchbox ).value = newText; |
890 | 890 | r.query = newText; |
891 | 891 | } |
— | — | @@ -895,7 +895,7 @@ |
896 | 896 | ********************/ |
897 | 897 | |
898 | 898 | /** Mouse over the container */ |
899 | | -function os_eventMouseover( srcId, e ) { |
| 899 | +window.os_eventMouseover = function( srcId, e ) { |
900 | 900 | var targ = os_getTarget( e ); |
901 | 901 | var r = os_map[srcId]; |
902 | 902 | if( r == null || !os_mouse_moved ) { |
— | — | @@ -908,7 +908,7 @@ |
909 | 909 | } |
910 | 910 | |
911 | 911 | /* Get row where the event occured (from its id) */ |
912 | | -function os_getNumberSuffix( id ) { |
| 912 | +window.os_getNumberSuffix = function( id ) { |
913 | 913 | var num = id.substring( id.length - 2 ); |
914 | 914 | if( !( num.charAt( 0 ) >= '0' && num.charAt( 0 ) <= '9' ) ) { |
915 | 915 | num = num.substring( 1 ); |
— | — | @@ -921,12 +921,12 @@ |
922 | 922 | } |
923 | 923 | |
924 | 924 | /** Save mouse move as last action */ |
925 | | -function os_eventMousemove( srcId, e ) { |
| 925 | +window.os_eventMousemove = function( srcId, e ) { |
926 | 926 | os_mouse_moved = true; |
927 | 927 | } |
928 | 928 | |
929 | 929 | /** Mouse button held down, register possible click */ |
930 | | -function os_eventMousedown( srcId, e ) { |
| 930 | +window.os_eventMousedown = function( srcId, e ) { |
931 | 931 | var targ = os_getTarget( e ); |
932 | 932 | var r = os_map[srcId]; |
933 | 933 | if( r == null ) { |
— | — | @@ -946,7 +946,7 @@ |
947 | 947 | } |
948 | 948 | |
949 | 949 | /** Mouse button released, check for click on some row */ |
950 | | -function os_eventMouseup( srcId, e ) { |
| 950 | +window.os_eventMouseup = function( srcId, e ) { |
951 | 951 | var targ = os_getTarget( e ); |
952 | 952 | var r = os_map[srcId]; |
953 | 953 | if( r == null ) { |
— | — | @@ -967,7 +967,7 @@ |
968 | 968 | /** Toggle stuff seems to be dead code? */ |
969 | 969 | |
970 | 970 | /** Return the span element that contains the toggle link */ |
971 | | -function os_createToggle( r, className ) { |
| 971 | +window.os_createToggle = function( r, className ) { |
972 | 972 | var t = document.createElement( 'span' ); |
973 | 973 | t.className = className; |
974 | 974 | t.setAttribute( 'id', r.toggle ); |
— | — | @@ -981,7 +981,7 @@ |
982 | 982 | } |
983 | 983 | |
984 | 984 | /** Call when user clicks on some of the toggle links */ |
985 | | -function os_toggle( inputId, formName ) { |
| 985 | +window.os_toggle = function( inputId, formName ) { |
986 | 986 | r = os_map[inputId]; |
987 | 987 | var msg = ''; |
988 | 988 | if( r == null ) { |
Index: branches/resourceloader/phase3/skins/common/edit.js |
— | — | @@ -1,7 +1,7 @@ |
2 | | -var currentFocused; |
| 2 | +window.currentFocused; |
3 | 3 | |
4 | 4 | // this function adds a toolbar button to the mwEditButtons list |
5 | | -function addButton( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId ) { |
| 5 | +window.addButton = function( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId ) { |
6 | 6 | // Don't generate buttons for browsers which don't fully |
7 | 7 | // support it. |
8 | 8 | mwEditButtons.push({ |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | } |
17 | 17 | |
18 | 18 | // this function adds one toolbar button from a mwEditButtons/mwCustomEditButtons item |
19 | | -function mwInsertEditButton( parent, item ) { |
| 19 | +window.mwInsertEditButton = function( parent, item ) { |
20 | 20 | var image = document.createElement( 'img' ); |
21 | 21 | image.width = 23; |
22 | 22 | image.height = 22; |
— | — | @@ -31,8 +31,8 @@ |
32 | 32 | image.onclick = function() { |
33 | 33 | insertTags( item.tagOpen, item.tagClose, item.sampleText ); |
34 | 34 | // click tracking |
35 | | - if ( ( typeof $j != 'undefined' ) && ( typeof $j.trackAction != 'undefined' ) ) { |
36 | | - $j.trackAction( 'oldedit.' + item.speedTip.replace(/ /g, "-") ); |
| 35 | + if ( ( typeof $ != 'undefined' ) && ( typeof $.trackAction != 'undefined' ) ) { |
| 36 | + $.trackAction( 'oldedit.' + item.speedTip.replace(/ /g, "-") ); |
37 | 37 | } |
38 | 38 | return false; |
39 | 39 | }; |
— | — | @@ -43,7 +43,7 @@ |
44 | 44 | |
45 | 45 | // this function generates the actual toolbar buttons with localized text |
46 | 46 | // we use it to avoid creating the toolbar where javascript is not enabled |
47 | | -function mwSetupToolbar() { |
| 47 | +window.mwSetupToolbar = function() { |
48 | 48 | var toolbar = document.getElementById( 'toolbar' ); |
49 | 49 | if ( !toolbar ) { |
50 | 50 | return false; |
— | — | @@ -77,10 +77,10 @@ |
78 | 78 | |
79 | 79 | // apply tagOpen/tagClose to selection in textarea, |
80 | 80 | // use sampleText instead of selection if there is none |
81 | | -function insertTags( tagOpen, tagClose, sampleText ) { |
82 | | - if ( typeof $j != 'undefined' && typeof $j.fn.textSelection != 'undefined' && |
| 81 | +window.insertTags = function( tagOpen, tagClose, sampleText ) { |
| 82 | + if ( typeof $ != 'undefined' && typeof $.fn.textSelection != 'undefined' && |
83 | 83 | ( currentFocused.nodeName.toLowerCase() == 'iframe' || currentFocused.id == 'wpTextbox1' ) ) { |
84 | | - $j( '#wpTextbox1' ).textSelection( |
| 84 | + $( '#wpTextbox1' ).textSelection( |
85 | 85 | 'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose } |
86 | 86 | ); |
87 | 87 | return; |
— | — | @@ -166,7 +166,7 @@ |
167 | 167 | * Restore the edit box scroll state following a preview operation, |
168 | 168 | * and set up a form submission handler to remember this state |
169 | 169 | */ |
170 | | -function scrollEditBox() { |
| 170 | +window.scrollEditBox = function() { |
171 | 171 | var editBox = document.getElementById( 'wpTextbox1' ); |
172 | 172 | var scrollTop = document.getElementById( 'wpScrolltop' ); |
173 | 173 | var editForm = document.getElementById( 'editform' ); |
— | — | @@ -217,10 +217,10 @@ |
218 | 218 | |
219 | 219 | // HACK: make currentFocused work with the usability iframe |
220 | 220 | // With proper focus detection support (HTML 5!) this'll be much cleaner |
221 | | - if ( typeof $j != 'undefined' ) { |
222 | | - var iframe = $j( '.wikiEditor-ui-text iframe' ); |
| 221 | + if ( typeof $ != 'undefined' ) { |
| 222 | + var iframe = $( '.wikiEditor-ui-text iframe' ); |
223 | 223 | if ( iframe.length > 0 ) { |
224 | | - $j( iframe.get( 0 ).contentWindow.document ) |
| 224 | + $( iframe.get( 0 ).contentWindow.document ) |
225 | 225 | .add( iframe.get( 0 ).contentWindow.document.body ) // for IE |
226 | 226 | .focus( function() { currentFocused = iframe.get( 0 ); } ); |
227 | 227 | } |
Index: branches/resourceloader/phase3/skins/common/wikibits.js |
— | — | @@ -1,39 +1,39 @@ |
2 | 2 | // MediaWiki JavaScript support functions |
3 | 3 | |
4 | | -var clientPC = navigator.userAgent.toLowerCase(); // Get client info |
5 | | -var is_gecko = /gecko/.test( clientPC ) && |
| 4 | +window.clientPC = navigator.userAgent.toLowerCase(); // Get client info |
| 5 | +window.is_gecko = /gecko/.test( clientPC ) && |
6 | 6 | !/khtml|spoofer|netscape\/7\.0/.test(clientPC); |
7 | | -var webkit_match = clientPC.match(/applewebkit\/(\d+)/); |
| 7 | +window.webkit_match = clientPC.match(/applewebkit\/(\d+)/); |
8 | 8 | if (webkit_match) { |
9 | | - var is_safari = clientPC.indexOf('applewebkit') != -1 && |
| 9 | + window.is_safari = clientPC.indexOf('applewebkit') != -1 && |
10 | 10 | clientPC.indexOf('spoofer') == -1; |
11 | | - var is_safari_win = is_safari && clientPC.indexOf('windows') != -1; |
12 | | - var webkit_version = parseInt(webkit_match[1]); |
| 11 | + window.is_safari_win = is_safari && clientPC.indexOf('windows') != -1; |
| 12 | + window.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 |
15 | | - var is_chrome = clientPC.indexOf('chrome') !== -1 && |
| 15 | + window.is_chrome = clientPC.indexOf('chrome') !== -1 && |
16 | 16 | clientPC.indexOf('spoofer') === -1; |
17 | | - var is_chrome_mac = is_chrome && clientPC.indexOf('mac') !== -1 |
| 17 | + window.is_chrome_mac = is_chrome && clientPC.indexOf('mac') !== -1 |
18 | 18 | } |
19 | 19 | // For accesskeys; note that FF3+ is included here! |
20 | | -var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC ); |
21 | | -var ff2_bugs = /firefox\/2/.test( clientPC ); |
| 20 | +window.is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC ); |
| 21 | +window.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; |
| 23 | +window.is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1; |
| 24 | +window.is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1; |
25 | 25 | if (clientPC.indexOf('opera') != -1) { |
26 | | - var is_opera = true; |
27 | | - var is_opera_preseven = window.opera && !document.childNodes; |
28 | | - var is_opera_seven = window.opera && document.childNodes; |
29 | | - var is_opera_95 = /opera\/(9\.[5-9]|[1-9][0-9])/.test( clientPC ); |
30 | | - var opera6_bugs = is_opera_preseven; |
31 | | - var opera7_bugs = is_opera_seven && !is_opera_95; |
32 | | - var opera95_bugs = /opera\/(9\.5)/.test( clientPC ); |
| 26 | + window.is_opera = true; |
| 27 | + window.is_opera_preseven = window.opera && !document.childNodes; |
| 28 | + window.is_opera_seven = window.opera && document.childNodes; |
| 29 | + window.is_opera_95 = /opera\/(9\.[5-9]|[1-9][0-9])/.test( clientPC ); |
| 30 | + window.opera6_bugs = is_opera_preseven; |
| 31 | + window.opera7_bugs = is_opera_seven && !is_opera_95; |
| 32 | + window.opera95_bugs = /opera\/(9\.5)/.test( clientPC ); |
33 | 33 | } |
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 = false; |
| 37 | +window.ie6_bugs = false; |
38 | 38 | if ( /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec( clientPC ) != null |
39 | 39 | && parseFloat( RegExp.$1 ) <= 6.0 ) { |
40 | 40 | ie6_bugs = true; |
— | — | @@ -43,13 +43,13 @@ |
44 | 44 | /*extern ta, stylepath, skin */ |
45 | 45 | |
46 | 46 | // add any onload functions in this hook (please don't hard-code any events in the xhtml source) |
47 | | -var doneOnloadHook; |
| 47 | +window.doneOnloadHook; |
48 | 48 | |
49 | 49 | if (!window.onloadFuncts) { |
50 | | - var onloadFuncts = []; |
| 50 | + window.onloadFuncts = []; |
51 | 51 | } |
52 | 52 | |
53 | | -function addOnloadHook( hookFunct ) { |
| 53 | +window.addOnloadHook = function( hookFunct ) { |
54 | 54 | // Allows add-on scripts to add onload functions |
55 | 55 | if( !doneOnloadHook ) { |
56 | 56 | onloadFuncts[onloadFuncts.length] = hookFunct; |
— | — | @@ -58,11 +58,11 @@ |
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | | -function hookEvent( hookName, hookFunct ) { |
| 62 | +window.hookEvent = function( hookName, hookFunct ) { |
63 | 63 | addHandler( window, hookName, hookFunct ); |
64 | 64 | } |
65 | 65 | |
66 | | -function importScript( page ) { |
| 66 | +window.importScript = function( page ) { |
67 | 67 | // TODO: might want to introduce a utility function to match wfUrlencode() in PHP |
68 | 68 | var uri = wgScript + '?title=' + |
69 | 69 | encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') + |
— | — | @@ -70,8 +70,8 @@ |
71 | 71 | return importScriptURI( uri ); |
72 | 72 | } |
73 | 73 | |
74 | | -var loadedScripts = {}; // included-scripts tracker |
75 | | -function importScriptURI( url ) { |
| 74 | +window.loadedScripts = {}; // included-scripts tracker |
| 75 | +window.importScriptURI = function( url ) { |
76 | 76 | if ( loadedScripts[url] ) { |
77 | 77 | return null; |
78 | 78 | } |
— | — | @@ -83,11 +83,11 @@ |
84 | 84 | return s; |
85 | 85 | } |
86 | 86 | |
87 | | -function importStylesheet( page ) { |
| 87 | +window.importStylesheet = function( page ) { |
88 | 88 | return importStylesheetURI( wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent( page.replace(/ /g,'_') ) ); |
89 | 89 | } |
90 | 90 | |
91 | | -function importStylesheetURI( url, media ) { |
| 91 | +window.importStylesheetURI = function( url, media ) { |
92 | 92 | var l = document.createElement( 'link' ); |
93 | 93 | l.type = 'text/css'; |
94 | 94 | l.rel = 'stylesheet'; |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | return l; |
101 | 101 | } |
102 | 102 | |
103 | | -function appendCSS( text ) { |
| 103 | +window.appendCSS = function( text ) { |
104 | 104 | var s = document.createElement( 'style' ); |
105 | 105 | s.type = 'text/css'; |
106 | 106 | s.rel = 'stylesheet'; |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | | -function showTocToggle() { |
| 137 | +window.showTocToggle = function() { |
138 | 138 | if ( document.createTextNode ) { |
139 | 139 | // Uses DOM calls to avoid document.write + XHTML issues |
140 | 140 | |
— | — | @@ -169,7 +169,7 @@ |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | | -function changeText( el, newText ) { |
| 173 | +window.changeText = function( el, newText ) { |
174 | 174 | // Safari work around |
175 | 175 | if ( el.innerText ) { |
176 | 176 | el.innerText = newText; |
— | — | @@ -178,7 +178,7 @@ |
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | | -function killEvt( evt ) { |
| 182 | +window.killEvt = function( evt ) { |
183 | 183 | evt = evt || window.event || window.Event; // W3C, IE, Netscape |
184 | 184 | if ( typeof ( evt.preventDefault ) != 'undefined' ) { |
185 | 185 | evt.preventDefault(); // Don't follow the link |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | return false; // Don't follow the link (IE) |
191 | 191 | } |
192 | 192 | |
193 | | -function toggleToc() { |
| 193 | +window.toggleToc = function() { |
194 | 194 | var tocmain = document.getElementById( 'toc' ); |
195 | 195 | var toc = document.getElementById('toc').getElementsByTagName('ul')[0]; |
196 | 196 | var toggleLink = document.getElementById( 'togglelink' ); |
— | — | @@ -208,10 +208,10 @@ |
209 | 209 | return false; |
210 | 210 | } |
211 | 211 | |
212 | | -var mwEditButtons = []; |
213 | | -var mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js |
| 212 | +window.mwEditButtons = []; |
| 213 | +window.mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js |
214 | 214 | |
215 | | -function escapeQuotes( text ) { |
| 215 | +window.escapeQuotes = function( text ) { |
216 | 216 | var re = new RegExp( "'", "g" ); |
217 | 217 | text = text.replace( re, "\\'" ); |
218 | 218 | re = new RegExp( "\\n", "g" ); |
— | — | @@ -219,7 +219,7 @@ |
220 | 220 | return escapeQuotesHTML( text ); |
221 | 221 | } |
222 | 222 | |
223 | | -function escapeQuotesHTML( text ) { |
| 223 | +window.escapeQuotesHTML = function( text ) { |
224 | 224 | var re = new RegExp( '&', "g" ); |
225 | 225 | text = text.replace( re, "&" ); |
226 | 226 | re = new RegExp( '"', "g" ); |
— | — | @@ -234,7 +234,7 @@ |
235 | 235 | /** |
236 | 236 | * Set the accesskey prefix based on browser detection. |
237 | 237 | */ |
238 | | -var tooltipAccessKeyPrefix = 'alt-'; |
| 238 | +window.tooltipAccessKeyPrefix = 'alt-'; |
239 | 239 | if ( is_opera ) { |
240 | 240 | tooltipAccessKeyPrefix = 'shift-esc-'; |
241 | 241 | } else if ( is_chrome ) { |
— | — | @@ -248,7 +248,7 @@ |
249 | 249 | } else if ( is_ff2 ) { |
250 | 250 | tooltipAccessKeyPrefix = 'alt-shift-'; |
251 | 251 | } |
252 | | -var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?(.)\]$/; |
| 252 | +window.tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?(.)\]$/; |
253 | 253 | |
254 | 254 | /** |
255 | 255 | * Add the appropriate prefix to the accesskey shown in the tooltip. |
— | — | @@ -258,7 +258,7 @@ |
259 | 259 | * |
260 | 260 | * @param Array nodeList -- list of elements to update |
261 | 261 | */ |
262 | | -function updateTooltipAccessKeys( nodeList ) { |
| 262 | +window.updateTooltipAccessKeys = function( nodeList ) { |
263 | 263 | if ( !nodeList ) { |
264 | 264 | // Rather than scan all links on the whole page, we can just scan these |
265 | 265 | // containers which contain the relevant links. This is really just an |
— | — | @@ -318,7 +318,7 @@ |
319 | 319 | * |
320 | 320 | * @return Node -- the DOM node of the new item (an LI element) or null |
321 | 321 | */ |
322 | | -function addPortletLink( portlet, href, text, id, tooltip, accesskey, nextnode ) { |
| 322 | +window.addPortletLink = function( portlet, href, text, id, tooltip, accesskey, nextnode ) { |
323 | 323 | var root = document.getElementById( portlet ); |
324 | 324 | if ( !root ) { |
325 | 325 | return null; |
— | — | @@ -382,7 +382,7 @@ |
383 | 383 | return item; |
384 | 384 | } |
385 | 385 | |
386 | | -function getInnerText( el ) { |
| 386 | +window.getInnerText = function( el ) { |
387 | 387 | if ( typeof el == 'string' ) { |
388 | 388 | return el; |
389 | 389 | } |
— | — | @@ -414,20 +414,20 @@ |
415 | 415 | |
416 | 416 | /* Dummy for deprecated function */ |
417 | 417 | window.ta = []; |
418 | | -function akeytt( doId ) { |
| 418 | +window.akeytt = function( doId ) { |
419 | 419 | } |
420 | 420 | |
421 | | -var checkboxes; |
422 | | -var lastCheckbox; |
| 421 | +window.checkboxes; |
| 422 | +window.lastCheckbox; |
423 | 423 | |
424 | | -function setupCheckboxShiftClick() { |
| 424 | +window.setupCheckboxShiftClick = function() { |
425 | 425 | checkboxes = []; |
426 | 426 | lastCheckbox = null; |
427 | 427 | var inputs = document.getElementsByTagName( 'input' ); |
428 | 428 | addCheckboxClickHandlers( inputs ); |
429 | 429 | } |
430 | 430 | |
431 | | -function addCheckboxClickHandlers( inputs, start ) { |
| 431 | +window.addCheckboxClickHandlers = function( inputs, start ) { |
432 | 432 | if ( !start ) { |
433 | 433 | start = 0; |
434 | 434 | } |
— | — | @@ -455,7 +455,7 @@ |
456 | 456 | } |
457 | 457 | } |
458 | 458 | |
459 | | -function checkboxClickHandler( e ) { |
| 459 | +window.checkboxClickHandler = function( e ) { |
460 | 460 | if ( typeof e == 'undefined' ) { |
461 | 461 | e = window.event; |
462 | 462 | } |
— | — | @@ -489,7 +489,7 @@ |
490 | 490 | Author says "The credit comment is all it takes, no license. Go crazy with it!:-)" |
491 | 491 | From http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/ |
492 | 492 | */ |
493 | | -function getElementsByClassName( oElm, strTagName, oClassNames ) { |
| 493 | +window.getElementsByClassName = function( oElm, strTagName, oClassNames ) { |
494 | 494 | var arrReturnElements = new Array(); |
495 | 495 | if ( typeof( oElm.getElementsByClassName ) == 'function' ) { |
496 | 496 | /* Use a native implementation where possible FF3, Saf3.2, Opera 9.5 */ |
— | — | @@ -533,7 +533,7 @@ |
534 | 534 | return ( arrReturnElements ); |
535 | 535 | } |
536 | 536 | |
537 | | -function redirectToFragment( fragment ) { |
| 537 | +window.redirectToFragment = function( fragment ) { |
538 | 538 | var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/); |
539 | 539 | if ( match ) { |
540 | 540 | var webKitVersion = parseInt( match[1] ); |
— | — | @@ -573,16 +573,16 @@ |
574 | 574 | * @todo support all accepted date formats (bug 8226) |
575 | 575 | */ |
576 | 576 | |
577 | | -var ts_image_path = stylepath + '/common/images/'; |
578 | | -var ts_image_up = 'sort_up.gif'; |
579 | | -var ts_image_down = 'sort_down.gif'; |
580 | | -var ts_image_none = 'sort_none.gif'; |
581 | | -var ts_europeandate = wgContentLanguage != 'en'; // The non-American-inclined can change to "true" |
582 | | -var ts_alternate_row_colors = false; |
583 | | -var ts_number_transform_table = null; |
584 | | -var ts_number_regex = null; |
| 577 | +window.ts_image_path = stylepath + '/common/images/'; |
| 578 | +window.ts_image_up = 'sort_up.gif'; |
| 579 | +window.ts_image_down = 'sort_down.gif'; |
| 580 | +window.ts_image_none = 'sort_none.gif'; |
| 581 | +window.ts_europeandate = wgContentLanguage != 'en'; // The non-American-inclined can change to "true" |
| 582 | +window.ts_alternate_row_colors = false; |
| 583 | +window.ts_number_transform_table = null; |
| 584 | +window.ts_number_regex = null; |
585 | 585 | |
586 | | -function sortables_init() { |
| 586 | +window.sortables_init = function() { |
587 | 587 | var idnum = 0; |
588 | 588 | // Find all tables with class sortable and make them sortable |
589 | 589 | var tables = getElementsByClassName( document, 'table', 'sortable' ); |
— | — | @@ -595,7 +595,7 @@ |
596 | 596 | } |
597 | 597 | } |
598 | 598 | |
599 | | -function ts_makeSortable( table ) { |
| 599 | +window.ts_makeSortable = function( table ) { |
600 | 600 | var firstRow; |
601 | 601 | if ( table.rows && table.rows.length > 0 ) { |
602 | 602 | if ( table.tHead && table.tHead.rows.length > 0 ) { |
— | — | @@ -626,11 +626,11 @@ |
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
630 | | -function ts_getInnerText( el ) { |
| 630 | +window.ts_getInnerText = function( el ) { |
631 | 631 | return getInnerText( el ); |
632 | 632 | } |
633 | 633 | |
634 | | -function ts_resortTable( lnk ) { |
| 634 | +window.ts_resortTable = function( lnk ) { |
635 | 635 | // get the span |
636 | 636 | var span = lnk.getElementsByTagName('span')[0]; |
637 | 637 | |
— | — | @@ -757,7 +757,7 @@ |
758 | 758 | } |
759 | 759 | } |
760 | 760 | |
761 | | -function ts_initTransformTable() { |
| 761 | +window.ts_initTransformTable = function() { |
762 | 762 | if ( typeof wgSeparatorTransformTable == 'undefined' |
763 | 763 | || ( wgSeparatorTransformTable[0] == '' && wgDigitTransformTable[2] == '' ) ) |
764 | 764 | { |
— | — | @@ -810,11 +810,11 @@ |
811 | 811 | ); |
812 | 812 | } |
813 | 813 | |
814 | | -function ts_toLowerCase( s ) { |
| 814 | +window.ts_toLowerCase = function( s ) { |
815 | 815 | return s.toLowerCase(); |
816 | 816 | } |
817 | 817 | |
818 | | -function ts_dateToSortKey( date ) { |
| 818 | +window.ts_dateToSortKey = function( date ) { |
819 | 819 | // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX |
820 | 820 | if ( date.length == 11 ) { |
821 | 821 | switch ( date.substr( 3, 3 ).toLowerCase() ) { |
— | — | @@ -879,7 +879,7 @@ |
880 | 880 | return '00000000'; |
881 | 881 | } |
882 | 882 | |
883 | | -function ts_parseFloat( s ) { |
| 883 | +window.ts_parseFloat = function( s ) { |
884 | 884 | if ( !s ) { |
885 | 885 | return 0; |
886 | 886 | } |
— | — | @@ -900,15 +900,15 @@ |
901 | 901 | return ( isNaN( num ) ? -Infinity : num ); |
902 | 902 | } |
903 | 903 | |
904 | | -function ts_currencyToSortKey( s ) { |
| 904 | +window.ts_currencyToSortKey = function( s ) { |
905 | 905 | return ts_parseFloat(s.replace(/[^-\u22120-9.,]/g,'')); |
906 | 906 | } |
907 | 907 | |
908 | | -function ts_sort_generic( a, b ) { |
| 908 | +window.ts_sort_generic = function( a, b ) { |
909 | 909 | return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : a[2] - b[2]; |
910 | 910 | } |
911 | 911 | |
912 | | -function ts_alternate( table ) { |
| 912 | +window.ts_alternate = function( table ) { |
913 | 913 | // Take object table and get all it's tbodies. |
914 | 914 | var tableBodies = table.getElementsByTagName( 'tbody' ); |
915 | 915 | // Loop through these tbodies |
— | — | @@ -945,7 +945,7 @@ |
946 | 946 | * call to allow CSS/JS to hide different boxes. null = no class used. |
947 | 947 | * @return Boolean True on success, false on failure |
948 | 948 | */ |
949 | | -function jsMsg( message, className ) { |
| 949 | +window.jsMsg = function( message, className ) { |
950 | 950 | if ( !document.getElementById ) { |
951 | 951 | return false; |
952 | 952 | } |
— | — | @@ -997,7 +997,7 @@ |
998 | 998 | * @param element Element to inject after |
999 | 999 | * @param id Identifier string (for use with removeSpinner(), below) |
1000 | 1000 | */ |
1001 | | -function injectSpinner( element, id ) { |
| 1001 | +window.injectSpinner = function( element, id ) { |
1002 | 1002 | var spinner = document.createElement( 'img' ); |
1003 | 1003 | spinner.id = 'mw-spinner-' + id; |
1004 | 1004 | spinner.src = stylepath + '/common/images/spinner.gif'; |
— | — | @@ -1014,14 +1014,14 @@ |
1015 | 1015 | * |
1016 | 1016 | * @param id Identifier string |
1017 | 1017 | */ |
1018 | | -function removeSpinner( id ) { |
| 1018 | +window.removeSpinner = function( id ) { |
1019 | 1019 | var spinner = document.getElementById( 'mw-spinner-' + id ); |
1020 | 1020 | if( spinner ) { |
1021 | 1021 | spinner.parentNode.removeChild( spinner ); |
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | |
1025 | | -function runOnloadHook() { |
| 1025 | +window.runOnloadHook = function() { |
1026 | 1026 | // don't run anything below this for non-dom browsers |
1027 | 1027 | if ( doneOnloadHook || !( document.getElementById && document.getElementsByTagName ) ) { |
1028 | 1028 | return; |
— | — | @@ -1048,7 +1048,7 @@ |
1049 | 1049 | * @param String attach Event to attach to |
1050 | 1050 | * @param callable handler Event handler callback |
1051 | 1051 | */ |
1052 | | -function addHandler( element, attach, handler ) { |
| 1052 | +window.addHandler = function( element, attach, handler ) { |
1053 | 1053 | if( window.addEventListener ) { |
1054 | 1054 | element.addEventListener( attach, handler, false ); |
1055 | 1055 | } else if( window.attachEvent ) { |
— | — | @@ -1062,7 +1062,7 @@ |
1063 | 1063 | * @param Element element Element to add handler to |
1064 | 1064 | * @param callable handler Event handler callback |
1065 | 1065 | */ |
1066 | | -function addClickHandler( element, handler ) { |
| 1066 | +window.addClickHandler = function( element, handler ) { |
1067 | 1067 | addHandler( element, 'click', handler ); |
1068 | 1068 | } |
1069 | 1069 | |
— | — | @@ -1073,7 +1073,7 @@ |
1074 | 1074 | * @param String remove Event to remove |
1075 | 1075 | * @param callable handler Event handler callback to remove |
1076 | 1076 | */ |
1077 | | -function removeHandler( element, remove, handler ) { |
| 1077 | +window.removeHandler = function( element, remove, handler ) { |
1078 | 1078 | if( window.removeEventListener ) { |
1079 | 1079 | element.removeEventListener( remove, handler, false ); |
1080 | 1080 | } else if( window.detachEvent ) { |
— | — | @@ -1086,9 +1086,4 @@ |
1087 | 1087 | |
1088 | 1088 | if ( ie6_bugs ) { |
1089 | 1089 | importScriptURI( stylepath + '/common/IEFixes.js' ); |
1090 | | -} |
1091 | | - |
1092 | | -// For future use. |
1093 | | -mw = {}; |
1094 | | - |
1095 | | - |
| 1090 | +} |
\ No newline at end of file |
Index: branches/resourceloader/phase3/skins/common/htmlform.js |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | } |
14 | 14 | } ); |
15 | 15 | |
16 | | -var htmlforms = { |
| 16 | +window.htmlforms = { |
17 | 17 | 'selectOrOtherSelectChanged' : function( e ) { |
18 | 18 | var select; |
19 | 19 | if ( !e ) { |
Index: branches/resourceloader/phase3/skins/common/history.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -function historyRadios(parent) { |
| 2 | +window.historyRadios = function(parent) { |
3 | 3 | var inputs = parent.getElementsByTagName('input'); |
4 | 4 | var radios = []; |
5 | 5 | for (var i = 0; i < inputs.length; i++) { |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | } |
12 | 12 | |
13 | 13 | // check selection and tweak visibility/class onclick |
14 | | -function diffcheck() { |
| 14 | +window.diffcheck = function() { |
15 | 15 | var dli = false; // the li where the diff radio is checked |
16 | 16 | var oli = false; // the li where the oldid radio is checked |
17 | 17 | var hf = document.getElementById('pagehistory'); |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | } |
79 | 79 | |
80 | 80 | // Attach event handlers to the input elements on history page |
81 | | -function histrowinit() { |
| 81 | +window.histrowinit = function() { |
82 | 82 | var hf = document.getElementById('pagehistory'); |
83 | 83 | if (!hf) return; |
84 | 84 | var lis = hf.getElementsByTagName('li'); |