r61006 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61005‎ | r61006 | r61007 >
Date:13:17, 13 January 2010
Author:ashley
Status:ok
Tags:
Comment:
JavaScript cleanup: add spacing, missing braces, use single quotes instead of double quotes where appropriate and fix some comparisons
Modified paths:
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/skins/common/block.js (modified) (history)
  • /trunk/phase3/skins/common/edit.js (modified) (history)
  • /trunk/phase3/skins/common/htmlform.js (modified) (history)
  • /trunk/phase3/skins/common/metadata.js (modified) (history)
  • /trunk/phase3/skins/common/prefs.js (modified) (history)
  • /trunk/phase3/skins/common/search.js (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/search.js
@@ -1,40 +1,45 @@
22 // JS specific to Special:Search
33
44 // 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 ) {
1011 return; // should always have either normal or advanced search
11 -
 12+ }
 13+
1214 var searchterm = searchbox.value;
13 - var parts = obj.href.split("search=");
 15+ var parts = obj.href.split( 'search=' );
1416 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;
2124 }
2225
2326 function mwToggleSearchCheckboxes( btn ) {
24 - if( !document.getElementById ) return;
25 -
 27+ if( !document.getElementById ) {
 28+ return;
 29+ }
 30+
2631 var nsInputs = document.getElementById( 'powersearch' ).getElementsByTagName( 'input' );
2732 var isChecked = false;
28 -
 33+
2934 for ( var i = 0; i < nsInputs.length; i++ ) {
3035 var pattern = /^ns/;
3136 if ( ( nsInputs[i].type == 'checkbox' ) && ( pattern.test( nsInputs[i].name ) ) ) {
3237 switch ( btn ) {
33 - case "none":
 38+ case 'none':
3439 if ( nsInputs[i].checked ) {
3540 nsInputs[i].checked = false;
3641 }
3742 break;
38 - case "all":
 43+ case 'all':
3944 if ( !nsInputs[i].checked ) {
4045 nsInputs[i].checked = true;
4146 }
Index: trunk/phase3/skins/common/prefs.js
@@ -1,73 +1,74 @@
2 -
32 // generate toc from prefs form, fold sections
43 // XXX: needs testing on IE/Mac and safari
54 // more comments to follow
65 function tabbedprefs() {
7 - var prefform = document.getElementById('preferences');
8 - if (!prefform || !document.createElement) {
 6+ var prefform = document.getElementById( 'preferences' );
 7+ if ( !prefform || !document.createElement ) {
98 return;
109 }
11 - if (prefform.nodeName.toLowerCase() == 'a') {
 10+ if ( prefform.nodeName.toLowerCase() == 'a' ) {
1211 return; // Occasional IE problem
1312 }
1413 prefform.className = prefform.className + 'jsprefs';
1514 var sections = [];
1615 var children = prefform.childNodes;
1716 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' ) {
2019 children[i].id = 'prefsection-' + seci;
2120 children[i].className = 'prefsection';
22 - if (is_opera) {
 21+ if ( is_opera ) {
2322 children[i].className = 'prefsection operaprefsection';
2423 }
2524 var legends = children[i].getElementsByTagName('legend');
2625 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 ) {
2930 sections[seci].text = legends[0].firstChild.nodeValue;
3031 } else {
3132 sections[seci].text = '# ' + seci;
3233 }
3334 sections[seci].secid = children[i].id;
3435 seci++;
35 - if (sections.length != 1) {
 36+ if ( sections.length != 1 ) {
3637 children[i].style.display = 'none';
3738 } else {
3839 var selectedid = children[i].id;
3940 }
4041 }
4142 }
42 - var toc = document.createElement('ul');
 43+ var toc = document.createElement( 'ul' );
4344 toc.id = 'preftoc';
4445 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 ) {
4849 li.className = 'selected';
4950 }
50 - var a = document.createElement('a');
 51+ var a = document.createElement( 'a' );
5152 a.href = '#' + sections[i].secid;
5253 a.onmousedown = a.onclick = uncoversection;
53 - a.appendChild(document.createTextNode(sections[i].text));
 54+ a.appendChild( document.createTextNode( sections[i].text ) );
5455 a.secid = sections[i].secid;
55 - li.appendChild(a);
56 - toc.appendChild(li);
 56+ li.appendChild( a );
 57+ toc.appendChild( li );
5758 }
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';
6061 }
6162
6263 function uncoversection() {
6364 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';
6869 newsec.style.display = 'block';
6970 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++ ) {
7273 lis[i].className = '';
7374 }
7475 this.parentNode.className = 'selected';
@@ -77,29 +78,29 @@
7879
7980 // Timezone stuff
8081 // tz in format [+-]HHMM
81 -function checkTimezone(tz, msg) {
 82+function checkTimezone( tz, msg ) {
8283 var localclock = new Date();
8384 // returns negative offset from GMT in minutes
8485 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 ) {
8990 var junk = msg.split('$1');
90 - document.write(junk[0] + "UTC" + tzString + junk[1]);
 91+ document.write( junk[0] + 'UTC' + tzString + junk[1] );
9192 }
9293 }
9394
9495 function timezoneSetup() {
9596 var tzSelect = document.getElementById( 'mw-input-timecorrection' );
9697 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 ); } );
101102 }
102 -
103 - updateTimezoneSelection(false);
 103+
 104+ updateTimezoneSelection( false );
104105 }
105106
106107 // in [-]HH:MM format...
@@ -109,86 +110,108 @@
110111 var localclock = new Date();
111112 // returns negative offset from GMT in minutes
112113 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;
117118 return tzString;
118119 }
119120
120121 function guessTimezone() {
121 - var textbox = document.getElementById("mw-input-timecorrection-other");
 122+ var textbox = document.getElementById( 'mw-input-timecorrection-other' );
122123 var selector = document.getElementById( 'mw-input-timecorrection' );
123 -
 124+
124125 selector.value = 'other';
125126 textbox.value = fetchTimezone();
126127 textbox.disabled = false; // The changed handler doesn't trip, obviously.
127 - updateTimezoneSelection(true);
 128+ updateTimezoneSelection( true );
128129 }
129130
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' ) {
134135 return guessTimezone();
135136 }
136 -
 137+
