Index: trunk/phase3/skins/common/search.js |
— | — | @@ -1,40 +1,45 @@ |
2 | 2 | // JS specific to Special:Search |
3 | 3 | |
4 | 4 | // change the search link to what user entered |
5 | | -function mwSearchHeaderClick(obj){ |
6 | | - var searchbox = document.getElementById("searchText"); |
7 | | - if( searchbox == null ) |
8 | | - searchbox = document.getElementById("powerSearchText"); |
9 | | - if( searchbox == null) |
| 5 | +function mwSearchHeaderClick( obj ) { |
| 6 | + var searchbox = document.getElementById( 'searchText' ); |
| 7 | + if( searchbox === null ) { |
| 8 | + searchbox = document.getElementById( 'powerSearchText' ); |
| 9 | + } |
| 10 | + if( searchbox === null ) { |
10 | 11 | return; // should always have either normal or advanced search |
11 | | - |
| 12 | + } |
| 13 | + |
12 | 14 | var searchterm = searchbox.value; |
13 | | - var parts = obj.href.split("search="); |
| 15 | + var parts = obj.href.split( 'search=' ); |
14 | 16 | var lastpart = ''; |
15 | | - var prefix = "search="; |
16 | | - if( parts.length > 1 && parts[1].indexOf('&') >= 0 ) |
17 | | - lastpart = parts[1].substring( parts[1].indexOf('&') ) |
18 | | - else |
19 | | - prefix = "&search="; |
20 | | - obj.href = parts[0] + prefix + encodeURIComponent(searchterm) + lastpart; |
| 17 | + var prefix = 'search='; |
| 18 | + if( parts.length > 1 && parts[1].indexOf('&') >= 0 ) { |
| 19 | + lastpart = parts[1].substring( parts[1].indexOf('&') ); |
| 20 | + } else { |
| 21 | + prefix = '&search='; |
| 22 | + } |
| 23 | + obj.href = parts[0] + prefix + encodeURIComponent( searchterm ) + lastpart; |
21 | 24 | } |
22 | 25 | |
23 | 26 | function mwToggleSearchCheckboxes( btn ) { |
24 | | - if( !document.getElementById ) return; |
25 | | - |
| 27 | + if( !document.getElementById ) { |
| 28 | + return; |
| 29 | + } |
| 30 | + |
26 | 31 | var nsInputs = document.getElementById( 'powersearch' ).getElementsByTagName( 'input' ); |
27 | 32 | var isChecked = false; |
28 | | - |
| 33 | + |
29 | 34 | for ( var i = 0; i < nsInputs.length; i++ ) { |
30 | 35 | var pattern = /^ns/; |
31 | 36 | if ( ( nsInputs[i].type == 'checkbox' ) && ( pattern.test( nsInputs[i].name ) ) ) { |
32 | 37 | switch ( btn ) { |
33 | | - case "none": |
| 38 | + case 'none': |
34 | 39 | if ( nsInputs[i].checked ) { |
35 | 40 | nsInputs[i].checked = false; |
36 | 41 | } |
37 | 42 | break; |
38 | | - case "all": |
| 43 | + case 'all': |
39 | 44 | if ( !nsInputs[i].checked ) { |
40 | 45 | nsInputs[i].checked = true; |
41 | 46 | } |
Index: trunk/phase3/skins/common/prefs.js |
— | — | @@ -1,73 +1,74 @@ |
2 | | - |
3 | 2 | // generate toc from prefs form, fold sections |
4 | 3 | // XXX: needs testing on IE/Mac and safari |
5 | 4 | // more comments to follow |
6 | 5 | function tabbedprefs() { |
7 | | - var prefform = document.getElementById('preferences'); |
8 | | - if (!prefform || !document.createElement) { |
| 6 | + var prefform = document.getElementById( 'preferences' ); |
| 7 | + if ( !prefform || !document.createElement ) { |
9 | 8 | return; |
10 | 9 | } |
11 | | - if (prefform.nodeName.toLowerCase() == 'a') { |
| 10 | + if ( prefform.nodeName.toLowerCase() == 'a' ) { |
12 | 11 | return; // Occasional IE problem |
13 | 12 | } |
14 | 13 | prefform.className = prefform.className + 'jsprefs'; |
15 | 14 | var sections = []; |
16 | 15 | var children = prefform.childNodes; |
17 | 16 | var seci = 0; |
18 | | - for (var i = 0; i < children.length; i++) { |
19 | | - if (children[i].nodeName.toLowerCase() == 'fieldset') { |
| 17 | + for ( var i = 0; i < children.length; i++ ) { |
| 18 | + if ( children[i].nodeName.toLowerCase() == 'fieldset' ) { |
20 | 19 | children[i].id = 'prefsection-' + seci; |
21 | 20 | children[i].className = 'prefsection'; |
22 | | - if (is_opera) { |
| 21 | + if ( is_opera ) { |
23 | 22 | children[i].className = 'prefsection operaprefsection'; |
24 | 23 | } |
25 | 24 | var legends = children[i].getElementsByTagName('legend'); |
26 | 25 | sections[seci] = {}; |
27 | | - if (legends[0]) legends[0].className = 'mainLegend'; |
28 | | - if (legends[0] && legends[0].firstChild.nodeValue) { |
| 26 | + if ( legends[0] ) { |
| 27 | + legends[0].className = 'mainLegend'; |
| 28 | + } |
| 29 | + if ( legends[0] && legends[0].firstChild.nodeValue ) { |
29 | 30 | sections[seci].text = legends[0].firstChild.nodeValue; |
30 | 31 | } else { |
31 | 32 | sections[seci].text = '# ' + seci; |
32 | 33 | } |
33 | 34 | sections[seci].secid = children[i].id; |
34 | 35 | seci++; |
35 | | - if (sections.length != 1) { |
| 36 | + if ( sections.length != 1 ) { |
36 | 37 | children[i].style.display = 'none'; |
37 | 38 | } else { |
38 | 39 | var selectedid = children[i].id; |
39 | 40 | } |
40 | 41 | } |
41 | 42 | } |
42 | | - var toc = document.createElement('ul'); |
| 43 | + var toc = document.createElement( 'ul' ); |
43 | 44 | toc.id = 'preftoc'; |
44 | 45 | toc.selectedid = selectedid; |
45 | | - for (i = 0; i < sections.length; i++) { |
46 | | - var li = document.createElement('li'); |
47 | | - if (i === 0) { |
| 46 | + for ( i = 0; i < sections.length; i++ ) { |
| 47 | + var li = document.createElement( 'li' ); |
| 48 | + if ( i === 0 ) { |
48 | 49 | li.className = 'selected'; |
49 | 50 | } |
50 | | - var a = document.createElement('a'); |
| 51 | + var a = document.createElement( 'a' ); |
51 | 52 | a.href = '#' + sections[i].secid; |
52 | 53 | a.onmousedown = a.onclick = uncoversection; |
53 | | - a.appendChild(document.createTextNode(sections[i].text)); |
| 54 | + a.appendChild( document.createTextNode( sections[i].text ) ); |
54 | 55 | a.secid = sections[i].secid; |
55 | | - li.appendChild(a); |
56 | | - toc.appendChild(li); |
| 56 | + li.appendChild( a ); |
| 57 | + toc.appendChild( li ); |
57 | 58 | } |
58 | | - prefform.parentNode.insertBefore(toc, prefform.parentNode.childNodes[0]); |
59 | | - document.getElementById('prefsubmit').id = 'prefcontrol'; |
| 59 | + prefform.parentNode.insertBefore( toc, prefform.parentNode.childNodes[0] ); |
| 60 | + document.getElementById( 'prefsubmit' ).id = 'prefcontrol'; |
60 | 61 | } |
61 | 62 | |
62 | 63 | function uncoversection() { |
63 | 64 | var oldsecid = this.parentNode.parentNode.selectedid; |
64 | | - var newsec = document.getElementById(this.secid); |
65 | | - if (oldsecid != this.secid) { |
66 | | - var ul = document.getElementById('preftoc'); |
67 | | - document.getElementById(oldsecid).style.display = 'none'; |
| 65 | + var newsec = document.getElementById( this.secid ); |
| 66 | + if ( oldsecid != this.secid ) { |
| 67 | + var ul = document.getElementById( 'preftoc' ); |
| 68 | + document.getElementById( oldsecid ).style.display = 'none'; |
68 | 69 | newsec.style.display = 'block'; |
69 | 70 | ul.selectedid = this.secid; |
70 | | - var lis = ul.getElementsByTagName('li'); |
71 | | - for (var i = 0; i< lis.length; i++) { |
| 71 | + var lis = ul.getElementsByTagName( 'li' ); |
| 72 | + for ( var i = 0; i< lis.length; i++ ) { |
72 | 73 | lis[i].className = ''; |
73 | 74 | } |
74 | 75 | this.parentNode.className = 'selected'; |
— | — | @@ -77,29 +78,29 @@ |
78 | 79 | |
79 | 80 | // Timezone stuff |
80 | 81 | // tz in format [+-]HHMM |
81 | | -function checkTimezone(tz, msg) { |
| 82 | +function checkTimezone( tz, msg ) { |
82 | 83 | var localclock = new Date(); |
83 | 84 | // returns negative offset from GMT in minutes |
84 | 85 | var tzRaw = localclock.getTimezoneOffset(); |
85 | | - var tzHour = Math.floor( Math.abs(tzRaw) / 60); |
86 | | - var tzMin = Math.abs(tzRaw) % 60; |
87 | | - var tzString = ((tzRaw >= 0) ? "-" : "+") + ((tzHour < 10) ? "0" : "") + tzHour + ((tzMin < 10) ? "0" : "") + tzMin; |
88 | | - if (tz != tzString) { |
| 86 | + var tzHour = Math.floor( Math.abs( tzRaw ) / 60 ); |
| 87 | + var tzMin = Math.abs( tzRaw ) % 60; |
| 88 | + var tzString = ( ( tzRaw >= 0 ) ? '-' : '+' ) + ( ( tzHour < 10 ) ? '0' : '' ) + tzHour + ( ( tzMin < 10 ) ? '0' : '' ) + tzMin; |
| 89 | + if ( tz != tzString ) { |
89 | 90 | var junk = msg.split('$1'); |
90 | | - document.write(junk[0] + "UTC" + tzString + junk[1]); |
| 91 | + document.write( junk[0] + 'UTC' + tzString + junk[1] ); |
91 | 92 | } |
92 | 93 | } |
93 | 94 | |
94 | 95 | function timezoneSetup() { |
95 | 96 | var tzSelect = document.getElementById( 'mw-input-timecorrection' ); |
96 | 97 | var tzTextbox = document.getElementById( 'mw-input-timecorrection-other' ); |
97 | | - |
98 | | - if (tzSelect && tzTextbox) { |
99 | | - addHandler( tzSelect, 'change', function(e) { updateTimezoneSelection(false); } ); |
100 | | - addHandler( tzTextbox, 'blur', function(e) { updateTimezoneSelection(true); } ); |
| 98 | + |
| 99 | + if ( tzSelect && tzTextbox ) { |
| 100 | + addHandler( tzSelect, 'change', function( e ) { updateTimezoneSelection( false ); } ); |
| 101 | + addHandler( tzTextbox, 'blur', function( e ) { updateTimezoneSelection( true ); } ); |
101 | 102 | } |
102 | | - |
103 | | - updateTimezoneSelection(false); |
| 103 | + |
| 104 | + updateTimezoneSelection( false ); |
104 | 105 | } |
105 | 106 | |
106 | 107 | // in [-]HH:MM format... |
— | — | @@ -109,86 +110,108 @@ |
110 | 111 | var localclock = new Date(); |
111 | 112 | // returns negative offset from GMT in minutes |
112 | 113 | var tzRaw = localclock.getTimezoneOffset(); |
113 | | - var tzHour = Math.floor( Math.abs(tzRaw) / 60); |
114 | | - var tzMin = Math.abs(tzRaw) % 60; |
115 | | - var tzString = ((tzRaw >= 0) ? "-" : "") + ((tzHour < 10) ? "0" : "") + tzHour + |
116 | | - ":" + ((tzMin < 10) ? "0" : "") + tzMin; |
| 114 | + var tzHour = Math.floor( Math.abs( tzRaw ) / 60 ); |
| 115 | + var tzMin = Math.abs( tzRaw ) % 60; |
| 116 | + var tzString = ( ( tzRaw >= 0 ) ? '-' : '' ) + ( ( tzHour < 10 ) ? '0' : '' ) + tzHour + |
| 117 | + ':' + ( ( tzMin < 10 ) ? '0' : '' ) + tzMin; |
117 | 118 | return tzString; |
118 | 119 | } |
119 | 120 | |
120 | 121 | function guessTimezone() { |
121 | | - var textbox = document.getElementById("mw-input-timecorrection-other"); |
| 122 | + var textbox = document.getElementById( 'mw-input-timecorrection-other' ); |
122 | 123 | var selector = document.getElementById( 'mw-input-timecorrection' ); |
123 | | - |
| 124 | + |
124 | 125 | selector.value = 'other'; |
125 | 126 | textbox.value = fetchTimezone(); |
126 | 127 | textbox.disabled = false; // The changed handler doesn't trip, obviously. |
127 | | - updateTimezoneSelection(true); |
| 128 | + updateTimezoneSelection( true ); |
128 | 129 | } |
129 | 130 | |
130 | | -function updateTimezoneSelection(force_offset) { |
131 | | - var selector = document.getElementById("mw-input-timecorrection"); |
132 | | - |
133 | | - if (selector.value == 'guess') { |
| 131 | +function updateTimezoneSelection( force_offset ) { |
| 132 | + var selector = document.getElementById( 'mw-input-timecorrection' ); |
| 133 | + |
| 134 | + if ( selector.value == 'guess' ) { |
134 | 135 | return guessTimezone(); |
135 | 136 | } |
136 | | - |
| 137 | + |
137 | 138 | var textbox = document.getElementById( 'mw-input-timecorrection-other' ); |
138 | | - var localtimeHolder = document.getElementById("wpLocalTime"); |
139 | | - var servertime = document.getElementsByName("wpServerTime")[0].value; |
| 139 | + var localtimeHolder = document.getElementById( 'wpLocalTime' ); |
| 140 | + var servertime = document.getElementsByName( 'wpServerTime' )[0].value; |
140 | 141 | var minDiff = 0; |
141 | | - |
| 142 | + |
142 | 143 | // Compatibility code. |
143 | | - if (!selector.value) selector.value = selector.options[selector.selectedIndex].value; |
| 144 | + if ( !selector.value ) { |
| 145 | + selector.value = selector.options[selector.selectedIndex].value; |
| 146 | + } |
144 | 147 | |
145 | 148 | // Handle force_offset |
146 | | - if (force_offset) selector.value = 'other'; |
147 | | - |
| 149 | + if ( force_offset ) { |
| 150 | + selector.value = 'other'; |
| 151 | + } |
| 152 | + |
148 | 153 | // Get min_diff |
149 | | - if (selector.value == 'other') { |
| 154 | + if ( selector.value == 'other' ) { |
150 | 155 | // Grab data from the textbox, parse it. |
151 | 156 | var diffArr = textbox.value.split(':'); |
152 | | - if (diffArr.length == 1) { |
| 157 | + if ( diffArr.length == 1 ) { |
153 | 158 | // Specification is of the form [-]XX |
154 | | - minDiff = parseInt(diffArr[0], 10) * 60; |
| 159 | + minDiff = parseInt( diffArr[0], 10 ) * 60; |
155 | 160 | } else { |
156 | 161 | // Specification is of the form [-]XX:XX |
157 | | - minDiff = Math.abs(parseInt(diffArr[0], 10))*60 + parseInt(diffArr[1], 10); |
158 | | - if (parseInt(diffArr[0], 10) < 0) minDiff = -minDiff; |
| 162 | + minDiff = Math.abs( parseInt( diffArr[0], 10 ) ) * 60 + parseInt( diffArr[1], 10 ); |
| 163 | + if ( parseInt( diffArr[0], 10 ) < 0 ) { |
| 164 | + minDiff = -minDiff; |
| 165 | + } |
159 | 166 | } |
160 | 167 | } else { |
161 | 168 | // Grab data from the selector value |
162 | 169 | var diffArr = selector.value.split('|'); |
163 | | - minDiff = parseInt(diffArr[1], 10); |
| 170 | + minDiff = parseInt( diffArr[1], 10 ); |
164 | 171 | } |
165 | | - |
| 172 | + |
166 | 173 | // Gracefully handle non-numbers. |
167 | | - if (isNaN(minDiff)) minDiff = 0; |
168 | | - |
| 174 | + if ( isNaN( minDiff ) ) { |
| 175 | + minDiff = 0; |
| 176 | + } |
| 177 | + |
169 | 178 | // Determine local time from server time and minutes difference, for display. |
170 | | - var localTime = parseInt(servertime, 10) + minDiff; |
171 | | - |
| 179 | + var localTime = parseInt( servertime, 10 ) + minDiff; |
| 180 | + |
172 | 181 | // Bring time within the [0,1440) range. |
173 | | - while (localTime < 0) localTime += 1440; |
174 | | - while (localTime >= 1440) localTime -= 1440; |
| 182 | + while ( localTime < 0 ) { |
| 183 | + localTime += 1440; |
| 184 | + } |
| 185 | + while ( localTime >= 1440 ) { |
| 186 | + localTime -= 1440; |
| 187 | + } |
175 | 188 | |
176 | 189 | // Split to hour and minute |
177 | | - var hour = String(Math.floor(localTime/60)); |
178 | | - if (hour.length<2) hour = '0'+hour; |
| 190 | + var hour = String( Math.floor( localTime / 60 ) ); |
| 191 | + if ( hour.length < 2 ) { |
| 192 | + hour = '0' + hour; |
| 193 | + } |
179 | 194 | var min = String(localTime%60); |
180 | | - if (min.length<2) min = '0'+min; |
181 | | - changeText(localtimeHolder, hour+':'+min); |
| 195 | + if ( min.length < 2 ) { |
| 196 | + min = '0' + min; |
| 197 | + } |
| 198 | + changeText( localtimeHolder, hour + ':' + min ); |
182 | 199 | |
183 | 200 | // If the user selected from the drop-down, fill the offset field. |
184 | | - if (selector.value != 'other') { |
185 | | - hour = String(Math.abs(Math.floor(minDiff/60))); |
186 | | - if (hour.length<2) hour = '0'+hour; |
187 | | - if (minDiff < 0) hour = '-'+hour; |
| 201 | + if ( selector.value != 'other' ) { |
| 202 | + hour = String( Math.abs( Math.floor( minDiff / 60 ) ) ); |
| 203 | + if ( hour.length < 2 ) { |
| 204 | + hour = '0' + hour; |
| 205 | + } |
| 206 | + if ( minDiff < 0 ) { |
| 207 | + hour = '-' + hour; |
| 208 | + } |
188 | 209 | min = String(minDiff%60); |
189 | | - if (min.length<2) min = '0'+min; |
190 | | - textbox.value = hour+':'+min; |
| 210 | + if ( min.length < 2 ) { |
| 211 | + min = '0' + min; |
| 212 | + } |
| 213 | + textbox.value = hour + ':' + min; |
191 | 214 | } |
192 | 215 | } |
193 | 216 | |
194 | | -addOnloadHook(timezoneSetup); |
195 | | -addOnloadHook(tabbedprefs); |
| 217 | +addOnloadHook( timezoneSetup ); |
| 218 | +addOnloadHook( tabbedprefs ); |
Index: trunk/phase3/skins/common/metadata.js |
— | — | @@ -3,42 +3,42 @@ |
4 | 4 | // Add an expand/collapse link and collapse by default if set to |
5 | 5 | // (with JS disabled, user will see all items) |
6 | 6 | // |
7 | | -// attachMetadataToggle("mw_metadata", "More...", "Fewer..."); |
| 7 | +// attachMetadataToggle('mw_metadata', 'More...', 'Fewer...'); |
8 | 8 | |
9 | | - |
10 | | -function attachMetadataToggle(tableId, showText, hideText) { |
11 | | - if (document.createTextNode) { |
12 | | - var box = document.getElementById(tableId); |
13 | | - if (!box) |
| 9 | +function attachMetadataToggle( tableId, showText, hideText ) { |
| 10 | + if ( document.createTextNode ) { |
| 11 | + var box = document.getElementById( tableId ); |
| 12 | + if ( !box ) { |
14 | 13 | return false; |
| 14 | + } |
15 | 15 | |
16 | 16 | var tbody = box.getElementsByTagName('tbody')[0]; |
17 | 17 | |
18 | | - var row = document.createElement('tr'); |
| 18 | + var row = document.createElement( 'tr' ); |
19 | 19 | |
20 | | - var col = document.createElement('td'); |
| 20 | + var col = document.createElement( 'td' ); |
21 | 21 | col.colSpan = 2; |
22 | 22 | |
23 | | - var link = document.createElement('a'); |
| 23 | + var link = document.createElement( 'a' ); |
24 | 24 | link.href = '#'; |
25 | 25 | |
26 | 26 | link.onclick = function() { |
27 | | - if (box.className == 'mw_metadata collapsed') { |
28 | | - changeText(link, hideText); |
| 27 | + if ( box.className == 'mw_metadata collapsed' ) { |
| 28 | + changeText( link, hideText ); |
29 | 29 | box.className = 'mw_metadata expanded'; |
30 | 30 | } else { |
31 | | - changeText(link, showText); |
| 31 | + changeText( link, showText ); |
32 | 32 | box.className = 'mw_metadata collapsed'; |
33 | 33 | } |
34 | 34 | return false; |
35 | | - } |
| 35 | + }; |
36 | 36 | |
37 | | - var text = document.createTextNode(hideText); |
| 37 | + var text = document.createTextNode( hideText ); |
38 | 38 | |
39 | | - link.appendChild(text); |
40 | | - col.appendChild(link); |
41 | | - row.appendChild(col); |
42 | | - tbody.appendChild(row); |
| 39 | + link.appendChild( text ); |
| 40 | + col.appendChild( link ); |
| 41 | + row.appendChild( col ); |
| 42 | + tbody.appendChild( row ); |
43 | 43 | |
44 | 44 | // And collapse! |
45 | 45 | link.onclick(); |
Index: trunk/phase3/skins/common/edit.js |
— | — | @@ -2,144 +2,150 @@ |
3 | 3 | |
4 | 4 | // this function generates the actual toolbar buttons with localized text |
5 | 5 | // we use it to avoid creating the toolbar where javascript is not enabled |
6 | | -function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText, imageId) { |
| 6 | +function addButton( imageFile, speedTip, tagOpen, tagClose, sampleText, imageId ) { |
7 | 7 | // Don't generate buttons for browsers which don't fully |
8 | 8 | // support it. |
9 | | - mwEditButtons.push( |
10 | | - {"imageId": imageId, |
11 | | - "imageFile": imageFile, |
12 | | - "speedTip": speedTip, |
13 | | - "tagOpen": tagOpen, |
14 | | - "tagClose": tagClose, |
15 | | - "sampleText": sampleText}); |
| 9 | + mwEditButtons.push({ |
| 10 | + 'imageId': imageId, |
| 11 | + 'imageFile': imageFile, |
| 12 | + 'speedTip': speedTip, |
| 13 | + 'tagOpen': tagOpen, |
| 14 | + 'tagClose': tagClose, |
| 15 | + 'sampleText': sampleText |
| 16 | + }); |
16 | 17 | } |
17 | 18 | |
18 | 19 | // this function generates the actual toolbar buttons with localized text |
19 | | -// we use it to avoid creating the toolbar where javascript is not enabled |
20 | | -function mwInsertEditButton(parent, item) { |
21 | | - var image = document.createElement("img"); |
| 20 | +// we use it to avoid creating the toolbar where JavaScript is not enabled |
| 21 | +function mwInsertEditButton( parent, item ) { |
| 22 | + var image = document.createElement( 'img' ); |
22 | 23 | image.width = 23; |
23 | 24 | image.height = 22; |
24 | | - image.className = "mw-toolbar-editbutton"; |
25 | | - if (item.imageId) image.id = item.imageId; |
| 25 | + image.className = 'mw-toolbar-editbutton'; |
| 26 | + if ( item.imageId ) { |
| 27 | + image.id = item.imageId; |
| 28 | + } |
26 | 29 | image.src = item.imageFile; |
27 | 30 | image.border = 0; |
28 | 31 | image.alt = item.speedTip; |
29 | 32 | image.title = item.speedTip; |
30 | | - image.style.cursor = "pointer"; |
| 33 | + image.style.cursor = 'pointer'; |
31 | 34 | image.onclick = function() { |
32 | | - insertTags(item.tagOpen, item.tagClose, item.sampleText); |
33 | | - //click tracking |
34 | | - if ( ( typeof $j != 'undefined' ) && ( typeof $j.trackAction != 'undefined' ) ) { |
35 | | - $j.trackAction("oldedit." + item.speedTip.replace(/ /g, "-")); |
| 35 | + insertTags( item.tagOpen, item.tagClose, item.sampleText ); |
| 36 | + // click tracking |
| 37 | + if ( ( typeof $j != 'undefined' ) && ( typeof $j.trackAction != 'undefined' ) ) { |
| 38 | + $j.trackAction( 'oldedit.' + item.speedTip.replace(/ /g, "-") ); |
36 | 39 | } |
37 | 40 | return false; |
38 | 41 | }; |
39 | 42 | |
40 | | - parent.appendChild(image); |
| 43 | + parent.appendChild( image ); |
41 | 44 | return true; |
42 | 45 | } |
43 | 46 | |
44 | 47 | function mwSetupToolbar() { |
45 | | - var toolbar = document.getElementById('toolbar'); |
46 | | - if (!toolbar) { return false; } |
| 48 | + var toolbar = document.getElementById( 'toolbar' ); |
| 49 | + if ( !toolbar ) { |
| 50 | + return false; |
| 51 | + } |
47 | 52 | |
48 | 53 | // Don't generate buttons for browsers which don't fully |
49 | 54 | // support it. |
50 | 55 | // but don't assume wpTextbox1 is always here |
51 | | - var textboxes = document.getElementsByTagName('textarea'); |
| 56 | + var textboxes = document.getElementsByTagName( 'textarea' ); |
52 | 57 | if ( !textboxes.length ) { |
53 | 58 | // No toolbar if we can't find any textarea |
54 | 59 | return false; |
55 | 60 | } |
56 | | - if (!(document.selection && document.selection.createRange) |
57 | | - && textboxes[0].selectionStart === null) { |
| 61 | + if ( !( document.selection && document.selection.createRange ) |
| 62 | + && textboxes[0].selectionStart === null ) { |
58 | 63 | return false; |
59 | 64 | } |
60 | 65 | |
61 | | - for (var i = 0; i < mwEditButtons.length; i++) { |
62 | | - mwInsertEditButton(toolbar, mwEditButtons[i]); |
| 66 | + for ( var i = 0; i < mwEditButtons.length; i++ ) { |
| 67 | + mwInsertEditButton( toolbar, mwEditButtons[i] ); |
63 | 68 | } |
64 | | - for (var i = 0; i < mwCustomEditButtons.length; i++) { |
65 | | - mwInsertEditButton(toolbar, mwCustomEditButtons[i]); |
| 69 | + for ( var i = 0; i < mwCustomEditButtons.length; i++ ) { |
| 70 | + mwInsertEditButton( toolbar, mwCustomEditButtons[i] ); |
66 | 71 | } |
67 | 72 | return true; |
68 | 73 | } |
69 | 74 | |
70 | 75 | // apply tagOpen/tagClose to selection in textarea, |
71 | 76 | // use sampleText instead of selection if there is none |
72 | | -function insertTags(tagOpen, tagClose, sampleText) { |
| 77 | +function insertTags( tagOpen, tagClose, sampleText ) { |
73 | 78 | var txtarea; |
74 | | - if (document.editform) { |
| 79 | + if ( document.editform ) { |
75 | 80 | txtarea = currentFocused; |
76 | 81 | } else { |
77 | 82 | // some alternate form? take the first one we can find |
78 | | - var areas = document.getElementsByTagName('textarea'); |
| 83 | + var areas = document.getElementsByTagName( 'textarea' ); |
79 | 84 | txtarea = areas[0]; |
80 | 85 | } |
81 | 86 | var selText, isSample = false; |
82 | 87 | |
83 | | - if (document.selection && document.selection.createRange) { // IE/Opera |
84 | | - |
85 | | - //save window scroll position |
86 | | - if (document.documentElement && document.documentElement.scrollTop) |
| 88 | + if ( document.selection && document.selection.createRange ) { // IE/Opera |
| 89 | + // save window scroll position |
| 90 | + if ( document.documentElement && document.documentElement.scrollTop ) { |
87 | 91 | var winScroll = document.documentElement.scrollTop |
88 | | - else if (document.body) |
| 92 | + } else if ( document.body ) { |
89 | 93 | var winScroll = document.body.scrollTop; |
90 | | - //get current selection |
| 94 | + } |
| 95 | + // get current selection |
91 | 96 | txtarea.focus(); |
92 | 97 | var range = document.selection.createRange(); |
93 | 98 | selText = range.text; |
94 | | - //insert tags |
| 99 | + // insert tags |
95 | 100 | checkSelectedText(); |
96 | 101 | range.text = tagOpen + selText + tagClose; |
97 | | - //mark sample text as selected |
98 | | - if (isSample && range.moveStart) { |
99 | | - if (window.opera) |
| 102 | + // mark sample text as selected |
| 103 | + if ( isSample && range.moveStart ) { |
| 104 | + if ( window.opera ) { |
100 | 105 | tagClose = tagClose.replace(/\n/g,''); |
| 106 | + } |
101 | 107 | range.moveStart('character', - tagClose.length - selText.length); |
102 | 108 | range.moveEnd('character', - tagClose.length); |
103 | 109 | } |
104 | 110 | range.select(); |
105 | | - //restore window scroll position |
106 | | - if (document.documentElement && document.documentElement.scrollTop) |
107 | | - document.documentElement.scrollTop = winScroll |
108 | | - else if (document.body) |
| 111 | + // restore window scroll position |
| 112 | + if ( document.documentElement && document.documentElement.scrollTop ) { |
| 113 | + document.documentElement.scrollTop = winScroll; |
| 114 | + } else if ( document.body ) { |
109 | 115 | document.body.scrollTop = winScroll; |
| 116 | + } |
110 | 117 | |
111 | | - } else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla |
112 | | - |
113 | | - //save textarea scroll position |
| 118 | + } else if ( txtarea.selectionStart || txtarea.selectionStart == '0' ) { // Mozilla |
| 119 | + // save textarea scroll position |
114 | 120 | var textScroll = txtarea.scrollTop; |
115 | | - //get current selection |
| 121 | + // get current selection |
116 | 122 | txtarea.focus(); |
117 | 123 | var startPos = txtarea.selectionStart; |
118 | 124 | var endPos = txtarea.selectionEnd; |
119 | | - selText = txtarea.value.substring(startPos, endPos); |
120 | | - //insert tags |
| 125 | + selText = txtarea.value.substring( startPos, endPos ); |
| 126 | + // insert tags |
121 | 127 | checkSelectedText(); |
122 | 128 | txtarea.value = txtarea.value.substring(0, startPos) |
123 | 129 | + tagOpen + selText + tagClose |
124 | 130 | + txtarea.value.substring(endPos, txtarea.value.length); |
125 | | - //set new selection |
126 | | - if (isSample) { |
| 131 | + // set new selection |
| 132 | + if ( isSample ) { |
127 | 133 | txtarea.selectionStart = startPos + tagOpen.length; |
128 | 134 | txtarea.selectionEnd = startPos + tagOpen.length + selText.length; |
129 | 135 | } else { |
130 | 136 | txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length; |
131 | 137 | txtarea.selectionEnd = txtarea.selectionStart; |
132 | 138 | } |
133 | | - //restore textarea scroll position |
| 139 | + // restore textarea scroll position |
134 | 140 | txtarea.scrollTop = textScroll; |
135 | 141 | } |
136 | 142 | |
137 | | - function checkSelectedText(){ |
138 | | - if (!selText) { |
| 143 | + function checkSelectedText() { |
| 144 | + if ( !selText ) { |
139 | 145 | selText = sampleText; |
140 | 146 | isSample = true; |
141 | | - } else if (selText.charAt(selText.length - 1) == ' ') { //exclude ending space char |
| 147 | + } else if ( selText.charAt(selText.length - 1) == ' ' ) { // exclude ending space char |
142 | 148 | selText = selText.substring(0, selText.length - 1); |
143 | | - tagClose += ' ' |
| 149 | + tagClose += ' '; |
144 | 150 | } |
145 | 151 | } |
146 | 152 | |
— | — | @@ -154,8 +160,9 @@ |
155 | 161 | var scrollTop = document.getElementById( 'wpScrolltop' ); |
156 | 162 | var editForm = document.getElementById( 'editform' ); |
157 | 163 | if( editForm && editBox && scrollTop ) { |
158 | | - if( scrollTop.value ) |
| 164 | + if( scrollTop.value ) { |
159 | 165 | editBox.scrollTop = scrollTop.value; |
| 166 | + } |
160 | 167 | addHandler( editForm, 'submit', function() { |
161 | 168 | scrollTop.value = editBox.scrollTop; |
162 | 169 | } ); |
— | — | @@ -169,31 +176,34 @@ |
170 | 177 | // focus does not bubble normally, but using a trick we can do event delegation |
171 | 178 | // on the focus event on all text inputs to make the toolbox usable on all of them |
172 | 179 | var editForm = document.getElementById( 'editform' ); |
173 | | - if ( !editForm ) |
| 180 | + if ( !editForm ) { |
174 | 181 | return; |
175 | | - |
176 | | - function onfocus(e) { |
| 182 | + } |
| 183 | + function onfocus( e ) { |
177 | 184 | var elm = e.target; |
178 | | - if ( !elm ) |
| 185 | + if ( !elm ) { |
179 | 186 | return; |
| 187 | + } |
180 | 188 | var tagName = elm.tagName.toLowerCase(); |
181 | 189 | var type = elm.type.toLowerCase(); |
182 | | - if ( tagName !== "textarea" && tagName !== "input" ) |
| 190 | + if ( tagName !== 'textarea' && tagName !== 'input' ) { |
183 | 191 | return; |
184 | | - if ( tagName === "input" && type && type !== "text" ) |
| 192 | + } |
| 193 | + if ( tagName === 'input' && type && type !== 'text' ) { |
185 | 194 | return; |
186 | | - |
| 195 | + } |
| 196 | + |
187 | 197 | currentFocused = elm; |
188 | 198 | } |
189 | | - |
| 199 | + |
190 | 200 | if ( editForm.addEventListener ) { |
191 | 201 | // Gecko, WebKit, Opera, etc... (all standards compliant browsers) |
192 | | - editForm.addEventListener('focus', onfocus, true); // This MUST be true to work |
| 202 | + editForm.addEventListener( 'focus', onfocus, true ); // This MUST be true to work |
193 | 203 | } else if ( editForm.attachEvent ) { |
194 | 204 | // IE needs a specific trick here since it doesn't support the standard |
195 | | - editForm.attachEvent( 'onfocusin', function() { onfocus(event); } ); |
| 205 | + editForm.attachEvent( 'onfocusin', function() { onfocus( event ); } ); |
196 | 206 | } |
197 | | - |
| 207 | + |
198 | 208 | editForm |
199 | 209 | } ); |
200 | 210 | |
Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -38,148 +38,147 @@ |
39 | 39 | var onloadFuncts = []; |
40 | 40 | } |
41 | 41 | |
42 | | -function addOnloadHook(hookFunct) { |
| 42 | +function addOnloadHook( hookFunct ) { |
43 | 43 | // Allows add-on scripts to add onload functions |
44 | | - if(!doneOnloadHook) { |
| 44 | + if( !doneOnloadHook ) { |
45 | 45 | onloadFuncts[onloadFuncts.length] = hookFunct; |
46 | 46 | } else { |
47 | 47 | hookFunct(); // bug in MSIE script loading |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | | - |
52 | | -function hookEvent(hookName, hookFunct) { |
53 | | - addHandler(window, hookName, hookFunct); |
| 51 | +function hookEvent( hookName, hookFunct ) { |
| 52 | + addHandler( window, hookName, hookFunct ); |
54 | 53 | } |
55 | 54 | |
56 | | -function importScript(page) { |
| 55 | +function importScript( page ) { |
57 | 56 | // TODO: might want to introduce a utility function to match wfUrlencode() in PHP |
58 | 57 | var uri = wgScript + '?title=' + |
59 | 58 | encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') + |
60 | 59 | '&action=raw&ctype=text/javascript'; |
61 | | - return importScriptURI(uri); |
| 60 | + return importScriptURI( uri ); |
62 | 61 | } |
63 | 62 | |
64 | 63 | var loadedScripts = {}; // included-scripts tracker |
65 | | -function importScriptURI(url) { |
66 | | - if (loadedScripts[url]) { |
| 64 | +function importScriptURI( url ) { |
| 65 | + if ( loadedScripts[url] ) { |
67 | 66 | return null; |
68 | 67 | } |
69 | 68 | loadedScripts[url] = true; |
70 | | - var s = document.createElement('script'); |
71 | | - s.setAttribute('src', url); |
72 | | - s.setAttribute('type', 'text/javascript'); |
73 | | - document.getElementsByTagName('head')[0].appendChild(s); |
| 69 | + var s = document.createElement( 'script' ); |
| 70 | + s.setAttribute( 'src', url ); |
| 71 | + s.setAttribute( 'type', 'text/javascript' ); |
| 72 | + document.getElementsByTagName('head')[0].appendChild( s ); |
74 | 73 | return s; |
75 | 74 | } |
76 | 75 | |
77 | | -function importStylesheet(page) { |
78 | | - return importStylesheetURI(wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent(page.replace(/ /g,'_'))); |
| 76 | +function importStylesheet( page ) { |
| 77 | + return importStylesheetURI( wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent( page.replace(/ /g,'_') ) ); |
79 | 78 | } |
80 | 79 | |
81 | | -function importStylesheetURI(url, media) { |
82 | | - var l = document.createElement('link'); |
| 80 | +function importStylesheetURI( url, media ) { |
| 81 | + var l = document.createElement( 'link' ); |
83 | 82 | l.type = 'text/css'; |
84 | 83 | l.rel = 'stylesheet'; |
85 | 84 | l.href = url; |
86 | 85 | if( media ) { |
87 | 86 | l.media = media; |
88 | 87 | } |
89 | | - document.getElementsByTagName('head')[0].appendChild(l); |
| 88 | + document.getElementsByTagName('head')[0].appendChild( l ); |
90 | 89 | return l; |
91 | 90 | } |
92 | 91 | |
93 | | -function appendCSS(text) { |
94 | | - var s = document.createElement('style'); |
| 92 | +function appendCSS( text ) { |
| 93 | + var s = document.createElement( 'style' ); |
95 | 94 | s.type = 'text/css'; |
96 | 95 | s.rel = 'stylesheet'; |
97 | 96 | if ( s.styleSheet ) { |
98 | | - s.styleSheet.cssText = text; //IE |
| 97 | + s.styleSheet.cssText = text; // IE |
99 | 98 | } else { |
100 | | - s.appendChild(document.createTextNode(text + '')); //Safari sometimes borks on null |
| 99 | + s.appendChild( document.createTextNode( text + '' ) ); // Safari sometimes borks on null |
101 | 100 | } |
102 | | - document.getElementsByTagName('head')[0].appendChild(s); |
| 101 | + document.getElementsByTagName('head')[0].appendChild( s ); |
103 | 102 | return s; |
104 | 103 | } |
105 | 104 | |
106 | 105 | // special stylesheet links |
107 | | -if (typeof stylepath != 'undefined' && typeof skin != 'undefined') { |
| 106 | +if ( typeof stylepath != 'undefined' && typeof skin != 'undefined' ) { |
108 | 107 | // FIXME: This tries to load the stylesheets even for skins where they |
109 | 108 | // don't exist, i.e., everything but Monobook. |
110 | | - if (opera6_bugs) { |
111 | | - importStylesheetURI(stylepath+'/'+skin+'/Opera6Fixes.css'); |
112 | | - } else if (opera7_bugs) { |
113 | | - importStylesheetURI(stylepath+'/'+skin+'/Opera7Fixes.css'); |
114 | | - } else if (opera95_bugs) { |
115 | | - importStylesheetURI(stylepath+'/'+skin+'/Opera9Fixes.css'); |
116 | | - } else if (ff2_bugs) { |
117 | | - importStylesheetURI(stylepath+'/'+skin+'/FF2Fixes.css'); |
| 109 | + if ( opera6_bugs ) { |
| 110 | + importStylesheetURI( stylepath + '/' + skin + '/Opera6Fixes.css' ); |
| 111 | + } else if ( opera7_bugs ) { |
| 112 | + importStylesheetURI( stylepath + '/' + skin + '/Opera7Fixes.css' ); |
| 113 | + } else if ( opera95_bugs ) { |
| 114 | + importStylesheetURI( stylepath + '/' + skin + '/Opera9Fixes.css' ); |
| 115 | + } else if ( ff2_bugs ) { |
| 116 | + importStylesheetURI( stylepath + '/' + skin + '/FF2Fixes.css' ); |
118 | 117 | } |
119 | 118 | } |
120 | 119 | |
121 | 120 | |
122 | | -if (wgBreakFrames) { |
| 121 | +if ( wgBreakFrames ) { |
123 | 122 | // Un-trap us from framesets |
124 | | - if (window.top != window) { |
| 123 | + if ( window.top != window ) { |
125 | 124 | window.top.location = window.location; |
126 | 125 | } |
127 | 126 | } |
128 | 127 | |
129 | 128 | function showTocToggle() { |
130 | | - if (document.createTextNode) { |
| 129 | + if ( document.createTextNode ) { |
131 | 130 | // Uses DOM calls to avoid document.write + XHTML issues |
132 | 131 | |
133 | | - var linkHolder = document.getElementById('toctitle'); |
134 | | - var existingLink = document.getElementById('togglelink'); |
135 | | - if (!linkHolder || existingLink) { |
| 132 | + var linkHolder = document.getElementById( 'toctitle' ); |
| 133 | + var existingLink = document.getElementById( 'togglelink' ); |
| 134 | + if ( !linkHolder || existingLink ) { |
136 | 135 | // Don't add the toggle link twice |
137 | 136 | return; |
138 | 137 | } |
139 | 138 | |
140 | | - var outerSpan = document.createElement('span'); |
| 139 | + var outerSpan = document.createElement( 'span' ); |
141 | 140 | outerSpan.className = 'toctoggle'; |
142 | 141 | |
143 | | - var toggleLink = document.createElement('a'); |
| 142 | + var toggleLink = document.createElement( 'a' ); |
144 | 143 | toggleLink.id = 'togglelink'; |
145 | 144 | toggleLink.className = 'internal'; |
146 | 145 | toggleLink.href = 'javascript:toggleToc()'; |
147 | | - toggleLink.appendChild(document.createTextNode(tocHideText)); |
| 146 | + toggleLink.appendChild( document.createTextNode( tocHideText ) ); |
148 | 147 | |
149 | | - outerSpan.appendChild(document.createTextNode('[')); |
150 | | - outerSpan.appendChild(toggleLink); |
151 | | - outerSpan.appendChild(document.createTextNode(']')); |
| 148 | + outerSpan.appendChild( document.createTextNode( '[' ) ); |
| 149 | + outerSpan.appendChild( toggleLink ); |
| 150 | + outerSpan.appendChild( document.createTextNode( ']' ) ); |
152 | 151 | |
153 | | - linkHolder.appendChild(document.createTextNode(' ')); |
154 | | - linkHolder.appendChild(outerSpan); |
| 152 | + linkHolder.appendChild( document.createTextNode( ' ' ) ); |
| 153 | + linkHolder.appendChild( outerSpan ); |
155 | 154 | |
156 | | - var cookiePos = document.cookie.indexOf("hidetoc="); |
157 | | - if (cookiePos > -1 && document.cookie.charAt(cookiePos + 8) == 1) { |
| 155 | + var cookiePos = document.cookie.indexOf( "hidetoc=" ); |
| 156 | + if ( cookiePos > -1 && document.cookie.charAt( cookiePos + 8 ) == 1 ) { |
158 | 157 | toggleToc(); |
159 | 158 | } |
160 | 159 | } |
161 | 160 | } |
162 | 161 | |
163 | | -function changeText(el, newText) { |
| 162 | +function changeText( el, newText ) { |
164 | 163 | // Safari work around |
165 | | - if (el.innerText) { |
| 164 | + if ( el.innerText ) { |
166 | 165 | el.innerText = newText; |
167 | | - } else if (el.firstChild && el.firstChild.nodeValue) { |
| 166 | + } else if ( el.firstChild && el.firstChild.nodeValue ) { |
168 | 167 | el.firstChild.nodeValue = newText; |
169 | 168 | } |
170 | 169 | } |
171 | 170 | |
172 | 171 | function toggleToc() { |
173 | | - var tocmain = document.getElementById('toc'); |
| 172 | + var tocmain = document.getElementById( 'toc' ); |
174 | 173 | var toc = document.getElementById('toc').getElementsByTagName('ul')[0]; |
175 | | - var toggleLink = document.getElementById('togglelink'); |
| 174 | + var toggleLink = document.getElementById( 'togglelink' ); |
176 | 175 | |
177 | | - if (toc && toggleLink && toc.style.display == 'none') { |
178 | | - changeText(toggleLink, tocHideText); |
| 176 | + if ( toc && toggleLink && toc.style.display == 'none' ) { |
| 177 | + changeText( toggleLink, tocHideText ); |
179 | 178 | toc.style.display = 'block'; |
180 | 179 | document.cookie = "hidetoc=0"; |
181 | 180 | tocmain.className = 'toc'; |
182 | 181 | } else { |
183 | | - changeText(toggleLink, tocShowText); |
| 182 | + changeText( toggleLink, tocShowText ); |
184 | 183 | toc.style.display = 'none'; |
185 | 184 | document.cookie = "hidetoc=1"; |
186 | 185 | tocmain.className = 'toc tochidden'; |
— | — | @@ -189,40 +188,39 @@ |
190 | 189 | var mwEditButtons = []; |
191 | 190 | var mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js |
192 | 191 | |
193 | | -function escapeQuotes(text) { |
194 | | - var re = new RegExp("'","g"); |
195 | | - text = text.replace(re,"\\'"); |
196 | | - re = new RegExp("\\n","g"); |
197 | | - text = text.replace(re,"\\n"); |
198 | | - return escapeQuotesHTML(text); |
| 192 | +function escapeQuotes( text ) { |
| 193 | + var re = new RegExp( "'", "g" ); |
| 194 | + text = text.replace( re, "\\'" ); |
| 195 | + re = new RegExp( "\\n", "g" ); |
| 196 | + text = text.replace( re, "\\n" ); |
| 197 | + return escapeQuotesHTML( text ); |
199 | 198 | } |
200 | 199 | |
201 | | -function escapeQuotesHTML(text) { |
202 | | - var re = new RegExp('&',"g"); |
203 | | - text = text.replace(re,"&"); |
204 | | - re = new RegExp('"',"g"); |
205 | | - text = text.replace(re,"""); |
206 | | - re = new RegExp('<',"g"); |
207 | | - text = text.replace(re,"<"); |
208 | | - re = new RegExp('>',"g"); |
209 | | - text = text.replace(re,">"); |
| 200 | +function escapeQuotesHTML( text ) { |
| 201 | + var re = new RegExp( '&', "g" ); |
| 202 | + text = text.replace( re, "&" ); |
| 203 | + re = new RegExp( '"', "g" ); |
| 204 | + text = text.replace( re, """ ); |
| 205 | + re = new RegExp( '<', "g" ); |
| 206 | + text = text.replace( re, "<" ); |
| 207 | + re = new RegExp( '>', "g" ); |
| 208 | + text = text.replace( re, ">" ); |
210 | 209 | return text; |
211 | 210 | } |
212 | 211 | |
213 | | - |
214 | 212 | /** |
215 | 213 | * Set the accesskey prefix based on browser detection. |
216 | 214 | */ |
217 | 215 | var tooltipAccessKeyPrefix = 'alt-'; |
218 | | -if (is_opera) { |
| 216 | +if ( is_opera ) { |
219 | 217 | tooltipAccessKeyPrefix = 'shift-esc-'; |
220 | | -} else if (!is_safari_win && is_safari && webkit_version > 526) { |
| 218 | +} else if ( !is_safari_win && is_safari && webkit_version > 526 ) { |
221 | 219 | tooltipAccessKeyPrefix = 'ctrl-alt-'; |
222 | | -} else if (!is_safari_win && (is_safari |
| 220 | +} else if ( !is_safari_win && ( is_safari |
223 | 221 | || clientPC.indexOf('mac') != -1 |
224 | | - || clientPC.indexOf('konqueror') != -1 )) { |
| 222 | + || clientPC.indexOf('konqueror') != -1 ) ) { |
225 | 223 | tooltipAccessKeyPrefix = 'ctrl-'; |
226 | | -} else if (is_ff2) { |
| 224 | +} else if ( is_ff2 ) { |
227 | 225 | tooltipAccessKeyPrefix = 'alt-shift-'; |
228 | 226 | } |
229 | 227 | var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?(.)\]$/; |
— | — | @@ -241,28 +239,28 @@ |
242 | 240 | // containers which contain the relevant links. This is really just an |
243 | 241 | // optimization technique. |
244 | 242 | var linkContainers = [ |
245 | | - "column-one", // Monobook and Modern |
246 | | - "head", "panel", "p-logo" // Vector |
| 243 | + 'column-one', // Monobook and Modern |
| 244 | + 'head', 'panel', 'p-logo' // Vector |
247 | 245 | ]; |
248 | 246 | for ( var i in linkContainers ) { |
249 | 247 | var linkContainer = document.getElementById( linkContainers[i] ); |
250 | 248 | if ( linkContainer ) { |
251 | | - updateTooltipAccessKeys( linkContainer.getElementsByTagName("a") ); |
| 249 | + updateTooltipAccessKeys( linkContainer.getElementsByTagName( 'a' ) ); |
252 | 250 | } |
253 | 251 | } |
254 | 252 | // these are rare enough that no such optimization is needed |
255 | | - updateTooltipAccessKeys( document.getElementsByTagName("input") ); |
256 | | - updateTooltipAccessKeys( document.getElementsByTagName("label") ); |
| 253 | + updateTooltipAccessKeys( document.getElementsByTagName( 'input' ) ); |
| 254 | + updateTooltipAccessKeys( document.getElementsByTagName( 'label' ) ); |
257 | 255 | return; |
258 | 256 | } |
259 | 257 | |
260 | 258 | for ( var i = 0; i < nodeList.length; i++ ) { |
261 | 259 | var element = nodeList[i]; |
262 | | - var tip = element.getAttribute("title"); |
263 | | - if ( tip && tooltipAccessKeyRegexp.exec(tip) ) { |
| 260 | + var tip = element.getAttribute( 'title' ); |
| 261 | + if ( tip && tooltipAccessKeyRegexp.exec( tip ) ) { |
264 | 262 | tip = tip.replace(tooltipAccessKeyRegexp, |
265 | | - "["+tooltipAccessKeyPrefix+"$5]"); |
266 | | - element.setAttribute("title", tip ); |
| 263 | + '[' + tooltipAccessKeyPrefix + "$5]"); |
| 264 | + element.setAttribute( 'title', tip ); |
267 | 265 | } |
268 | 266 | } |
269 | 267 | } |
— | — | @@ -295,8 +293,8 @@ |
296 | 294 | * |
297 | 295 | * @return Node -- the DOM node of the new item (an LI element) or null |
298 | 296 | */ |
299 | | -function addPortletLink(portlet, href, text, id, tooltip, accesskey, nextnode) { |
300 | | - var root = document.getElementById(portlet); |
| 297 | +function addPortletLink( portlet, href, text, id, tooltip, accesskey, nextnode ) { |
| 298 | + var root = document.getElementById( portlet ); |
301 | 299 | if ( !root ) { |
302 | 300 | return null; |
303 | 301 | } |
— | — | @@ -341,7 +339,7 @@ |
342 | 340 | return item; |
343 | 341 | } |
344 | 342 | |
345 | | -function getInnerText(el) { |
| 343 | +function getInnerText( el ) { |
346 | 344 | if ( typeof el == 'string' ) { |
347 | 345 | return el; |
348 | 346 | } |
— | — | @@ -358,10 +356,10 @@ |
359 | 357 | |
360 | 358 | var cs = el.childNodes; |
361 | 359 | var l = cs.length; |
362 | | - for (var i = 0; i < l; i++) { |
363 | | - switch (cs[i].nodeType) { |
| 360 | + for ( var i = 0; i < l; i++ ) { |
| 361 | + switch ( cs[i].nodeType ) { |
364 | 362 | case 1: // ELEMENT_NODE |
365 | | - str += ts_getInnerText(cs[i]); |
| 363 | + str += ts_getInnerText( cs[i] ); |
366 | 364 | break; |
367 | 365 | case 3: // TEXT_NODE |
368 | 366 | str += cs[i].nodeValue; |
— | — | @@ -381,11 +379,11 @@ |
382 | 380 | function setupCheckboxShiftClick() { |
383 | 381 | checkboxes = []; |
384 | 382 | lastCheckbox = null; |
385 | | - var inputs = document.getElementsByTagName('input'); |
386 | | - addCheckboxClickHandlers(inputs); |
| 383 | + var inputs = document.getElementsByTagName( 'input' ); |
| 384 | + addCheckboxClickHandlers( inputs ); |
387 | 385 | } |
388 | 386 | |
389 | | -function addCheckboxClickHandlers(inputs, start) { |
| 387 | +function addCheckboxClickHandlers( inputs, start ) { |
390 | 388 | if ( !start ) { |
391 | 389 | start = 0; |
392 | 390 | } |
— | — | @@ -407,14 +405,14 @@ |
408 | 406 | } |
409 | 407 | |
410 | 408 | if ( finish < inputs.length ) { |
411 | | - setTimeout( function () { |
412 | | - addCheckboxClickHandlers(inputs, finish); |
| 409 | + setTimeout( function() { |
| 410 | + addCheckboxClickHandlers( inputs, finish ); |
413 | 411 | }, 200 ); |
414 | 412 | } |
415 | 413 | } |
416 | 414 | |
417 | | -function checkboxClickHandler(e) { |
418 | | - if (typeof e == 'undefined') { |
| 415 | +function checkboxClickHandler( e ) { |
| 416 | + if ( typeof e == 'undefined' ) { |
419 | 417 | e = window.event; |
420 | 418 | } |
421 | 419 | if ( !e.shiftKey || lastCheckbox === null ) { |
— | — | @@ -430,7 +428,7 @@ |
431 | 429 | start = lastCheckbox; |
432 | 430 | finish = this.index - 1; |
433 | 431 | } |
434 | | - for (var i = start; i <= finish; ++i ) { |
| 432 | + for ( var i = start; i <= finish; ++i ) { |
435 | 433 | checkboxes[i].checked = endState; |
436 | 434 | if( i > start && typeof checkboxes[i].onchange == 'function' ) { |
437 | 435 | checkboxes[i].onchange(); // fire triggers |
— | — | @@ -447,25 +445,25 @@ |
448 | 446 | Author says "The credit comment is all it takes, no license. Go crazy with it!:-)" |
449 | 447 | From http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/ |
450 | 448 | */ |
451 | | -function getElementsByClassName(oElm, strTagName, oClassNames){ |
| 449 | +function getElementsByClassName( oElm, strTagName, oClassNames ) { |
452 | 450 | var arrReturnElements = new Array(); |
453 | | - if ( typeof( oElm.getElementsByClassName ) == "function" ) { |
| 451 | + if ( typeof( oElm.getElementsByClassName ) == 'function' ) { |
454 | 452 | /* Use a native implementation where possible FF3, Saf3.2, Opera 9.5 */ |
455 | 453 | var arrNativeReturn = oElm.getElementsByClassName( oClassNames ); |
456 | | - if ( strTagName == "*" ) { |
| 454 | + if ( strTagName == '*' ) { |
457 | 455 | return arrNativeReturn; |
458 | 456 | } |
459 | | - for ( var h=0; h < arrNativeReturn.length; h++ ) { |
| 457 | + for ( var h = 0; h < arrNativeReturn.length; h++ ) { |
460 | 458 | if( arrNativeReturn[h].tagName.toLowerCase() == strTagName.toLowerCase() ) { |
461 | 459 | arrReturnElements[arrReturnElements.length] = arrNativeReturn[h]; |
462 | 460 | } |
463 | 461 | } |
464 | 462 | return arrReturnElements; |
465 | 463 | } |
466 | | - var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName); |
| 464 | + var arrElements = ( strTagName == '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName ); |
467 | 465 | var arrRegExpClassNames = new Array(); |
468 | | - if(typeof oClassNames == "object"){ |
469 | | - for(var i=0; i<oClassNames.length; i++){ |
| 466 | + if( typeof oClassNames == 'object' ) { |
| 467 | + for( var i = 0; i < oClassNames.length; i++ ) { |
470 | 468 | arrRegExpClassNames[arrRegExpClassNames.length] = |
471 | 469 | new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"); |
472 | 470 | } |
— | — | @@ -475,41 +473,41 @@ |
476 | 474 | } |
477 | 475 | var oElement; |
478 | 476 | var bMatchesAll; |
479 | | - for(var j=0; j<arrElements.length; j++){ |
| 477 | + for( var j = 0; j < arrElements.length; j++ ) { |
480 | 478 | oElement = arrElements[j]; |
481 | 479 | bMatchesAll = true; |
482 | | - for(var k=0; k<arrRegExpClassNames.length; k++){ |
483 | | - if(!arrRegExpClassNames[k].test(oElement.className)){ |
| 480 | + for( var k = 0; k < arrRegExpClassNames.length; k++ ) { |
| 481 | + if( !arrRegExpClassNames[k].test( oElement.className ) ) { |
484 | 482 | bMatchesAll = false; |
485 | 483 | break; |
486 | 484 | } |
487 | 485 | } |
488 | | - if(bMatchesAll){ |
| 486 | + if( bMatchesAll ) { |
489 | 487 | arrReturnElements[arrReturnElements.length] = oElement; |
490 | 488 | } |
491 | 489 | } |
492 | | - return (arrReturnElements); |
| 490 | + return ( arrReturnElements ); |
493 | 491 | } |
494 | 492 | |
495 | | -function redirectToFragment(fragment) { |
| 493 | +function redirectToFragment( fragment ) { |
496 | 494 | var match = navigator.userAgent.match(/AppleWebKit\/(\d+)/); |
497 | | - if (match) { |
498 | | - var webKitVersion = parseInt(match[1]); |
499 | | - if (webKitVersion < 420) { |
| 495 | + if ( match ) { |
| 496 | + var webKitVersion = parseInt( match[1] ); |
| 497 | + if ( webKitVersion < 420 ) { |
500 | 498 | // Released Safari w/ WebKit 418.9.1 messes up horribly |
501 | 499 | // Nightlies of 420+ are ok |
502 | 500 | return; |
503 | 501 | } |
504 | 502 | } |
505 | | - if (is_gecko) { |
| 503 | + if ( is_gecko ) { |
506 | 504 | // Mozilla needs to wait until after load, otherwise the window doesn't scroll |
507 | | - addOnloadHook(function () { |
508 | | - if (window.location.hash == '') { |
| 505 | + addOnloadHook(function() { |
| 506 | + if ( window.location.hash == '' ) { |
509 | 507 | window.location.hash = fragment; |
510 | 508 | } |
511 | 509 | }); |
512 | 510 | } else { |
513 | | - if (window.location.hash == '') { |
| 511 | + if ( window.location.hash == '' ) { |
514 | 512 | window.location.hash = fragment; |
515 | 513 | } |
516 | 514 | } |
— | — | @@ -538,20 +536,20 @@ |
539 | 537 | function sortables_init() { |
540 | 538 | var idnum = 0; |
541 | 539 | // Find all tables with class sortable and make them sortable |
542 | | - var tables = getElementsByClassName(document, "table", "sortable"); |
543 | | - for (var ti = 0; ti < tables.length ; ti++) { |
544 | | - if (!tables[ti].id) { |
545 | | - tables[ti].setAttribute('id','sortable_table_id_'+idnum); |
| 540 | + var tables = getElementsByClassName( document, 'table', 'sortable' ); |
| 541 | + for ( var ti = 0; ti < tables.length ; ti++ ) { |
| 542 | + if ( !tables[ti].id ) { |
| 543 | + tables[ti].setAttribute( 'id', 'sortable_table_id_' + idnum ); |
546 | 544 | ++idnum; |
547 | 545 | } |
548 | | - ts_makeSortable(tables[ti]); |
| 546 | + ts_makeSortable( tables[ti] ); |
549 | 547 | } |
550 | 548 | } |
551 | 549 | |
552 | | -function ts_makeSortable(table) { |
| 550 | +function ts_makeSortable( table ) { |
553 | 551 | var firstRow; |
554 | | - if (table.rows && table.rows.length > 0) { |
555 | | - if (table.tHead && table.tHead.rows.length > 0) { |
| 552 | + if ( table.rows && table.rows.length > 0 ) { |
| 553 | + if ( table.tHead && table.tHead.rows.length > 0 ) { |
556 | 554 | firstRow = table.tHead.rows[table.tHead.rows.length-1]; |
557 | 555 | } else { |
558 | 556 | firstRow = table.rows[0]; |
— | — | @@ -562,9 +560,9 @@ |
563 | 561 | } |
564 | 562 | |
565 | 563 | // We have a first row: assume it's the header, and make its contents clickable links |
566 | | - for (var i = 0; i < firstRow.cells.length; i++) { |
| 564 | + for ( var i = 0; i < firstRow.cells.length; i++ ) { |
567 | 565 | var cell = firstRow.cells[i]; |
568 | | - if ((" "+cell.className+" ").indexOf(" unsortable ") == -1) { |
| 566 | + if ( (' ' + cell.className + ' ').indexOf(' unsortable ') == -1 ) { |
569 | 567 | cell.innerHTML += '<a href="#" class="sortheader" ' |
570 | 568 | + 'onclick="ts_resortTable(this);return false;">' |
571 | 569 | + '<span class="sortarrow">' |
— | — | @@ -574,16 +572,16 @@ |
575 | 573 | + '" alt="↓"/></span></a>'; |
576 | 574 | } |
577 | 575 | } |
578 | | - if (ts_alternate_row_colors) { |
579 | | - ts_alternate(table); |
| 576 | + if ( ts_alternate_row_colors ) { |
| 577 | + ts_alternate( table ); |
580 | 578 | } |
581 | 579 | } |
582 | 580 | |
583 | | -function ts_getInnerText(el) { |
| 581 | +function ts_getInnerText( el ) { |
584 | 582 | return getInnerText( el ); |
585 | 583 | } |
586 | 584 | |
587 | | -function ts_resortTable(lnk) { |
| 585 | +function ts_resortTable( lnk ) { |
588 | 586 | // get the span |
589 | 587 | var span = lnk.getElementsByTagName('span')[0]; |
590 | 588 | |
— | — | @@ -592,7 +590,7 @@ |
593 | 591 | var column = td.cellIndex; |
594 | 592 | |
595 | 593 | var table = tr.parentNode; |
596 | | - while (table && !(table.tagName && table.tagName.toLowerCase() == 'table')) { |
| 594 | + while ( table && !( table.tagName && table.tagName.toLowerCase() == 'table' ) ) { |
597 | 595 | table = table.parentNode; |
598 | 596 | } |
599 | 597 | if ( !table ) { |
— | — | @@ -604,19 +602,19 @@ |
605 | 603 | } |
606 | 604 | |
607 | 605 | // Generate the number transform table if it's not done already |
608 | | - if (ts_number_transform_table === null) { |
| 606 | + if ( ts_number_transform_table === null ) { |
609 | 607 | ts_initTransformTable(); |
610 | 608 | } |
611 | 609 | |
612 | 610 | // Work out a type for the column |
613 | 611 | // Skip the first row if that's where the headings are |
614 | | - var rowStart = (table.tHead && table.tHead.rows.length > 0 ? 0 : 1); |
| 612 | + var rowStart = ( table.tHead && table.tHead.rows.length > 0 ? 0 : 1 ); |
615 | 613 | |
616 | 614 | var itm = ''; |
617 | | - for (var i = rowStart; i < table.rows.length; i++) { |
618 | | - if (table.rows[i].cells.length > column) { |
| 615 | + for ( var i = rowStart; i < table.rows.length; i++ ) { |
| 616 | + if ( table.rows[i].cells.length > column ) { |
619 | 617 | itm = ts_getInnerText(table.rows[i].cells[column]); |
620 | | - itm = itm.replace(/^[\s\xa0]+/, "").replace(/[\s\xa0]+$/, ""); |
| 618 | + itm = itm.replace(/^[\s\xa0]+/, '').replace(/[\s\xa0]+$/, ''); |
621 | 619 | if ( itm != '' ) { |
622 | 620 | break; |
623 | 621 | } |
— | — | @@ -626,82 +624,84 @@ |
627 | 625 | // TODO: bug 8226, localised date formats |
628 | 626 | var sortfn = ts_sort_generic; |
629 | 627 | var preprocessor = ts_toLowerCase; |
630 | | - if (/^\d\d[\/. -][a-zA-Z]{3}[\/. -]\d\d\d\d$/.test(itm)) { |
| 628 | + if ( /^\d\d[\/. -][a-zA-Z]{3}[\/. -]\d\d\d\d$/.test( itm ) ) { |
631 | 629 | preprocessor = ts_dateToSortKey; |
632 | | - } else if (/^\d\d[\/.-]\d\d[\/.-]\d\d\d\d$/.test(itm)) { |
| 630 | + } else if ( /^\d\d[\/.-]\d\d[\/.-]\d\d\d\d$/.test( itm ) ) { |
633 | 631 | preprocessor = ts_dateToSortKey; |
634 | | - } else if (/^\d\d[\/.-]\d\d[\/.-]\d\d$/.test(itm)) { |
| 632 | + } else if ( /^\d\d[\/.-]\d\d[\/.-]\d\d$/.test( itm ) ) { |
635 | 633 | preprocessor = ts_dateToSortKey; |
636 | 634 | // (minus sign)([pound dollar euro yen currency]|cents) |
637 | | - } else if (/(^([-\u2212] *)?[\u00a3$\u20ac\u00a4\u00a5]|\u00a2$)/.test(itm)) { |
| 635 | + } else if ( /(^([-\u2212] *)?[\u00a3$\u20ac\u00a4\u00a5]|\u00a2$)/.test( itm ) ) { |
638 | 636 | preprocessor = ts_currencyToSortKey; |
639 | | - } else if (ts_number_regex.test(itm)) { |
| 637 | + } else if ( ts_number_regex.test( itm ) ) { |
640 | 638 | preprocessor = ts_parseFloat; |
641 | 639 | } |
642 | 640 | |
643 | | - var reverse = (span.getAttribute("sortdir") == 'down'); |
| 641 | + var reverse = ( span.getAttribute( 'sortdir' ) == 'down' ); |
644 | 642 | |
645 | 643 | var newRows = new Array(); |
646 | 644 | var staticRows = new Array(); |
647 | | - for (var j = rowStart; j < table.rows.length; j++) { |
| 645 | + for ( var j = rowStart; j < table.rows.length; j++ ) { |
648 | 646 | var row = table.rows[j]; |
649 | | - if((" "+row.className+" ").indexOf(" unsortable ") < 0) { |
650 | | - var keyText = ts_getInnerText(row.cells[column]); |
651 | | - if(keyText === undefined) { |
| 647 | + if( (' ' + row.className + ' ').indexOf(' unsortable ') < 0 ) { |
| 648 | + var keyText = ts_getInnerText( row.cells[column] ); |
| 649 | + if( keyText === undefined ) { |
652 | 650 | keyText = ''; |
653 | 651 | } |
654 | | - var oldIndex = (reverse ? -j : j); |
655 | | - var preprocessed = preprocessor( keyText.replace(/^[\s\xa0]+/, "").replace(/[\s\xa0]+$/, "") ); |
| 652 | + var oldIndex = ( reverse ? -j : j ); |
| 653 | + var preprocessed = preprocessor( keyText.replace(/^[\s\xa0]+/, '').replace(/[\s\xa0]+$/, '') ); |
656 | 654 | |
657 | | - newRows[newRows.length] = new Array(row, preprocessed, oldIndex); |
| 655 | + newRows[newRows.length] = new Array( row, preprocessed, oldIndex ); |
658 | 656 | } else { |
659 | | - staticRows[staticRows.length] = new Array(row, false, j-rowStart); |
| 657 | + staticRows[staticRows.length] = new Array( row, false, j-rowStart ); |
660 | 658 | } |
661 | 659 | } |
662 | 660 | |
663 | | - newRows.sort(sortfn); |
| 661 | + newRows.sort( sortfn ); |
664 | 662 | |
665 | 663 | var arrowHTML; |
666 | | - if (reverse) { |
667 | | - arrowHTML = '<img src="'+ ts_image_path + ts_image_down + '" alt="↓"/>'; |
| 664 | + if ( reverse ) { |
| 665 | + arrowHTML = '<img src="' + ts_image_path + ts_image_down + '" alt="↓"/>'; |
668 | 666 | newRows.reverse(); |
669 | | - span.setAttribute('sortdir','up'); |
| 667 | + span.setAttribute( 'sortdir', 'up' ); |
670 | 668 | } else { |
671 | | - arrowHTML = '<img src="'+ ts_image_path + ts_image_up + '" alt="↑"/>'; |
672 | | - span.setAttribute('sortdir','down'); |
| 669 | + arrowHTML = '<img src="' + ts_image_path + ts_image_up + '" alt="↑"/>'; |
| 670 | + span.setAttribute( 'sortdir', 'down' ); |
673 | 671 | } |
674 | 672 | |
675 | | - for (var i = 0; i < staticRows.length; i++) { |
| 673 | + for ( var i = 0; i < staticRows.length; i++ ) { |
676 | 674 | var row = staticRows[i]; |
677 | | - newRows.splice(row[2], 0, row); |
| 675 | + newRows.splice( row[2], 0, row ); |
678 | 676 | } |
679 | 677 | |
680 | 678 | // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones |
681 | 679 | // don't do sortbottom rows |
682 | | - for (var i = 0; i < newRows.length; i++) { |
683 | | - if ((" "+newRows[i][0].className+" ").indexOf(" sortbottom ") == -1) |
684 | | - table.tBodies[0].appendChild(newRows[i][0]); |
| 680 | + for ( var i = 0; i < newRows.length; i++ ) { |
| 681 | + if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') == -1 ) { |
| 682 | + table.tBodies[0].appendChild( newRows[i][0] ); |
| 683 | + } |
685 | 684 | } |
686 | 685 | // do sortbottom rows only |
687 | | - for (var i = 0; i < newRows.length; i++) { |
688 | | - if ((" "+newRows[i][0].className+" ").indexOf(" sortbottom ") != -1) |
689 | | - table.tBodies[0].appendChild(newRows[i][0]); |
| 686 | + for ( var i = 0; i < newRows.length; i++ ) { |
| 687 | + if ( ( ' ' + newRows[i][0].className + ' ').indexOf(' sortbottom ') != -1 ) { |
| 688 | + table.tBodies[0].appendChild( newRows[i][0] ); |
| 689 | + } |
690 | 690 | } |
691 | 691 | |
692 | 692 | // Delete any other arrows there may be showing |
693 | | - var spans = getElementsByClassName(tr, "span", "sortarrow"); |
694 | | - for (var i = 0; i < spans.length; i++) { |
695 | | - spans[i].innerHTML = '<img src="'+ ts_image_path + ts_image_none + '" alt="↓"/>'; |
| 693 | + var spans = getElementsByClassName( tr, 'span', 'sortarrow' ); |
| 694 | + for ( var i = 0; i < spans.length; i++ ) { |
| 695 | + spans[i].innerHTML = '<img src="' + ts_image_path + ts_image_none + '" alt="↓"/>'; |
696 | 696 | } |
697 | 697 | span.innerHTML = arrowHTML; |
698 | 698 | |
699 | | - if (ts_alternate_row_colors) { |
700 | | - ts_alternate(table); |
| 699 | + if ( ts_alternate_row_colors ) { |
| 700 | + ts_alternate( table ); |
701 | 701 | } |
702 | 702 | } |
703 | 703 | |
704 | 704 | function ts_initTransformTable() { |
705 | | - if ( typeof wgSeparatorTransformTable == "undefined" |
| 705 | + if ( typeof wgSeparatorTransformTable == 'undefined' |
706 | 706 | || ( wgSeparatorTransformTable[0] == '' && wgDigitTransformTable[2] == '' ) ) |
707 | 707 | { |
708 | 708 | digitClass = "[0-9,.]"; |
— | — | @@ -731,7 +731,7 @@ |
732 | 732 | digit.replace( /[\\\\$\*\+\?\.\(\)\|\{\}\[\]\-]/, |
733 | 733 | function( s ) { return '\\' + s; } ) |
734 | 734 | ); |
735 | | - if (digit.length > maxDigitLength) { |
| 735 | + if ( digit.length > maxDigitLength ) { |
736 | 736 | maxDigitLength = digit.length; |
737 | 737 | } |
738 | 738 | } |
— | — | @@ -757,57 +757,81 @@ |
758 | 758 | return s.toLowerCase(); |
759 | 759 | } |
760 | 760 | |
761 | | -function ts_dateToSortKey(date) { |
| 761 | +function ts_dateToSortKey( date ) { |
762 | 762 | // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX |
763 | | - if (date.length == 11) { |
764 | | - switch (date.substr(3,3).toLowerCase()) { |
765 | | - case "jan": var month = "01"; break; |
766 | | - case "feb": var month = "02"; break; |
767 | | - case "mar": var month = "03"; break; |
768 | | - case "apr": var month = "04"; break; |
769 | | - case "may": var month = "05"; break; |
770 | | - case "jun": var month = "06"; break; |
771 | | - case "jul": var month = "07"; break; |
772 | | - case "aug": var month = "08"; break; |
773 | | - case "sep": var month = "09"; break; |
774 | | - case "oct": var month = "10"; break; |
775 | | - case "nov": var month = "11"; break; |
776 | | - case "dec": var month = "12"; break; |
777 | | - // default: var month = "00"; |
| 763 | + if ( date.length == 11 ) { |
| 764 | + switch ( date.substr( 3, 3 ).toLowerCase() ) { |
| 765 | + case 'jan': |
| 766 | + var month = '01'; |
| 767 | + break; |
| 768 | + case 'feb': |
| 769 | + var month = '02'; |
| 770 | + break; |
| 771 | + case 'mar': |
| 772 | + var month = '03'; |
| 773 | + break; |
| 774 | + case 'apr': |
| 775 | + var month = '04'; |
| 776 | + break; |
| 777 | + case 'may': |
| 778 | + var month = '05'; |
| 779 | + break; |
| 780 | + case 'jun': |
| 781 | + var month = '06'; |
| 782 | + break; |
| 783 | + case 'jul': |
| 784 | + var month = '07'; |
| 785 | + break; |
| 786 | + case 'aug': |
| 787 | + var month = '08'; |
| 788 | + break; |
| 789 | + case 'sep': |
| 790 | + var month = '09'; |
| 791 | + break; |
| 792 | + case 'oct': |
| 793 | + var month = '10'; |
| 794 | + break; |
| 795 | + case 'nov': |
| 796 | + var month = '11'; |
| 797 | + break; |
| 798 | + case 'dec': |
| 799 | + var month = '12'; |
| 800 | + break; |
| 801 | + // default: var month = '00'; |
778 | 802 | } |
779 | | - return date.substr(7,4)+month+date.substr(0,2); |
780 | | - } else if (date.length == 10) { |
781 | | - if (ts_europeandate == false) { |
782 | | - return date.substr(6,4)+date.substr(0,2)+date.substr(3,2); |
| 803 | + return date.substr( 7, 4 ) + month + date.substr( 0, 2 ); |
| 804 | + } else if ( date.length == 10 ) { |
| 805 | + if ( ts_europeandate == false ) { |
| 806 | + return date.substr( 6, 4 ) + date.substr( 0, 2 ) + date.substr( 3, 2 ); |
783 | 807 | } else { |
784 | | - return date.substr(6,4)+date.substr(3,2)+date.substr(0,2); |
| 808 | + return date.substr( 6, 4 ) + date.substr( 3, 2 ) + date.substr( 0, 2 ); |
785 | 809 | } |
786 | | - } else if (date.length == 8) { |
787 | | - yr = date.substr(6,2); |
788 | | - if (parseInt(yr) < 50) { |
789 | | - yr = '20'+yr; |
| 810 | + } else if ( date.length == 8 ) { |
| 811 | + yr = date.substr( 6, 2 ); |
| 812 | + if ( parseInt( yr ) < 50 ) { |
| 813 | + yr = '20' + yr; |
790 | 814 | } else { |
791 | | - yr = '19'+yr; |
| 815 | + yr = '19' + yr; |
792 | 816 | } |
793 | | - if (ts_europeandate == true) { |
794 | | - return yr+date.substr(3,2)+date.substr(0,2); |
| 817 | + if ( ts_europeandate == true ) { |
| 818 | + return yr + date.substr( 3, 2 ) + date.substr( 0, 2 ); |
795 | 819 | } else { |
796 | | - return yr+date.substr(0,2)+date.substr(3,2); |
| 820 | + return yr + date.substr( 0, 2 ) + date.substr( 3, 2 ); |
797 | 821 | } |
798 | 822 | } |
799 | | - return "00000000"; |
| 823 | + return '00000000'; |
800 | 824 | } |
801 | 825 | |
802 | 826 | function ts_parseFloat( s ) { |
803 | 827 | if ( !s ) { |
804 | 828 | return 0; |
805 | 829 | } |
806 | | - if (ts_number_transform_table != false) { |
| 830 | + if ( ts_number_transform_table != false ) { |
807 | 831 | var newNum = '', c; |
808 | 832 | |
809 | 833 | for ( var p = 0; p < s.length; p++ ) { |
810 | 834 | c = s.charAt( p ); |
811 | | - if (c in ts_number_transform_table) { |
| 835 | + if ( c in ts_number_transform_table ) { |
812 | 836 | newNum += ts_number_transform_table[c]; |
813 | 837 | } else { |
814 | 838 | newNum += c; |
— | — | @@ -815,36 +839,37 @@ |
816 | 840 | } |
817 | 841 | s = newNum; |
818 | 842 | } |
819 | | - num = parseFloat(s.replace(/[, ]/g, "").replace("\u2212", "-")); |
820 | | - return (isNaN(num) ? -Infinity : num); |
| 843 | + num = parseFloat( s.replace(/[, ]/g, '').replace("\u2212", '-') ); |
| 844 | + return ( isNaN( num ) ? -Infinity : num ); |
821 | 845 | } |
822 | 846 | |
823 | 847 | function ts_currencyToSortKey( s ) { |
824 | 848 | return ts_parseFloat(s.replace(/[^-\u22120-9.,]/g,'')); |
825 | 849 | } |
826 | 850 | |
827 | | -function ts_sort_generic(a, b) { |
| 851 | +function ts_sort_generic( a, b ) { |
828 | 852 | return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : a[2] - b[2]; |
829 | 853 | } |
830 | 854 | |
831 | | -function ts_alternate(table) { |
| 855 | +function ts_alternate( table ) { |
832 | 856 | // Take object table and get all it's tbodies. |
833 | | - var tableBodies = table.getElementsByTagName("tbody"); |
| 857 | + var tableBodies = table.getElementsByTagName( 'tbody' ); |
834 | 858 | // Loop through these tbodies |
835 | | - for (var i = 0; i < tableBodies.length; i++) { |
| 859 | + for ( var i = 0; i < tableBodies.length; i++ ) { |
836 | 860 | // Take the tbody, and get all it's rows |
837 | | - var tableRows = tableBodies[i].getElementsByTagName("tr"); |
| 861 | + var tableRows = tableBodies[i].getElementsByTagName( 'tr' ); |
838 | 862 | // Loop through these rows |
839 | 863 | // Start at 1 because we want to leave the heading row untouched |
840 | | - for (var j = 0; j < tableRows.length; j++) { |
| 864 | + for ( var j = 0; j < tableRows.length; j++ ) { |
841 | 865 | // Check if j is even, and apply classes for both possible results |
842 | | - var oldClasses = tableRows[j].className.split(" "); |
843 | | - var newClassName = ""; |
844 | | - for (var k = 0; k < oldClasses.length; k++) { |
845 | | - if (oldClasses[k] != "" && oldClasses[k] != "even" && oldClasses[k] != "odd") |
846 | | - newClassName += oldClasses[k] + " "; |
| 866 | + var oldClasses = tableRows[j].className.split(' '); |
| 867 | + var newClassName = ''; |
| 868 | + for ( var k = 0; k < oldClasses.length; k++ ) { |
| 869 | + if ( oldClasses[k] != '' && oldClasses[k] != 'even' && oldClasses[k] != 'odd' ) { |
| 870 | + newClassName += oldClasses[k] + ' '; |
| 871 | + } |
847 | 872 | } |
848 | | - tableRows[j].className = newClassName + (j % 2 == 0 ? "even" : "odd"); |
| 873 | + tableRows[j].className = newClassName + ( j % 2 == 0 ? 'even' : 'odd' ); |
849 | 874 | } |
850 | 875 | } |
851 | 876 | } |
— | — | @@ -880,7 +905,7 @@ |
881 | 906 | messageDiv, |
882 | 907 | document.getElementById( 'content' ).firstChild |
883 | 908 | ); |
884 | | - } else if ( document.getElementById('content') |
| 909 | + } else if ( document.getElementById( 'content' ) |
885 | 910 | && document.getElementById( 'article' ) ) { |
886 | 911 | // Non-Monobook but still recognizable (old-style) |
887 | 912 | document.getElementById( 'article').insertBefore( |
— | — | @@ -895,15 +920,15 @@ |
896 | 921 | messageDiv.setAttribute( 'id', 'mw-js-message' ); |
897 | 922 | messageDiv.style.display = 'block'; |
898 | 923 | if( className ) { |
899 | | - messageDiv.setAttribute( 'class', 'mw-js-message-'+className ); |
| 924 | + messageDiv.setAttribute( 'class', 'mw-js-message-' + className ); |
900 | 925 | } |
901 | 926 | |
902 | | - if (typeof message === 'object') { |
903 | | - while (messageDiv.hasChildNodes()) // Remove old content |
904 | | - messageDiv.removeChild(messageDiv.firstChild); |
905 | | - messageDiv.appendChild (message); // Append new content |
906 | | - } |
907 | | - else { |
| 927 | + if ( typeof message === 'object' ) { |
| 928 | + while ( messageDiv.hasChildNodes() ) { // Remove old content |
| 929 | + messageDiv.removeChild( messageDiv.firstChild ); |
| 930 | + } |
| 931 | + messageDiv.appendChild( message ); // Append new content |
| 932 | + } else { |
908 | 933 | messageDiv.innerHTML = message; |
909 | 934 | } |
910 | 935 | return true; |
— | — | @@ -916,10 +941,10 @@ |
917 | 942 | * @param id Identifier string (for use with removeSpinner(), below) |
918 | 943 | */ |
919 | 944 | function injectSpinner( element, id ) { |
920 | | - var spinner = document.createElement( "img" ); |
921 | | - spinner.id = "mw-spinner-" + id; |
922 | | - spinner.src = stylepath + "/common/images/spinner.gif"; |
923 | | - spinner.alt = spinner.title = "..."; |
| 945 | + var spinner = document.createElement( 'img' ); |
| 946 | + spinner.id = 'mw-spinner-' + id; |
| 947 | + spinner.src = stylepath + '/common/images/spinner.gif'; |
| 948 | + spinner.alt = spinner.title = '...'; |
924 | 949 | if( element.nextSibling ) { |
925 | 950 | element.parentNode.insertBefore( spinner, element.nextSibling ); |
926 | 951 | } else { |
— | — | @@ -933,7 +958,7 @@ |
934 | 959 | * @param id Identifier string |
935 | 960 | */ |
936 | 961 | function removeSpinner( id ) { |
937 | | - var spinner = document.getElementById( "mw-spinner-" + id ); |
| 962 | + var spinner = document.getElementById( 'mw-spinner-' + id ); |
938 | 963 | if( spinner ) { |
939 | 964 | spinner.parentNode.removeChild( spinner ); |
940 | 965 | } |
— | — | @@ -941,7 +966,7 @@ |
942 | 967 | |
943 | 968 | function runOnloadHook() { |
944 | 969 | // don't run anything below this for non-dom browsers |
945 | | - if (doneOnloadHook || !(document.getElementById && document.getElementsByTagName)) { |
| 970 | + if ( doneOnloadHook || !( document.getElementById && document.getElementsByTagName ) ) { |
946 | 971 | return; |
947 | 972 | } |
948 | 973 | |
— | — | @@ -954,7 +979,7 @@ |
955 | 980 | sortables_init(); |
956 | 981 | |
957 | 982 | // Run any added-on functions |
958 | | - for (var i = 0; i < onloadFuncts.length; i++) { |
| 983 | + for ( var i = 0; i < onloadFuncts.length; i++ ) { |
959 | 984 | onloadFuncts[i](); |
960 | 985 | } |
961 | 986 | } |
— | — | @@ -998,20 +1023,21 @@ |
999 | 1024 | element.detachEvent( 'on' + remove, handler ); |
1000 | 1025 | } |
1001 | 1026 | } |
1002 | | -//note: all skins should call runOnloadHook() at the end of html output, |
| 1027 | +// note: all skins should call runOnloadHook() at the end of html output, |
1003 | 1028 | // so the below should be redundant. It's there just in case. |
1004 | | -hookEvent("load", runOnloadHook); |
| 1029 | +hookEvent( 'load', runOnloadHook ); |
1005 | 1030 | |
1006 | 1031 | if ( ie6_bugs ) { |
1007 | | - var isMSIE55 = (window.showModalDialog && window.clipboardData && window.createPopup); |
| 1032 | + var isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup ); |
1008 | 1033 | var doneIETransform; |
1009 | 1034 | var doneIEAlphaFix; |
1010 | 1035 | |
1011 | | - if (document.attachEvent) |
1012 | | - document.attachEvent('onreadystatechange', hookit); |
| 1036 | + if ( document.attachEvent ) { |
| 1037 | + document.attachEvent( 'onreadystatechange', hookit ); |
| 1038 | + } |
1013 | 1039 | |
1014 | 1040 | function hookit() { |
1015 | | - if (!doneIETransform && document.getElementById && document.getElementById('bodyContent')) { |
| 1041 | + if ( !doneIETransform && document.getElementById && document.getElementById( 'bodyContent' ) ) { |
1016 | 1042 | doneIETransform = true; |
1017 | 1043 | relativeforfloats(); |
1018 | 1044 | fixalpha(); |
— | — | @@ -1021,21 +1047,24 @@ |
1022 | 1048 | // png alpha transparency fixes |
1023 | 1049 | function fixalpha( logoId ) { |
1024 | 1050 | // bg |
1025 | | - if (isMSIE55 && !doneIEAlphaFix) |
1026 | | - { |
| 1051 | + if ( isMSIE55 && !doneIEAlphaFix ) { |
1027 | 1052 | var plogo = document.getElementById( logoId || 'p-logo' ); |
1028 | | - if (!plogo) return; |
| 1053 | + if ( !plogo ) { |
| 1054 | + return; |
| 1055 | + } |
1029 | 1056 | |
1030 | 1057 | var logoa = plogo.getElementsByTagName('a')[0]; |
1031 | | - if (!logoa) return; |
| 1058 | + if ( !logoa ) { |
| 1059 | + return; |
| 1060 | + } |
1032 | 1061 | |
1033 | 1062 | var bg = logoa.currentStyle.backgroundImage; |
1034 | | - var imageUrl = bg.substring(5, bg.length-2); |
| 1063 | + var imageUrl = bg.substring( 5, bg.length - 2 ); |
1035 | 1064 | |
1036 | 1065 | doneIEAlphaFix = true; |
1037 | 1066 | |
1038 | | - if (imageUrl.substr(imageUrl.length-4).toLowerCase() == '.png') { |
1039 | | - var logospan = logoa.appendChild(document.createElement('span')); |
| 1067 | + if ( imageUrl.substr( imageUrl.length - 4 ).toLowerCase() == '.png' ) { |
| 1068 | + var logospan = logoa.appendChild( document.createElement( 'span' ) ); |
1040 | 1069 | |
1041 | 1070 | logoa.style.backgroundImage = 'none'; |
1042 | 1071 | logospan.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')'; |
— | — | @@ -1044,20 +1073,17 @@ |
1045 | 1074 | logospan.style.width = logoa.currentStyle.width; |
1046 | 1075 | logospan.style.cursor = 'hand'; |
1047 | 1076 | // Center image with hack for IE5.5 |
1048 | | - if (document.documentElement.dir == "rtl") |
1049 | | - { |
1050 | | - logospan.style.right = '50%'; |
1051 | | - logospan.style.setExpression('marginRight', '"-" + (this.offsetWidth / 2) + "px"'); |
| 1077 | + if ( document.documentElement.dir == 'rtl' ) { |
| 1078 | + logospan.style.right = '50%'; |
| 1079 | + logospan.style.setExpression( 'marginRight', '"-" + (this.offsetWidth / 2) + "px"' ); |
| 1080 | + } else { |
| 1081 | + logospan.style.left = '50%'; |
| 1082 | + logospan.style.setExpression( 'marginLeft', '"-" + (this.offsetWidth / 2) + "px"' ); |
1052 | 1083 | } |
1053 | | - else |
1054 | | - { |
1055 | | - logospan.style.left = '50%'; |
1056 | | - logospan.style.setExpression('marginLeft', '"-" + (this.offsetWidth / 2) + "px"'); |
1057 | | - } |
1058 | 1084 | logospan.style.top = '50%'; |
1059 | | - logospan.style.setExpression('marginTop', '"-" + (this.offsetHeight / 2) + "px"'); |
| 1085 | + logospan.style.setExpression( 'marginTop', '"-" + (this.offsetHeight / 2) + "px"' ); |
1060 | 1086 | |
1061 | | - var linkFix = logoa.appendChild(logoa.cloneNode()); |
| 1087 | + var linkFix = logoa.appendChild( logoa.cloneNode() ); |
1062 | 1088 | linkFix.style.position = 'absolute'; |
1063 | 1089 | linkFix.style.height = '100%'; |
1064 | 1090 | linkFix.style.width = '100%'; |
— | — | @@ -1067,20 +1093,20 @@ |
1068 | 1094 | |
1069 | 1095 | // fix ie6 disappering float bug |
1070 | 1096 | function relativeforfloats() { |
1071 | | - var bc = document.getElementById('bodyContent'); |
1072 | | - if (bc) { |
1073 | | - var tables = bc.getElementsByTagName('table'); |
1074 | | - var divs = bc.getElementsByTagName('div'); |
| 1097 | + var bc = document.getElementById( 'bodyContent' ); |
| 1098 | + if ( bc ) { |
| 1099 | + var tables = bc.getElementsByTagName( 'table' ); |
| 1100 | + var divs = bc.getElementsByTagName( 'div' ); |
1075 | 1101 | } |
1076 | | - setrelative(tables); |
1077 | | - setrelative(divs); |
| 1102 | + setrelative( tables ); |
| 1103 | + setrelative( divs ); |
1078 | 1104 | } |
1079 | | - function setrelative (nodes) { |
| 1105 | + function setrelative( nodes ) { |
1080 | 1106 | var i = 0; |
1081 | | - while (i < nodes.length) { |
1082 | | - if(((nodes[i].style.float && nodes[i].style.float != ('none') || |
1083 | | - (nodes[i].align && nodes[i].align != ('none'))) && |
1084 | | - (!nodes[i].style.position || nodes[i].style.position != 'relative'))) |
| 1107 | + while ( i < nodes.length ) { |
| 1108 | + if( ( ( nodes[i].style.float && nodes[i].style.float != ( 'none' ) || |
| 1109 | + ( nodes[i].align && nodes[i].align != ( 'none' ) ) ) && |
| 1110 | + ( !nodes[i].style.position || nodes[i].style.position != 'relative' ) ) ) |
1085 | 1111 | { |
1086 | 1112 | nodes[i].style.position = 'relative'; |
1087 | 1113 | } |
— | — | @@ -1088,14 +1114,14 @@ |
1089 | 1115 | } |
1090 | 1116 | } |
1091 | 1117 | |
1092 | | - |
1093 | 1118 | // Expand links for printing |
1094 | | - |
1095 | | - String.prototype.hasClass = function(classWanted) |
1096 | | - { |
| 1119 | + String.prototype.hasClass = function( classWanted ) { |
1097 | 1120 | var classArr = this.split(/\s/); |
1098 | | - for (var i=0; i<classArr.length; i++) |
1099 | | - if (classArr[i].toLowerCase() == classWanted.toLowerCase()) return true; |
| 1121 | + for ( var i = 0; i < classArr.length; i++ ) { |
| 1122 | + if ( classArr[i].toLowerCase() == classWanted.toLowerCase() ) { |
| 1123 | + return true; |
| 1124 | + } |
| 1125 | + } |
1100 | 1126 | return false; |
1101 | 1127 | } |
1102 | 1128 | |
— | — | @@ -1104,27 +1130,28 @@ |
1105 | 1131 | onbeforeprint = function() { |
1106 | 1132 | expandedURLs = []; |
1107 | 1133 | |
1108 | | - var contentEl = document.getElementById("content"); |
| 1134 | + var contentEl = document.getElementById( 'content' ); |
1109 | 1135 | |
1110 | | - if (contentEl) |
1111 | | - { |
1112 | | - var allLinks = contentEl.getElementsByTagName("a"); |
| 1136 | + if ( contentEl ) { |
| 1137 | + var allLinks = contentEl.getElementsByTagName( 'a' ); |
1113 | 1138 | |
1114 | | - for (var i=0; i < allLinks.length; i++) { |
1115 | | - if (allLinks[i].className.hasClass("external") && !allLinks[i].className.hasClass("free")) { |
1116 | | - var expandedLink = document.createElement("span"); |
1117 | | - var expandedText = document.createTextNode(" (" + allLinks[i].href + ")"); |
1118 | | - expandedLink.appendChild(expandedText); |
1119 | | - allLinks[i].parentNode.insertBefore(expandedLink, allLinks[i].nextSibling); |
1120 | | - expandedURLs[i] = expandedLink; |
1121 | | - } |
1122 | | - } |
1123 | | - } |
| 1139 | + for ( var i = 0; i < allLinks.length; i++ ) { |
| 1140 | + if ( allLinks[i].className.hasClass( 'external' ) && !allLinks[i].className.hasClass( 'free' ) ) { |
| 1141 | + var expandedLink = document.createElement( 'span' ); |
| 1142 | + var expandedText = document.createTextNode( ' (' + allLinks[i].href + ')' ); |
| 1143 | + expandedLink.appendChild( expandedText ); |
| 1144 | + allLinks[i].parentNode.insertBefore( expandedLink, allLinks[i].nextSibling ); |
| 1145 | + expandedURLs[i] = expandedLink; |
| 1146 | + } |
| 1147 | + } |
| 1148 | + } |
1124 | 1149 | } |
1125 | 1150 | |
1126 | 1151 | onafterprint = function() { |
1127 | | - for (var i=0; i < expandedURLs.length; i++) |
1128 | | - if (expandedURLs[i]) |
1129 | | - expandedURLs[i].removeNode(true); |
| 1152 | + for ( var i = 0; i < expandedURLs.length; i++ ) { |
| 1153 | + if ( expandedURLs[i] ) { |
| 1154 | + expandedURLs[i].removeNode( true ); |
| 1155 | + } |
| 1156 | + } |
1130 | 1157 | } |
1131 | 1158 | } |
Index: trunk/phase3/skins/common/htmlform.js |
— | — | @@ -1,30 +1,36 @@ |
2 | 2 | // Find select-or-other fields. |
3 | 3 | addOnloadHook( function() { |
4 | 4 | var fields = getElementsByClassName( document, 'select', 'mw-htmlform-select-or-other' ); |
5 | | - |
| 5 | + |
6 | 6 | for( var i = 0; i < fields.length; i++ ) { |
7 | 7 | var select = fields[i]; |
8 | | - |
| 8 | + |
9 | 9 | addHandler( select, 'change', htmlforms.selectOrOtherSelectChanged ); |
10 | | - |
| 10 | + |
11 | 11 | // Use a fake 'e' to update it. |
12 | 12 | htmlforms.selectOrOtherSelectChanged( { 'target': select } ); |
13 | 13 | } |
14 | 14 | } ); |
15 | 15 | |
16 | 16 | var htmlforms = { |
17 | | - 'selectOrOtherSelectChanged' : function(e) { |
| 17 | + 'selectOrOtherSelectChanged' : function( e ) { |
18 | 18 | var select; |
19 | | - if (!e) e = window.event; |
20 | | - if (e.target) select = e.target; |
21 | | - else if (e.srcElement) select = e.srcElement; |
22 | | - if (select.nodeType == 3) // defeat Safari bug |
| 19 | + if ( !e ) { |
| 20 | + e = window.event; |
| 21 | + } |
| 22 | + if ( e.target ) { |
| 23 | + select = e.target; |
| 24 | + } else if ( e.srcElement ) { |
| 25 | + select = e.srcElement; |
| 26 | + } |
| 27 | + if ( select.nodeType == 3 ) { // defeat Safari bug |
23 | 28 | select = select.parentNode; |
24 | | - |
| 29 | + } |
| 30 | + |
25 | 31 | var id = select.id; |
26 | | - var textbox = document.getElementById( id+'-other' ); |
27 | | - |
28 | | - if (select.value == 'other') { |
| 32 | + var textbox = document.getElementById( id + '-other' ); |
| 33 | + |
| 34 | + if ( select.value == 'other' ) { |
29 | 35 | textbox.disabled = false; |
30 | 36 | } else { |
31 | 37 | textbox.disabled = true; |
Index: trunk/phase3/skins/common/block.js |
— | — | @@ -1,19 +1,19 @@ |
2 | | -addOnloadHook(considerChangingExpiryFocus); |
| 2 | +addOnloadHook( considerChangingExpiryFocus ); |
3 | 3 | |
4 | 4 | function considerChangingExpiryFocus() { |
5 | | - if (!document.getElementById) { |
| 5 | + if ( !document.getElementById ) { |
6 | 6 | return; |
7 | 7 | } |
8 | | - var drop = document.getElementById('wpBlockExpiry'); |
9 | | - if (!drop) { |
| 8 | + var drop = document.getElementById( 'wpBlockExpiry' ); |
| 9 | + if ( !drop ) { |
10 | 10 | return; |
11 | 11 | } |
12 | | - var field = document.getElementById('wpBlockOther'); |
13 | | - if (!field) { |
| 12 | + var field = document.getElementById( 'wpBlockOther' ); |
| 13 | + if ( !field ) { |
14 | 14 | return; |
15 | 15 | } |
16 | 16 | var opt = drop.value; |
17 | | - if (opt == 'other') { |
| 17 | + if ( opt == 'other' ) { |
18 | 18 | field.style.display = ''; |
19 | 19 | } else { |
20 | 20 | field.style.display = 'none'; |
— | — | @@ -21,34 +21,36 @@ |
22 | 22 | } |
23 | 23 | |
24 | 24 | function updateBlockOptions() { |
25 | | - if (!document.getElementById) |
| 25 | + if ( !document.getElementById ) { |
26 | 26 | return; |
| 27 | + } |
27 | 28 | |
28 | | - var target = document.getElementById('mw-bi-target'); |
29 | | - if (!target) |
| 29 | + var target = document.getElementById( 'mw-bi-target' ); |
| 30 | + if ( !target ) { |
30 | 31 | return; |
| 32 | + } |
31 | 33 | |
32 | 34 | var addy = target.value; |
33 | 35 | var isEmpty = addy.match(/^\s*$/); |
34 | 36 | var isIp = addy.match(/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?$/); |
35 | 37 | var isIpRange = isIp && addy.match(/\/\d+$/); |
36 | 38 | |
37 | | - var anonymousRow = document.getElementById('wpAnonOnlyRow'); |
| 39 | + var anonymousRow = document.getElementById( 'wpAnonOnlyRow' ); |
38 | 40 | if( anonymousRow ) { |
39 | | - anonymousRow.style.display = (!isIp && !isEmpty) ? 'none' : ''; |
| 41 | + anonymousRow.style.display = ( !isIp && !isEmpty ) ? 'none' : ''; |
40 | 42 | } |
41 | 43 | |
42 | | - var autoblockRow = document.getElementById('wpEnableAutoblockRow'); |
| 44 | + var autoblockRow = document.getElementById( 'wpEnableAutoblockRow' ); |
43 | 45 | if( autoblockRow ) { |
44 | 46 | autoblockRow.style.display = isIp && !isEmpty ? 'none' : ''; |
45 | 47 | } |
46 | 48 | |
47 | | - var hideuserRow = document.getElementById('wpEnableHideUser'); |
| 49 | + var hideuserRow = document.getElementById( 'wpEnableHideUser' ); |
48 | 50 | if( hideuserRow ) { |
49 | 51 | hideuserRow.style.display = isIp && !isEmpty ? 'none' : ''; |
50 | 52 | } |
51 | 53 | |
52 | | - var watchuserRow = document.getElementById('wpEnableWatchUser'); |
| 54 | + var watchuserRow = document.getElementById( 'wpEnableWatchUser' ); |
53 | 55 | if( watchuserRow ) { |
54 | 56 | watchuserRow.style.display = isIpRange && !isEmpty ? 'none' : ''; |
55 | 57 | } |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1658,7 +1658,7 @@ |
1659 | 1659 | * to ensure that client-side caches do not keep obsolete copies of global |
1660 | 1660 | * styles. |
1661 | 1661 | */ |
1662 | | -$wgStyleVersion = '260'; |
| 1662 | +$wgStyleVersion = '261'; |
1663 | 1663 | |
1664 | 1664 | |
1665 | 1665 | # Server-side caching: |