137138 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;
140141 var minDiff = 0;
141 -
 142+
142143 // 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+ }
144147
145148 // Handle force_offset
146 - if (force_offset) selector.value = 'other';
147 -
 149+ if ( force_offset ) {
 150+ selector.value = 'other';
 151+ }
 152+
148153 // Get min_diff
149 - if (selector.value == 'other') {
 154+ if ( selector.value == 'other' ) {
150155 // Grab data from the textbox, parse it.
151156 var diffArr = textbox.value.split(':');
152 - if (diffArr.length == 1) {
 157+ if ( diffArr.length == 1 ) {
153158 // Specification is of the form [-]XX
154 - minDiff = parseInt(diffArr[0], 10) * 60;
 159+ minDiff = parseInt( diffArr[0], 10 ) * 60;
155160 } else {
156161 // 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+ }
159166 }
160167 } else {
161168 // Grab data from the selector value
162169 var diffArr = selector.value.split('|');
163 - minDiff = parseInt(diffArr[1], 10);
 170+ minDiff = parseInt( diffArr[1], 10 );
164171 }
165 -
 172+
166173 // Gracefully handle non-numbers.
167 - if (isNaN(minDiff)) minDiff = 0;
168 -
 174+ if ( isNaN( minDiff ) ) {
 175+ minDiff = 0;
 176+ }
 177+
169178 // 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+
172181 // 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+ }
175188
176189 // 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+ }
179194 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 );
182199
183200 // 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+ }
188209 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;
191214 }
192215 }
193216
194 -addOnloadHook(timezoneSetup);
195 -addOnloadHook(tabbedprefs);
 217+addOnloadHook( timezoneSetup );
 218+addOnloadHook( tabbedprefs );
Index: trunk/phase3/skins/common/metadata.js
@@ -3,42 +3,42 @@
44 // Add an expand/collapse link and collapse by default if set to
55 // (with JS disabled, user will see all items)
66 //
7 -// attachMetadataToggle("mw_metadata", "More...", "Fewer...");
 7+// attachMetadataToggle('mw_metadata', 'More...', 'Fewer...');
88
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 ) {
1413 return false;
 14+ }
1515
1616 var tbody = box.getElementsByTagName('tbody')[0];
1717
18 - var row = document.createElement('tr');
 18+ var row = document.createElement( 'tr' );
1919
20 - var col = document.createElement('td');
 20+ var col = document.createElement( 'td' );
2121 col.colSpan = 2;
2222
23 - var link = document.createElement('a');
 23+ var link = document.createElement( 'a' );
2424 link.href = '#';
2525
2626 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 );
2929 box.className = 'mw_metadata expanded';
3030 } else {
31 - changeText(link, showText);
 31+ changeText( link, showText );
3232 box.className = 'mw_metadata collapsed';
3333 }
3434 return false;
35 - }
 35+ };
3636
37 - var text = document.createTextNode(hideText);
 37+ var text = document.createTextNode( hideText );
3838
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 );
4343
4444 // And collapse!
4545 link.onclick();
Index: trunk/phase3/skins/common/edit.js
@@ -2,144 +2,150 @@
33
44 // this function generates the actual toolbar buttons with localized text
55 // 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 ) {
77 // Don't generate buttons for browsers which don't fully
88 // 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+ });
1617 }
1718
1819 // 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' );
2223 image.width = 23;
2324 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+ }
2629 image.src = item.imageFile;
2730 image.border = 0;
2831 image.alt = item.speedTip;
2932 image.title = item.speedTip;
30 - image.style.cursor = "pointer";
 33+ image.style.cursor = 'pointer';
3134 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, "-") );
3639 }
3740 return false;
3841 };
3942
40 - parent.appendChild(image);
 43+ parent.appendChild( image );
4144 return true;
4245 }
4346
4447 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+ }
4752
4853 // Don't generate buttons for browsers which don't fully
4954 // support it.
5055 // but don't assume wpTextbox1 is always here
51 - var textboxes = document.getElementsByTagName('textarea');
 56+ var textboxes = document.getElementsByTagName( 'textarea' );
5257 if ( !textboxes.length ) {
5358 // No toolbar if we can't find any textarea
5459 return false;
5560 }
56 - if (!(document.selection && document.selection.createRange)
57 - && textboxes[0].selectionStart === null) {
 61+ if ( !( document.selection && document.selection.createRange )
 62+ && textboxes[0].selectionStart === null ) {
5863 return false;
5964 }
6065
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] );
6368 }
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] );
6671 }
6772 return true;
6873 }
6974
7075 // apply tagOpen/tagClose to selection in textarea,
7176 // use sampleText instead of selection if there is none
72 -function insertTags(tagOpen, tagClose, sampleText) {
 77+function insertTags( tagOpen, tagClose, sampleText ) {
7378 var txtarea;
74 - if (document.editform) {
 79+ if ( document.editform ) {
7580 txtarea = currentFocused;
7681 } else {
7782 // some alternate form? take the first one we can find
78 - var areas = document.getElementsByTagName('textarea');
 83+ var areas = document.getElementsByTagName( 'textarea' );
7984 txtarea = areas[0];
8085 }
8186 var selText, isSample = false;
8287
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 ) {
8791 var winScroll = document.documentElement.scrollTop
88 - else if (document.body)
 92+ } else if ( document.body ) {
8993 var winScroll = document.body.scrollTop;
90 - //get current selection
 94+ }
 95+ // get current selection
9196 txtarea.focus();
9297 var range = document.selection.createRange();
9398 selText = range.text;
94 - //insert tags
 99+ // insert tags
95100 checkSelectedText();
96101 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 ) {
100105 tagClose = tagClose.replace(/\n/g,'');
 106+ }
101107 range.moveStart('character', - tagClose.length - selText.length);
102108 range.moveEnd('character', - tagClose.length);
103109 }
104110 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 ) {
109115 document.body.scrollTop = winScroll;
 116+ }
110117
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
114120 var textScroll = txtarea.scrollTop;
115 - //get current selection
 121+ // get current selection
116122 txtarea.focus();
117123 var startPos = txtarea.selectionStart;
118124 var endPos = txtarea.selectionEnd;
119 - selText = txtarea.value.substring(startPos, endPos);
120 - //insert tags
 125+ selText = txtarea.value.substring( startPos, endPos );
 126+ // insert tags
121127 checkSelectedText();
122128 txtarea.value = txtarea.value.substring(0, startPos)
123129 + tagOpen + selText + tagClose
124130 + txtarea.value.substring(endPos, txtarea.value.length);
125 - //set new selection
126 - if (isSample) {
 131+ // set new selection
 132+ if ( isSample ) {
127133 txtarea.selectionStart = startPos + tagOpen.length;
128134 txtarea.selectionEnd = startPos + tagOpen.length + selText.length;
129135 } else {
130136 txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length;
131137 txtarea.selectionEnd = txtarea.selectionStart;
132138 }
133 - //restore textarea scroll position
 139+ // restore textarea scroll position
134140 txtarea.scrollTop = textScroll;
135141 }
136142
137 - function checkSelectedText(){
138 - if (!selText) {
 143+ function checkSelectedText() {
 144+ if ( !selText ) {
139145 selText = sampleText;
140146 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
142148 selText = selText.substring(0, selText.length - 1);
143 - tagClose += ' '
 149+ tagClose += ' ';
144150 }
145151 }
146152
@@ -154,8 +160,9 @@
155161 var scrollTop = document.getElementById( 'wpScrolltop' );
156162 var editForm = document.getElementById( 'editform' );
157163 if( editForm && editBox && scrollTop ) {
158 - if( scrollTop.value )
 164+ if( scrollTop.value ) {
159165 editBox.scrollTop = scrollTop.value;
 166+ }
160167 addHandler( editForm, 'submit', function() {
161168 scrollTop.value = editBox.scrollTop;
162169 } );
@@ -169,31 +176,34 @@
170177 // focus does not bubble normally, but using a trick we can do event delegation
171178 // on the focus event on all text inputs to make the toolbox usable on all of them
172179 var editForm = document.getElementById( 'editform' );
173 - if ( !editForm )
 180+ if ( !editForm ) {
174181 return;
175 -
176 - function onfocus(e) {
 182+ }
 183+ function onfocus( e ) {
177184 var elm = e.target;
178 - if ( !elm )
 185+ if ( !elm ) {
179186 return;
 187+ }
180188 var tagName = elm.tagName.toLowerCase();
181189 var type = elm.type.toLowerCase();
182 - if ( tagName !== "textarea" && tagName !== "input" )
 190+ if ( tagName !== 'textarea' && tagName !== 'input' ) {
183191 return;
184 - if ( tagName === "input" && type && type !== "text" )
 192+ }
 193+ if ( tagName === 'input' && type && type !== 'text' ) {
185194 return;
186 -
 195+ }
 196+
187197 currentFocused = elm;
188198 }
189 -
 199+
190200 if ( editForm.addEventListener ) {
191201 // 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
193203 } else if ( editForm.attachEvent ) {
194204 // 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 ); } );
196206 }
197 -
 207+
198208 editForm
199209 } );
200210
Index: trunk/phase3/skins/common/wikibits.js
@@ -38,148 +38,147 @@
3939 var onloadFuncts = [];
4040 }
4141
42 -function addOnloadHook(hookFunct) {
 42+function addOnloadHook( hookFunct ) {
4343 // Allows add-on scripts to add onload functions
44 - if(!doneOnloadHook) {
 44+ if( !doneOnloadHook ) {
4545 onloadFuncts[onloadFuncts.length] = hookFunct;
4646 } else {
4747 hookFunct(); // bug in MSIE script loading
4848 }
4949 }
5050
51 -
52 -function hookEvent(hookName, hookFunct) {
53 - addHandler(window, hookName, hookFunct);
 51+function hookEvent( hookName, hookFunct ) {
 52+ addHandler( window, hookName, hookFunct );
5453 }
5554
56 -function importScript(page) {
 55+function importScript( page ) {
5756 // TODO: might want to introduce a utility function to match wfUrlencode() in PHP
5857 var uri = wgScript + '?title=' +
5958 encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') +
6059 '&action=raw&ctype=text/javascript';
61 - return importScriptURI(uri);
 60+ return importScriptURI( uri );
6261 }
6362
6463 var loadedScripts = {}; // included-scripts tracker
65 -function importScriptURI(url) {
66 - if (loadedScripts[url]) {
 64+function importScriptURI( url ) {
 65+ if ( loadedScripts[url] ) {
6766 return null;
6867 }
6968 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 );
7473 return s;
7574 }
7675
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,'_') ) );
7978 }
8079
81 -function importStylesheetURI(url, media) {
82 - var l = document.createElement('link');
 80+function importStylesheetURI( url, media ) {
 81+ var l = document.createElement( 'link' );
8382 l.type = 'text/css';
8483 l.rel = 'stylesheet';
8584 l.href = url;
8685 if( media ) {
8786 l.media = media;
8887 }
89 - document.getElementsByTagName('head')[0].appendChild(l);
 88+ document.getElementsByTagName('head')[0].appendChild( l );
9089 return l;
9190 }
9291
93 -function appendCSS(text) {
94 - var s = document.createElement('style');
 92+function appendCSS( text ) {
 93+ var s = document.createElement( 'style' );
9594 s.type = 'text/css';
9695 s.rel = 'stylesheet';
9796 if ( s.styleSheet ) {
98 - s.styleSheet.cssText = text; //IE
 97+ s.styleSheet.cssText = text; // IE
9998 } else {
100 - s.appendChild(document.createTextNode(text + '')); //Safari sometimes borks on null
 99+ s.appendChild( document.createTextNode( text + '' ) ); // Safari sometimes borks on null
101100 }
102 - document.getElementsByTagName('head')[0].appendChild(s);
 101+ document.getElementsByTagName('head')[0].appendChild( s );
103102 return s;
104103 }
105104
106105 // special stylesheet links
107 -if (typeof stylepath != 'undefined' && typeof skin != 'undefined') {
 106+if ( typeof stylepath != 'undefined' && typeof skin != 'undefined' ) {
108107 // FIXME: This tries to load the stylesheets even for skins where they
109108 // 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' );
118117 }
119118 }
120119
121120
122 -if (wgBreakFrames) {
 121+if ( wgBreakFrames ) {
123122 // Un-trap us from framesets
124 - if (window.top != window) {
 123+ if ( window.top != window ) {
125124 window.top.location = window.location;
126125 }
127126 }
128127
129128 function showTocToggle() {
130 - if (document.createTextNode) {
 129+ if ( document.createTextNode ) {
131130 // Uses DOM calls to avoid document.write + XHTML issues
132131
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 ) {
136135 // Don't add the toggle link twice
137136 return;
138137 }
139138
140 - var outerSpan = document.createElement('span');
 139+ var outerSpan = document.createElement( 'span' );
141140 outerSpan.className = 'toctoggle';
142141
143 - var toggleLink = document.createElement('a');
 142+ var toggleLink = document.createElement( 'a' );
144143 toggleLink.id = 'togglelink';
145144 toggleLink.className = 'internal';
146145 toggleLink.href = 'javascript:toggleToc()';
147 - toggleLink.appendChild(document.createTextNode(tocHideText));
 146+ toggleLink.appendChild( document.createTextNode( tocHideText ) );
148147
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( ']' ) );
152151
153 - linkHolder.appendChild(document.createTextNode(' '));
154 - linkHolder.appendChild(outerSpan);
 152+ linkHolder.appendChild( document.createTextNode( ' ' ) );
 153+ linkHolder.appendChild( outerSpan );
155154
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 ) {
158157 toggleToc();
159158 }
160159 }
161160 }
162161
163 -function changeText(el, newText) {
 162+function changeText( el, newText ) {
164163 // Safari work around
165 - if (el.innerText) {
 164+ if ( el.innerText ) {
166165 el.innerText = newText;
167 - } else if (el.firstChild && el.firstChild.nodeValue) {
 166+ } else if ( el.firstChild && el.firstChild.nodeValue ) {
168167 el.firstChild.nodeValue = newText;
169168 }
170169 }
171170
172171 function toggleToc() {
173 - var tocmain = document.getElementById('toc');
 172+ var tocmain = document.getElementById( 'toc' );
174173 var toc = document.getElementById('toc').getElementsByTagName('ul')[0];
175 - var toggleLink = document.getElementById('togglelink');
 174+ var toggleLink = document.getElementById( 'togglelink' );
176175
177 - if (toc && toggleLink && toc.style.display == 'none') {
178 - changeText(toggleLink, tocHideText);
 176+ if ( toc && toggleLink && toc.style.display == 'none' ) {
 177+ changeText( toggleLink, tocHideText );
179178 toc.style.display = 'block';
180179 document.cookie = "hidetoc=0";
181180 tocmain.className = 'toc';
182181 } else {
183 - changeText(toggleLink, tocShowText);
 182+ changeText( toggleLink, tocShowText );
184183 toc.style.display = 'none';
185184 document.cookie = "hidetoc=1";
186185 tocmain.className = 'toc tochidden';
@@ -189,40 +188,39 @@
190189 var mwEditButtons = [];
191190 var mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js
192191
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 );
199198 }
200199
201 -function escapeQuotesHTML(text) {
202 - var re = new RegExp('&',"g");
203 - text = text.replace(re,"&amp;");
204 - re = new RegExp('"',"g");
205 - text = text.replace(re,"&quot;");
206 - re = new RegExp('<',"g");
207 - text = text.replace(re,"&lt;");
208 - re = new RegExp('>',"g");
209 - text = text.replace(re,"&gt;");
 200+function escapeQuotesHTML( text ) {
 201+ var re = new RegExp( '&', "g" );
 202+ text = text.replace( re, "&amp;" );
 203+ re = new RegExp( '"', "g" );
 204+ text = text.replace( re, "&quot;" );
 205+ re = new RegExp( '<', "g" );
 206+ text = text.replace( re, "&lt;" );
 207+ re = new RegExp( '>', "g" );
 208+ text = text.replace( re, "&gt;" );
210209 return text;
211210 }
212211
213 -
214212 /**
215213 * Set the accesskey prefix based on browser detection.
216214 */
217215 var tooltipAccessKeyPrefix = 'alt-';
218 -if (is_opera) {
 216+if ( is_opera ) {
219217 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 ) {
221219 tooltipAccessKeyPrefix = 'ctrl-alt-';
222 -} else if (!is_safari_win && (is_safari
 220+} else if ( !is_safari_win && ( is_safari
223221 || clientPC.indexOf('mac') != -1
224 - || clientPC.indexOf('konqueror') != -1 )) {
 222+ || clientPC.indexOf('konqueror') != -1 ) ) {
225223 tooltipAccessKeyPrefix = 'ctrl-';
226 -} else if (is_ff2) {
 224+} else if ( is_ff2 ) {
227225 tooltipAccessKeyPrefix = 'alt-shift-';
228226 }
229227 var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?(.)\]$/;
@@ -241,28 +239,28 @@
242240 // containers which contain the relevant links. This is really just an
243241 // optimization technique.
244242 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
247245 ];
248246 for ( var i in linkContainers ) {
249247 var linkContainer = document.getElementById( linkContainers[i] );
250248 if ( linkContainer ) {
251 - updateTooltipAccessKeys( linkContainer.getElementsByTagName("a") );
 249+ updateTooltipAccessKeys( linkContainer.getElementsByTagName( 'a' ) );
252250 }
253251 }
254252 // 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' ) );
257255 return;
258256 }
259257
260258 for ( var i = 0; i < nodeList.length; i++ ) {
261259 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 ) ) {
264262 tip = tip.replace(tooltipAccessKeyRegexp,
265 - "["+tooltipAccessKeyPrefix+"$5]");
266 - element.setAttribute("title", tip );
 263+ '[' + tooltipAccessKeyPrefix + "$5]");
 264+ element.setAttribute( 'title', tip );
267265 }
268266 }
269267 }
@@ -295,8 +293,8 @@
296294 *
297295 * @return Node -- the DOM node of the new item (an LI element) or null
298296 */
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 );
301299 if ( !root ) {
302300 return null;
303301 }
@@ -341,7 +339,7 @@
342340 return item;
343341 }
344342
345 -function getInnerText(el) {
 343+function getInnerText( el ) {
346344 if ( typeof el == 'string' ) {
347345 return el;
348346 }
@@ -358,10 +356,10 @@
359357
360358 var cs = el.childNodes;
361359 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 ) {
364362 case 1: // ELEMENT_NODE
365 - str += ts_getInnerText(cs[i]);
 363+ str += ts_getInnerText( cs[i] );
366364 break;
367365 case 3: // TEXT_NODE
368366 str += cs[i].nodeValue;
@@ -381,11 +379,11 @@
382380 function setupCheckboxShiftClick() {
383381 checkboxes = [];
384382 lastCheckbox = null;
385 - var inputs = document.getElementsByTagName('input');
386 - addCheckboxClickHandlers(inputs);
 383+ var inputs = document.getElementsByTagName( 'input' );
 384+ addCheckboxClickHandlers( inputs );
387385 }
388386
389 -function addCheckboxClickHandlers(inputs, start) {
 387+function addCheckboxClickHandlers( inputs, start ) {
390388 if ( !start ) {
391389 start = 0;
392390 }
@@ -407,14 +405,14 @@
408406 }
409407
410408 if ( finish < inputs.length ) {
411 - setTimeout( function () {
412 - addCheckboxClickHandlers(inputs, finish);
 409+ setTimeout( function() {
 410+ addCheckboxClickHandlers( inputs, finish );
413411 }, 200 );
414412 }
415413 }
416414
417 -function checkboxClickHandler(e) {
418 - if (typeof e == 'undefined') {
 415+function checkboxClickHandler( e ) {
 416+ if ( typeof e == 'undefined' ) {
419417 e = window.event;
420418 }
421419 if ( !e.shiftKey || lastCheckbox === null ) {
@@ -430,7 +428,7 @@
431429 start = lastCheckbox;
432430 finish = this.index - 1;
433431 }
434 - for (var i = start; i <= finish; ++i ) {
 432+ for ( var i = start; i <= finish; ++i ) {
435433 checkboxes[i].checked = endState;
436434 if( i > start && typeof checkboxes[i].onchange == 'function' ) {
437435 checkboxes[i].onchange(); // fire triggers
@@ -447,25 +445,25 @@
448446 Author says "The credit comment is all it takes, no license. Go crazy with it!:-)"
449447 From http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/
450448 */
451 -function getElementsByClassName(oElm, strTagName, oClassNames){
 449+function getElementsByClassName( oElm, strTagName, oClassNames ) {
452450 var arrReturnElements = new Array();
453 - if ( typeof( oElm.getElementsByClassName ) == "function" ) {
 451+ if ( typeof( oElm.getElementsByClassName ) == 'function' ) {
454452 /* Use a native implementation where possible FF3, Saf3.2, Opera 9.5 */
455453 var arrNativeReturn = oElm.getElementsByClassName( oClassNames );
456 - if ( strTagName == "*" ) {
 454+ if ( strTagName == '*' ) {
457455 return arrNativeReturn;
458456 }
459 - for ( var h=0; h < arrNativeReturn.length; h++ ) {
 457+ for ( var h = 0; h < arrNativeReturn.length; h++ ) {
460458 if( arrNativeReturn[h].tagName.toLowerCase() == strTagName.toLowerCase() ) {
461459 arrReturnElements[arrReturnElements.length] = arrNativeReturn[h];
462460 }
463461 }
464462 return arrReturnElements;
465463 }
466 - var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
 464+ var arrElements = ( strTagName == '*' && oElm.all ) ? oElm.all : oElm.getElementsByTagName( strTagName );
467465 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++ ) {
470468 arrRegExpClassNames[arrRegExpClassNames.length] =
471469 new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)");
472470 }
@@ -475,41 +473,41 @@
476474 }
477475 var oElement;
478476 var bMatchesAll;
479 - for(var j=0; j<arrElements.length; j++){
 477+ for( var j = 0; j < arrElements.length; j++ ) {
480478 oElement = arrElements[j];
481479 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 ) ) {
484482 bMatchesAll = false;
485483 break;
486484 }
487485 }
488 - if(bMatchesAll){
 486+ if( bMatchesAll ) {
489487 arrReturnElements[arrReturnElements.length] = oElement;
490488 }
491489 }
492 - return (arrReturnElements);
 490+ return ( arrReturnElements );
493491 }
494492
495 -function redirectToFragment(fragment) {
 493+function redirectToFragment( fragment ) {
496494 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 ) {
500498 // Released Safari w/ WebKit 418.9.1 messes up horribly
501499 // Nightlies of 420+ are ok
502500 return;
503501 }
504502 }
505 - if (is_gecko) {
 503+ if ( is_gecko ) {
506504 // 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 == '' ) {
509507 window.location.hash = fragment;
510508 }
511509 });
512510 } else {
513 - if (window.location.hash == '') {
 511+ if ( window.location.hash == '' ) {
514512 window.location.hash = fragment;
515513 }
516514 }
@@ -538,20 +536,20 @@
539537 function sortables_init() {
540538 var idnum = 0;
541539 // 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 );
546544 ++idnum;
547545 }
548 - ts_makeSortable(tables[ti]);
 546+ ts_makeSortable( tables[ti] );
549547 }
550548 }
551549
552 -function ts_makeSortable(table) {
 550+function ts_makeSortable( table ) {
553551 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 ) {
556554 firstRow = table.tHead.rows[table.tHead.rows.length-1];
557555 } else {
558556 firstRow = table.rows[0];
@@ -562,9 +560,9 @@
563561 }
564562
565563 // 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++ ) {
567565 var cell = firstRow.cells[i];
568 - if ((" "+cell.className+" ").indexOf(" unsortable ") == -1) {
 566+ if ( (' ' + cell.className + ' ').indexOf(' unsortable ') == -1 ) {
569567 cell.innerHTML += '<a href="#" class="sortheader" '
570568 + 'onclick="ts_resortTable(this);return false;">'
571569 + '<span class="sortarrow">'
@@ -574,16 +572,16 @@
575573 + '" alt="&darr;"/></span></a>';
576574 }
577575 }
578 - if (ts_alternate_row_colors) {
579 - ts_alternate(table);
 576+ if ( ts_alternate_row_colors ) {
 577+ ts_alternate( table );
580578 }
581579 }
582580
583 -function ts_getInnerText(el) {
 581+function ts_getInnerText( el ) {
584582 return getInnerText( el );
585583 }
586584
587 -function ts_resortTable(lnk) {
 585+function ts_resortTable( lnk ) {
588586 // get the span
589587 var span = lnk.getElementsByTagName('span')[0];
590588
@@ -592,7 +590,7 @@
593591 var column = td.cellIndex;
594592
595593 var table = tr.parentNode;
596 - while (table && !(table.tagName && table.tagName.toLowerCase() == 'table')) {
 594+ while ( table && !( table.tagName && table.tagName.toLowerCase() == 'table' ) ) {
597595 table = table.parentNode;
598596 }
599597 if ( !table ) {
@@ -604,19 +602,19 @@
605603 }
606604
607605 // 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 ) {
609607 ts_initTransformTable();
610608 }
611609
612610 // Work out a type for the column
613611 // 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 );
615613
616614 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 ) {
619617 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]+$/, '');
621619 if ( itm != '' ) {
622620 break;
623621 }
@@ -626,82 +624,84 @@
627625 // TODO: bug 8226, localised date formats
628626 var sortfn = ts_sort_generic;
629627 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 ) ) {
631629 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 ) ) {
633631 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 ) ) {
635633 preprocessor = ts_dateToSortKey;
636634 // (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 ) ) {
638636 preprocessor = ts_currencyToSortKey;
639 - } else if (ts_number_regex.test(itm)) {
 637+ } else if ( ts_number_regex.test( itm ) ) {
640638 preprocessor = ts_parseFloat;
641639 }
642640
643 - var reverse = (span.getAttribute("sortdir") == 'down');
 641+ var reverse = ( span.getAttribute( 'sortdir' ) == 'down' );
644642
645643 var newRows = new Array();
646644 var staticRows = new Array();
647 - for (var j = rowStart; j < table.rows.length; j++) {
 645+ for ( var j = rowStart; j < table.rows.length; j++ ) {
648646 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 ) {
652650 keyText = '';
653651 }
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]+$/, '') );
656654
657 - newRows[newRows.length] = new Array(row, preprocessed, oldIndex);
 655+ newRows[newRows.length] = new Array( row, preprocessed, oldIndex );
658656 } else {
659 - staticRows[staticRows.length] = new Array(row, false, j-rowStart);
 657+ staticRows[staticRows.length] = new Array( row, false, j-rowStart );
660658 }
661659 }
662660
663 - newRows.sort(sortfn);
 661+ newRows.sort( sortfn );
664662
665663 var arrowHTML;
666 - if (reverse) {
667 - arrowHTML = '<img src="'+ ts_image_path + ts_image_down + '" alt="&darr;"/>';
 664+ if ( reverse ) {
 665+ arrowHTML = '<img src="' + ts_image_path + ts_image_down + '" alt="&darr;"/>';
668666 newRows.reverse();
669 - span.setAttribute('sortdir','up');
 667+ span.setAttribute( 'sortdir', 'up' );
670668 } else {
671 - arrowHTML = '<img src="'+ ts_image_path + ts_image_up + '" alt="&uarr;"/>';
672 - span.setAttribute('sortdir','down');
 669+ arrowHTML = '<img src="' + ts_image_path + ts_image_up + '" alt="&uarr;"/>';
 670+ span.setAttribute( 'sortdir', 'down' );
673671 }
674672
675 - for (var i = 0; i < staticRows.length; i++) {
 673+ for ( var i = 0; i < staticRows.length; i++ ) {
676674 var row = staticRows[i];
677 - newRows.splice(row[2], 0, row);
 675+ newRows.splice( row[2], 0, row );
678676 }
679677
680678 // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
681679 // 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+ }
685684 }
686685 // 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+ }
690690 }
691691
692692 // 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="&darr;"/>';
 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="&darr;"/>';
696696 }
697697 span.innerHTML = arrowHTML;
698698
699 - if (ts_alternate_row_colors) {
700 - ts_alternate(table);
 699+ if ( ts_alternate_row_colors ) {
 700+ ts_alternate( table );
701701 }
702702 }
703703
704704 function ts_initTransformTable() {
705 - if ( typeof wgSeparatorTransformTable == "undefined"
 705+ if ( typeof wgSeparatorTransformTable == 'undefined'
706706 || ( wgSeparatorTransformTable[0] == '' && wgDigitTransformTable[2] == '' ) )
707707 {
708708 digitClass = "[0-9,.]";
@@ -731,7 +731,7 @@
732732 digit.replace( /[\\\\$\*\+\?\.\(\)\|\{\}\[\]\-]/,
733733 function( s ) { return '\\' + s; } )
734734 );
735 - if (digit.length > maxDigitLength) {
 735+ if ( digit.length > maxDigitLength ) {
736736 maxDigitLength = digit.length;
737737 }
738738 }
@@ -757,57 +757,81 @@
758758 return s.toLowerCase();
759759 }
760760
761 -function ts_dateToSortKey(date) {
 761+function ts_dateToSortKey( date ) {
762762 // 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';
778802 }
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 );
783807 } 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 );
785809 }
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;
790814 } else {
791 - yr = '19'+yr;
 815+ yr = '19' + yr;
792816 }
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 );
795819 } else {
796 - return yr+date.substr(0,2)+date.substr(3,2);
 820+ return yr + date.substr( 0, 2 ) + date.substr( 3, 2 );
797821 }
798822 }
799 - return "00000000";
 823+ return '00000000';
800824 }
801825
802826 function ts_parseFloat( s ) {
803827 if ( !s ) {
804828 return 0;
805829 }
806 - if (ts_number_transform_table != false) {
 830+ if ( ts_number_transform_table != false ) {
807831 var newNum = '', c;
808832
809833 for ( var p = 0; p < s.length; p++ ) {
810834 c = s.charAt( p );
811 - if (c in ts_number_transform_table) {
 835+ if ( c in ts_number_transform_table ) {
812836 newNum += ts_number_transform_table[c];
813837 } else {
814838 newNum += c;
@@ -815,36 +839,37 @@
816840 }
817841 s = newNum;
818842 }
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 );
821845 }
822846
823847 function ts_currencyToSortKey( s ) {
824848 return ts_parseFloat(s.replace(/[^-\u22120-9.,]/g,''));
825849 }
826850
827 -function ts_sort_generic(a, b) {
 851+function ts_sort_generic( a, b ) {
828852 return a[1] < b[1] ? -1 : a[1] > b[1] ? 1 : a[2] - b[2];
829853 }
830854
831 -function ts_alternate(table) {
 855+function ts_alternate( table ) {
832856 // Take object table and get all it's tbodies.
833 - var tableBodies = table.getElementsByTagName("tbody");
 857+ var tableBodies = table.getElementsByTagName( 'tbody' );
834858 // Loop through these tbodies
835 - for (var i = 0; i < tableBodies.length; i++) {
 859+ for ( var i = 0; i < tableBodies.length; i++ ) {
836860 // Take the tbody, and get all it's rows
837 - var tableRows = tableBodies[i].getElementsByTagName("tr");
 861+ var tableRows = tableBodies[i].getElementsByTagName( 'tr' );
838862 // Loop through these rows
839863 // 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++ ) {
841865 // 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+ }
847872 }
848 - tableRows[j].className = newClassName + (j % 2 == 0 ? "even" : "odd");
 873+ tableRows[j].className = newClassName + ( j % 2 == 0 ? 'even' : 'odd' );
849874 }
850875 }
851876 }
@@ -880,7 +905,7 @@
881906 messageDiv,
882907 document.getElementById( 'content' ).firstChild
883908 );
884 - } else if ( document.getElementById('content')
 909+ } else if ( document.getElementById( 'content' )
885910 && document.getElementById( 'article' ) ) {
886911 // Non-Monobook but still recognizable (old-style)
887912 document.getElementById( 'article').insertBefore(
@@ -895,15 +920,15 @@
896921 messageDiv.setAttribute( 'id', 'mw-js-message' );
897922 messageDiv.style.display = 'block';
898923 if( className ) {
899 - messageDiv.setAttribute( 'class', 'mw-js-message-'+className );
 924+ messageDiv.setAttribute( 'class', 'mw-js-message-' + className );
900925 }
901926
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 {
908933 messageDiv.innerHTML = message;
909934 }
910935 return true;
@@ -916,10 +941,10 @@
917942 * @param id Identifier string (for use with removeSpinner(), below)
918943 */
919944 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 = '...';
924949 if( element.nextSibling ) {
925950 element.parentNode.insertBefore( spinner, element.nextSibling );
926951 } else {
@@ -933,7 +958,7 @@
934959 * @param id Identifier string
935960 */
936961 function removeSpinner( id ) {
937 - var spinner = document.getElementById( "mw-spinner-" + id );
 962+ var spinner = document.getElementById( 'mw-spinner-' + id );
938963 if( spinner ) {
939964 spinner.parentNode.removeChild( spinner );
940965 }
@@ -941,7 +966,7 @@
942967
943968 function runOnloadHook() {
944969 // don't run anything below this for non-dom browsers
945 - if (doneOnloadHook || !(document.getElementById && document.getElementsByTagName)) {
 970+ if ( doneOnloadHook || !( document.getElementById && document.getElementsByTagName ) ) {
946971 return;
947972 }
948973
@@ -954,7 +979,7 @@
955980 sortables_init();
956981
957982 // Run any added-on functions
958 - for (var i = 0; i < onloadFuncts.length; i++) {
 983+ for ( var i = 0; i < onloadFuncts.length; i++ ) {
959984 onloadFuncts[i]();
960985 }
961986 }
@@ -998,20 +1023,21 @@
9991024 element.detachEvent( 'on' + remove, handler );
10001025 }
10011026 }
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,
10031028 // so the below should be redundant. It's there just in case.
1004 -hookEvent("load", runOnloadHook);
 1029+hookEvent( 'load', runOnloadHook );
10051030
10061031 if ( ie6_bugs ) {
1007 - var isMSIE55 = (window.showModalDialog && window.clipboardData && window.createPopup);
 1032+ var isMSIE55 = ( window.showModalDialog && window.clipboardData && window.createPopup );
10081033 var doneIETransform;
10091034 var doneIEAlphaFix;
10101035
1011 - if (document.attachEvent)
1012 - document.attachEvent('onreadystatechange', hookit);
 1036+ if ( document.attachEvent ) {
 1037+ document.attachEvent( 'onreadystatechange', hookit );
 1038+ }
10131039
10141040 function hookit() {
1015 - if (!doneIETransform && document.getElementById && document.getElementById('bodyContent')) {
 1041+ if ( !doneIETransform && document.getElementById && document.getElementById( 'bodyContent' ) ) {
10161042 doneIETransform = true;
10171043 relativeforfloats();
10181044 fixalpha();
@@ -1021,21 +1047,24 @@
10221048 // png alpha transparency fixes
10231049 function fixalpha( logoId ) {
10241050 // bg
1025 - if (isMSIE55 && !doneIEAlphaFix)
1026 - {
 1051+ if ( isMSIE55 && !doneIEAlphaFix ) {
10271052 var plogo = document.getElementById( logoId || 'p-logo' );
1028 - if (!plogo) return;
 1053+ if ( !plogo ) {
 1054+ return;
 1055+ }
10291056
10301057 var logoa = plogo.getElementsByTagName('a')[0];
1031 - if (!logoa) return;
 1058+ if ( !logoa ) {
 1059+ return;
 1060+ }
10321061
10331062 var bg = logoa.currentStyle.backgroundImage;
1034 - var imageUrl = bg.substring(5, bg.length-2);
 1063+ var imageUrl = bg.substring( 5, bg.length - 2 );
10351064
10361065 doneIEAlphaFix = true;
10371066
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' ) );
10401069
10411070 logoa.style.backgroundImage = 'none';
10421071 logospan.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')';
@@ -1044,20 +1073,17 @@
10451074 logospan.style.width = logoa.currentStyle.width;
10461075 logospan.style.cursor = 'hand';
10471076 // 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"' );
10521083 }
1053 - else
1054 - {
1055 - logospan.style.left = '50%';
1056 - logospan.style.setExpression('marginLeft', '"-" + (this.offsetWidth / 2) + "px"');
1057 - }
10581084 logospan.style.top = '50%';
1059 - logospan.style.setExpression('marginTop', '"-" + (this.offsetHeight / 2) + "px"');
 1085+ logospan.style.setExpression( 'marginTop', '"-" + (this.offsetHeight / 2) + "px"' );
10601086
1061 - var linkFix = logoa.appendChild(logoa.cloneNode());
 1087+ var linkFix = logoa.appendChild( logoa.cloneNode() );
10621088 linkFix.style.position = 'absolute';
10631089 linkFix.style.height = '100%';
10641090 linkFix.style.width = '100%';
@@ -1067,20 +1093,20 @@
10681094
10691095 // fix ie6 disappering float bug
10701096 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' );
10751101 }
1076 - setrelative(tables);
1077 - setrelative(divs);
 1102+ setrelative( tables );
 1103+ setrelative( divs );
10781104 }
1079 - function setrelative (nodes) {
 1105+ function setrelative( nodes ) {
10801106 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' ) ) )
10851111 {
10861112 nodes[i].style.position = 'relative';
10871113 }
@@ -1088,14 +1114,14 @@
10891115 }
10901116 }
10911117
1092 -
10931118 // Expand links for printing
1094 -
1095 - String.prototype.hasClass = function(classWanted)
1096 - {
 1119+ String.prototype.hasClass = function( classWanted ) {
10971120 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+ }
11001126 return false;
11011127 }
11021128
@@ -1104,27 +1130,28 @@
11051131 onbeforeprint = function() {
11061132 expandedURLs = [];
11071133
1108 - var contentEl = document.getElementById("content");
 1134+ var contentEl = document.getElementById( 'content' );
11091135
1110 - if (contentEl)
1111 - {
1112 - var allLinks = contentEl.getElementsByTagName("a");
 1136+ if ( contentEl ) {
 1137+ var allLinks = contentEl.getElementsByTagName( 'a' );
11131138
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+ }
11241149 }
11251150
11261151 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+ }
11301157 }
11311158 }
Index: trunk/phase3/skins/common/htmlform.js
@@ -1,30 +1,36 @@
22 // Find select-or-other fields.
33 addOnloadHook( function() {
44 var fields = getElementsByClassName( document, 'select', 'mw-htmlform-select-or-other' );
5 -
 5+
66 for( var i = 0; i < fields.length; i++ ) {
77 var select = fields[i];
8 -
 8+
99 addHandler( select, 'change', htmlforms.selectOrOtherSelectChanged );
10 -
 10+
1111 // Use a fake 'e' to update it.
1212 htmlforms.selectOrOtherSelectChanged( { 'target': select } );
1313 }
1414 } );
1515
1616 var htmlforms = {
17 - 'selectOrOtherSelectChanged' : function(e) {
 17+ 'selectOrOtherSelectChanged' : function( e ) {
1818 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
2328 select = select.parentNode;
24 -
 29+ }
 30+
2531 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' ) {
2935 textbox.disabled = false;
3036 } else {
3137 textbox.disabled = true;
Index: trunk/phase3/skins/common/block.js
@@ -1,19 +1,19 @@
2 -addOnloadHook(considerChangingExpiryFocus);
 2+addOnloadHook( considerChangingExpiryFocus );
33
44 function considerChangingExpiryFocus() {
5 - if (!document.getElementById) {
 5+ if ( !document.getElementById ) {
66 return;
77 }
8 - var drop = document.getElementById('wpBlockExpiry');
9 - if (!drop) {
 8+ var drop = document.getElementById( 'wpBlockExpiry' );
 9+ if ( !drop ) {
1010 return;
1111 }
12 - var field = document.getElementById('wpBlockOther');
13 - if (!field) {
 12+ var field = document.getElementById( 'wpBlockOther' );
 13+ if ( !field ) {
1414 return;
1515 }
1616 var opt = drop.value;
17 - if (opt == 'other') {
 17+ if ( opt == 'other' ) {
1818 field.style.display = '';
1919 } else {
2020 field.style.display = 'none';
@@ -21,34 +21,36 @@
2222 }
2323
2424 function updateBlockOptions() {
25 - if (!document.getElementById)
 25+ if ( !document.getElementById ) {
2626 return;
 27+ }
2728
28 - var target = document.getElementById('mw-bi-target');
29 - if (!target)
 29+ var target = document.getElementById( 'mw-bi-target' );
 30+ if ( !target ) {
3031 return;
 32+ }
3133
3234 var addy = target.value;
3335 var isEmpty = addy.match(/^\s*$/);
3436 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+)?$/);
3537 var isIpRange = isIp && addy.match(/\/\d+$/);
3638
37 - var anonymousRow = document.getElementById('wpAnonOnlyRow');
 39+ var anonymousRow = document.getElementById( 'wpAnonOnlyRow' );
3840 if( anonymousRow ) {
39 - anonymousRow.style.display = (!isIp && !isEmpty) ? 'none' : '';
 41+ anonymousRow.style.display = ( !isIp && !isEmpty ) ? 'none' : '';
4042 }
4143
42 - var autoblockRow = document.getElementById('wpEnableAutoblockRow');
 44+ var autoblockRow = document.getElementById( 'wpEnableAutoblockRow' );
4345 if( autoblockRow ) {
4446 autoblockRow.style.display = isIp && !isEmpty ? 'none' : '';
4547 }
4648
47 - var hideuserRow = document.getElementById('wpEnableHideUser');
 49+ var hideuserRow = document.getElementById( 'wpEnableHideUser' );
4850 if( hideuserRow ) {
4951 hideuserRow.style.display = isIp && !isEmpty ? 'none' : '';
5052 }
5153
52 - var watchuserRow = document.getElementById('wpEnableWatchUser');
 54+ var watchuserRow = document.getElementById( 'wpEnableWatchUser' );
5355 if( watchuserRow ) {
5456 watchuserRow.style.display = isIpRange && !isEmpty ? 'none' : '';
5557 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1658,7 +1658,7 @@
16591659 * to ensure that client-side caches do not keep obsolete copies of global
16601660 * styles.
16611661 */
1662 -$wgStyleVersion = '260';
 1662+$wgStyleVersion = '261';
16631663
16641664
16651665 # Server-side caching:

Follow-up revisions

RevisionCommit summaryAuthorDate
r61016Reapply style fixes from r61006 to IEFixes.js...simetrical19:42, 13 January 2010

Status & tagging log