r73810 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73809‎ | r73810 | r73811 >
Date:14:43, 27 September 2010
Author:ashley
Status:ok
Tags:
Comment:
ProofreadPage: coding style tweaks to JS files
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)
  • /trunk/extensions/ProofreadPage/proofread_article.js (modified) (history)
  • /trunk/extensions/ProofreadPage/proofread_index.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/proofread_index.js
@@ -1,123 +1,135 @@
22 // Author : ThomasV - License : GPL
33
4 -//the index template is a sytem message.
5 -//another message in i18n lists the parameters
6 -
7 -function findparam(str2, param_name) {
8 - var pattern = "\\n\\|"+param_name+"=([\\s\\S]*?)\\n\\|([^=\\n\\|]+)=";
9 - var re2 = new RegExp(pattern);
10 - var m2 = str2.match(re2);
11 - if(m2) return m2[1];
 4+// the index template is a system message.
 5+// another message in i18n lists the parameters
 6+function findparam( str2, param_name ) {
 7+ var pattern = "\\n\\|" + param_name + "=([\\s\\S]*?)\\n\\|([^=\\n\\|]+)=";
 8+ var re2 = new RegExp( pattern );
 9+ var m2 = str2.match( re2 );
 10+ if( m2 ) {
 11+ return m2[1];
 12+ }
1213 return '';
1314 }
1415
1516 function proofreadpage_index_init() {
 17+ var toolbar = document.getElementById( 'toolbar' );
 18+ if( toolbar ) {
 19+ toolbar.parentNode.removeChild( toolbar );
 20+ }
1621
17 - var toolbar = document.getElementById("toolbar");
18 - if(toolbar) toolbar.parentNode.removeChild(toolbar);
 22+ var text = document.getElementById( 'wpTextbox1' );
 23+ if( !text ) {
 24+ return;
 25+ }
1926
20 - var text = document.getElementById("wpTextbox1");
21 - if(!text) return;
22 -
2327 params = '';
24 - if(text.value) {
 28+ if( text.value ) {
2529 var re = /\{\{:MediaWiki:Proofreadpage_index_template([\s\S]*)\n\}\}/m;
26 - var m = text.value.match(re);
27 - if(!m) return;
28 - params = m[1]+'\n\|END=';
 30+ var m = text.value.match( re );
 31+ if( !m ) {
 32+ return;
 33+ }
 34+ params = m[1] + '\n\|END=';
2935 }
30 -
 36+
3137 // Certain extensions, like UsabilityInitiative, wrap the textarea
3238 var textWrapper = text;
33 - while(textWrapper.parentNode.nodeName != 'FORM') textWrapper = textWrapper.parentNode;
 39+ while( textWrapper.parentNode.nodeName != 'FORM' ) {
 40+ textWrapper = textWrapper.parentNode;
 41+ }
3442 var f = textWrapper.parentNode;
35 - var container = document.createElement("div");
36 - var wrapper = document.createElement("div");
 43+ var container = document.createElement( 'div' );
 44+ var wrapper = document.createElement( 'div' );
3745 wrapper.style.display = 'none';
38 - container.appendChild(wrapper);
39 - wrapper.appendChild(textWrapper);
 46+ container.appendChild( wrapper );
 47+ wrapper.appendChild( textWrapper );
4048
41 - var index_attributes = self.prp_index_attributes.split('\n');
 49+ var index_attributes = self.prp_index_attributes.split( '\n' );
4250 var str = '<table>';
43 - for(i=0;i<index_attributes.length;i++){
44 - m = index_attributes[i].split('|');
 51+ for( i = 0; i < index_attributes.length; i++ ) {
 52+ m = index_attributes[i].split( '|' );
4553 param_name = m[0];
4654
47 - if(m[1]) param_label=m[1]; else param_label=param_name;
48 - str += '<tr><td>'+param_label+': </td>';
 55+ if( m[1] ) {
 56+ param_label = m[1];
 57+ } else {
 58+ param_label = param_name;
 59+ }
 60+ str += '<tr><td>' + param_label + ': </td>';
4961
50 - value = findparam(params,param_name);
51 - value = value.replace(/\{\{!\}\}/g,'|');
 62+ value = findparam( params, param_name );
 63+ value = value.replace( /\{\{!\}\}/g, '|' );
5264
53 - if( (m[0]=="Header") && (value=="") ) value = prp_default_header;
54 - if( (m[0]=="Footer") && (value=="") ) value = prp_default_footer;
 65+ if( ( m[0] == 'Header' ) && ( value == '' ) ) {
 66+ value = prp_default_header;
 67+ }
 68+ if( ( m[0] == 'Footer' ) && ( value == '' ) ) {
 69+ value = prp_default_footer;
 70+ }
5571
56 - if(m[2]) size=m[2]; else size="1";
57 - if(size=="1") {
58 - str += '<td><input name="'+param_name+'" size=60 value="'+value+'"/></td></tr>';
 72+ if( m[2] ) {
 73+ size = m[2];
 74+ } else {
 75+ size = '1';
5976 }
60 - else{
61 - str += '<td><textarea name="'+param_name+'" cols=60 rows='+size+'>'+value+'</textarea></td></tr>';
 77+ if( size == '1' ) {
 78+ str += '<td><input name="' + param_name + '" size=60 value="' + value + '"/></td></tr>';
 79+ } else {
 80+ str += '<td><textarea name="' + param_name + '" cols=60 rows=' + size + '>' + value + '</textarea></td></tr>';
6281 }
6382 }
6483 str += '</table>';
6584 container.innerHTML += str;
6685
67 - var saveButton = document.getElementById("wpSave");
68 - var previewButton = document.getElementById("wpPreview");
69 - var diffButton = document.getElementById("wpDiff");
70 - if(saveButton){
 86+ var saveButton = document.getElementById( 'wpSave' );
 87+ var previewButton = document.getElementById( 'wpPreview' );
 88+ var diffButton = document.getElementById( 'wpDiff' );
 89+ if( saveButton ) {
7190 saveButton.onclick = proofreadpage_fill_index;
7291 previewButton.onclick = proofreadpage_fill_index;
7392 diffButton.onclick = proofreadpage_fill_index;
74 - }
75 - else {
76 - container.firstChild.nextSibling.setAttribute("readonly","readonly");
 93+ } else {
 94+ container.firstChild.nextSibling.setAttribute( 'readonly', 'readonly' );
7795 }
7896
79 - copywarn = document.getElementById("editpage-copywarn");
80 - f.insertBefore(container,copywarn);
81 -
 97+ copywarn = document.getElementById( 'editpage-copywarn' );
 98+ f.insertBefore( container, copywarn );
8299 }
83100
84101 function proofreadpage_fill_index() {
85 - var form = document.getElementById("editform");
86 - var result = "{{:MediaWiki:Proofreadpage_index_template";
87 - var index_attributes = self.prp_index_attributes.split('\n');
 102+ var form = document.getElementById( 'editform' );
 103+ var result = '{{:MediaWiki:Proofreadpage_index_template';
 104+ var index_attributes = self.prp_index_attributes.split( '\n' );
88105
89 - for(i=0;i<index_attributes.length;i++){
90 - m = index_attributes[i].split('|');
 106+ for( i = 0; i < index_attributes.length; i++ ) {
 107+ m = index_attributes[i].split( '|' );
91108 param_name = m[0];
92109
93110 value = form.elements[param_name].value;
94 - //remove trailing \n
95 - value = value.replace(/\n$/,'');
 111+ // remove trailing \n
 112+ value = value.replace( /\n$/, '' );
96113
97 - //replace pipe symbol everywhere...
98 - value = value.replace(/\|/g,'{{!}}');
 114+ // replace pipe symbol everywhere...
 115+ value = value.replace( /\|/g, '{{!}}' );
99116
100 - //...except in links...
101 - do {
102 - prev = value;
103 - value = value.replace(/\[\[(.*?)\{\{!\}\}(.*?)\]\]/g,'[[$1|$2]]');
104 - }
105 - while (value != prev);
 117+ // ...except in links...
 118+ do {
 119+ prev = value;
 120+ value = value.replace( /\[\[(.*?)\{\{!\}\}(.*?)\]\]/g, '[[$1|$2]]' );
 121+ } while ( value != prev );
106122
107 - //..and in templates
108 - do {
109 - prev = value;
110 - value = value.replace(/\{\{(.*?)\{\{!\}\}(.*?)\}\}/g,'{{$1|$2}}');
111 - }
112 - while (value != prev);
 123+ // ..and in templates
 124+ do {
 125+ prev = value;
 126+ value = value.replace( /\{\{(.*?)\{\{!\}\}(.*?)\}\}/g, '{{$1|$2}}' );
 127+ } while ( value != prev );
113128
114 - result = result + "\n|"+param_name+"="+value;
 129+ result = result + '\n|' + param_name + '=' + value;
115130 }
116131 result = result + "\n}}";
117 - form.elements["wpTextbox1"].value = result;
 132+ form.elements['wpTextbox1'].value = result;
118133 }
119134
120 -
121 -
122 -
123 -//use hookevent instead of addOnLoadHook, so that the code is evalued after wikibits.js
124 -hookEvent("load", proofreadpage_index_init);
 135+// use hookevent instead of addOnLoadHook, so that the code is evaluated after wikibits.js
 136+hookEvent( 'load', proofreadpage_index_init );
\ No newline at end of file
Index: trunk/extensions/ProofreadPage/proofread.js
@@ -1,199 +1,207 @@
22 // Author : ThomasV - License : GPL
33
 4+function pr_init_tabs() {
 5+ var a = document.getElementById( 'p-namespaces' );
 6+ if( !a ) {
 7+ a = document.getElementById( 'p-cactions' );
 8+ }
49
5 -function pr_init_tabs(){
6 - var a = document.getElementById("p-namespaces");
7 - if(!a) a = document.getElementById("p-cactions");
 10+ if ( !a ) {
 11+ return;
 12+ }
 13+ var b = a.getElementsByTagName( 'ul' );
 14+ if ( !b ) {
 15+ return;
 16+ }
817
9 - if (!a) return;
10 - var b = a.getElementsByTagName("ul");
11 - if (!b) return;
12 -
1318 if( self.proofreadPageThumbURL ) {
14 - var view_url = self.proofreadPageThumbURL.replace('##WIDTH##',"" + self.proofreadPageWidth );
15 - b[0].innerHTML = b[0].innerHTML
16 - + '<li id="ca-image">'
17 - + '<span><a href="' + escapeQuotesHTML( view_url ) + '">'
18 - + escapeQuotesHTML(proofreadPageMessageImage) + '</a></span></li>';
 19+ var view_url = self.proofreadPageThumbURL.replace( '##WIDTH##', '' + self.proofreadPageWidth );
 20+ b[0].innerHTML = b[0].innerHTML + '<li id="ca-image">' +
 21+ '<span><a href="' + escapeQuotesHTML( view_url ) + '">' +
 22+ escapeQuotesHTML( proofreadPageMessageImage ) + '</a></span></li>';
1923 }
2024
21 - if(self.proofreadPageIndexURL){
22 - b[0].innerHTML = b[0].innerHTML
23 - + '<li id="ca-index">'
24 - + '<span><a href="' + escapeQuotesHTML(proofreadPageIndexURL)
25 - + '" title="' + escapeQuotesHTML(proofreadPageMessageIndex) + '">'
26 - + '<img src="' + wgScriptPath + '/extensions/ProofreadPage/uparrow.png" alt="'
27 - + escapeQuotesHTML(proofreadPageMessageIndex)
28 - + '" width="15" height="15" /></a></span></li>';
 25+ if( self.proofreadPageIndexURL ) {
 26+ b[0].innerHTML = b[0].innerHTML + '<li id="ca-index">' +
 27+ '<span><a href="' + escapeQuotesHTML( proofreadPageIndexURL ) +
 28+ '" title="' + escapeQuotesHTML( proofreadPageMessageIndex ) + '">' +
 29+ '<img src="' + wgScriptPath + '/extensions/ProofreadPage/uparrow.png" alt="' +
 30+ escapeQuotesHTML( proofreadPageMessageIndex ) +
 31+ '" width="15" height="15" /></a></span></li>';
2932 }
3033
31 - if(self.proofreadPageNextURL){
32 - b[0].innerHTML =
33 - '<li id="ca-next">'
34 - + '<span><a href="' + escapeQuotesHTML(self.proofreadPageNextURL)
35 - + '" title="' + escapeQuotesHTML(proofreadPageMessageNextPage) + '">'
36 - + '<img src="' + wgScriptPath + '/extensions/ProofreadPage/rightarrow.png" alt="'
37 - + escapeQuotesHTML(proofreadPageMessageNextPage)
38 - + '" width="15" height="15" /></a></span></li>'
39 - + b[0].innerHTML ;
 34+ if( self.proofreadPageNextURL ) {
 35+ b[0].innerHTML = '<li id="ca-next">' +
 36+ '<span><a href="' + escapeQuotesHTML( self.proofreadPageNextURL ) +
 37+ '" title="' + escapeQuotesHTML( proofreadPageMessageNextPage ) + '">' +
 38+ '<img src="' + wgScriptPath + '/extensions/ProofreadPage/rightarrow.png" alt="' +
 39+ escapeQuotesHTML( proofreadPageMessageNextPage ) +
 40+ '" width="15" height="15" /></a></span></li>' +
 41+ b[0].innerHTML;
4042 }
4143
42 - if(self.proofreadPagePrevURL){
43 - b[0].innerHTML =
44 - '<li id="ca-prev">'
45 - + '<span><a href="' + escapeQuotesHTML(self.proofreadPagePrevURL)
46 - + '" title="' + escapeQuotesHTML(proofreadPageMessagePrevPage) + '">'
47 - + '<img src="' + wgScriptPath + '/extensions/ProofreadPage/leftarrow.png" alt="'
48 - + escapeQuotesHTML(proofreadPageMessagePrevPage)
49 - + '" width="15" height="15" /></a></span></li>'
50 - + b[0].innerHTML ;
51 - }
 44+ if( self.proofreadPagePrevURL ) {
 45+ b[0].innerHTML = '<li id="ca-prev">' +
 46+ '<span><a href="' + escapeQuotesHTML( self.proofreadPagePrevURL ) +
 47+ '" title="' + escapeQuotesHTML( proofreadPageMessagePrevPage ) + '">' +
 48+ '<img src="' + wgScriptPath + '/extensions/ProofreadPage/leftarrow.png" alt="' +
 49+ escapeQuotesHTML( proofreadPageMessagePrevPage ) +
 50+ '" width="15" height="15" /></a></span></li>' +
 51+ b[0].innerHTML;
 52+ }
5253 }
5354
54 -
55 -
56 -
57 -function pr_image_url(requested_width){
58 - if(self.proofreadPageExternalURL) {
 55+function pr_image_url( requested_width ) {
 56+ if( self.proofreadPageExternalURL ) {
5957 self.DisplayWidth = requested_width;
60 - self.DisplayHeight = "";
 58+ self.DisplayHeight = '';
6159 return self.proofreadPageExternalURL;
62 - }
63 - else {
64 - //enforce quantization: width must be multiple of 100px
65 - var width = 100 * Math.round( requested_width /100 );
66 - //compare to the width of the image
 60+ } else {
 61+ // enforce quantization: width must be multiple of 100px
 62+ var width = 100 * Math.round( requested_width / 100 );
 63+ // compare to the width of the image
6764 width = Math.min( width, proofreadPageWidth );
6865 self.DisplayWidth = width;
69 - self.DisplayHeight = width*proofreadPageHeight/proofreadPageWidth;
70 - return proofreadPageThumbURL.replace( '##WIDTH##', "" + width );
 66+ self.DisplayHeight = width * proofreadPageHeight / proofreadPageWidth;
 67+ return proofreadPageThumbURL.replace( '##WIDTH##', '' + width );
7168 }
7269 }
7370
74 -
75 -
76 -function pr_make_edit_area(container,text){
77 -
 71+function pr_make_edit_area( container, text ) {
7872 re = /^<noinclude>([\s\S]*?)\n*<\/noinclude>([\s\S]*)<noinclude>([\s\S]*?)<\/noinclude>\n$/;
79 - m = text.match(re);
80 - if(m) {
 73+ m = text.match( re );
 74+ if( m ) {
8175 pageHeader = m[1];
8276 pageBody = m[2];
8377 pageFooter = m[3];
84 - }
85 - else {
 78+ } else {
8679 re2 = /^<noinclude>([\s\S]*?)\n*<\/noinclude>([\s\S]*?)\n$/;
87 - m2 = text.match(re2);
88 - if(m2) {
 80+ m2 = text.match( re2 );
 81+ if( m2 ) {
8982 pageHeader = m2[1];
90 - //apparently lookahead is not supported by all browsers
91 - //so let us do another regexp
 83+ // apparently lookahead is not supported by all browsers
 84+ // so let us do another regexp
9285 re3 = /^([\s\S]*?)<noinclude>([\s\S]*?)<\/noinclude>/;
93 - m3 = m2[2].match(re3);
94 - if(m3){
 86+ m3 = m2[2].match( re3 );
 87+ if( m3 ) {
9588 pageBody = m3[1];
9689 pageFooter = m3[2];
97 - }
98 - else{
 90+ } else {
9991 pageBody = m2[2];
10092 pageFooter = '';
10193 }
102 - }
103 - else {
 94+ } else {
10495 pageHeader = proofreadPageHeader;
10596 pageBody = text;
10697 pageFooter = proofreadPageFooter;
107 - if(document.editform) {
108 - document.editform.elements["wpSummary"].value="/* "+proofreadPageMessageQuality1+" */ ";
 98+ if( document.editform ) {
 99+ document.editform.elements['wpSummary'].value = '/* ' + proofreadPageMessageQuality1 + ' */ ';
109100 }
110101 }
111102 }
112103
113 - //find the PageQuality template
114 - //we do this separately from header detection,
115 - //because the template might not be in the header
 104+ // find the PageQuality template
 105+ // we do this separately from header detection,
 106+ // because the template might not be in the header
116107 var reg = /<pagequality level=\"(0|1|2|3|4)\" user=\"(.*?)\" \/>/g;
117 - var m4 = reg.exec(pageHeader);
 108+ var m4 = reg.exec( pageHeader );
118109 var old_reg = /\{\{PageQuality\|(0|1|2|3|4)(\|(.*?|))\}\}/g;
119 - var old_m4 = old_reg.exec(pageHeader);
 110+ var old_m4 = old_reg.exec( pageHeader );
120111 if( m4 ) {
121112 switch( m4[1] ) {
122 - case "0": self.proofreadpage_quality = 0; break;
123 - case "1": self.proofreadpage_quality = 1; break;
124 - case "2": self.proofreadpage_quality = 2; break;
125 - case "3": self.proofreadpage_quality = 3; break;
126 - case "4": self.proofreadpage_quality = 4; break;
127 - default: self.proofreadpage_quality = 1;
 113+ case '0':
 114+ self.proofreadpage_quality = 0;
 115+ break;
 116+ case '1':
 117+ self.proofreadpage_quality = 1;
 118+ break;
 119+ case '2':
 120+ self.proofreadpage_quality = 2;
 121+ break;
 122+ case '3':
 123+ self.proofreadpage_quality = 3;
 124+ break;
 125+ case '4':
 126+ self.proofreadpage_quality = 4;
 127+ break;
 128+ default:
 129+ self.proofreadpage_quality = 1;
128130 }
129131 self.proofreadpage_username = m4[2];
130 - pageHeader = pageHeader.replace(reg,'');
131 - }
132 - else if (old_m4 ) {
 132+ pageHeader = pageHeader.replace( reg, '' );
 133+ } else if ( old_m4 ) {
133134 switch( old_m4[1] ) {
134 - case "0": self.proofreadpage_quality = 0; break;
135 - case "1": self.proofreadpage_quality = 1; break;
136 - case "2": self.proofreadpage_quality = 2; break;
137 - case "3": self.proofreadpage_quality = 3; break;
138 - case "4": self.proofreadpage_quality = 4; break;
139 - default: self.proofreadpage_quality = 1;
 135+ case '0':
 136+ self.proofreadpage_quality = 0;
 137+ break;
 138+ case '1':
 139+ self.proofreadpage_quality = 1;
 140+ break;
 141+ case '2':
 142+ self.proofreadpage_quality = 2;
 143+ break;
 144+ case '3':
 145+ self.proofreadpage_quality = 3;
 146+ break;
 147+ case '4':
 148+ self.proofreadpage_quality = 4;
 149+ break;
 150+ default:
 151+ self.proofreadpage_quality = 1;
140152 }
141153 self.proofreadpage_username = old_m4[3];
142 - pageHeader = pageHeader.replace(old_reg,'');
 154+ pageHeader = pageHeader.replace( old_reg, '' );
 155+ } else {
 156+ self.proofreadpage_quality = 1;
 157+ self.proofreadpage_username = '';
143158 }
144 - else {
145 - self.proofreadpage_quality = 1;
146 - self.proofreadpage_username = "";
 159+ // detect the container div
 160+ if( pageHeader.match( "^<div class=\"pagetext\">" ) && pageFooter.match( "</div>$" ) ) {
 161+ pageHeader = pageHeader.substr( 22, pageHeader.length );
 162+ pageFooter = pageFooter.substr( 0, pageFooter.length - 6 );
147163 }
148 - //detect the container div
149 - if( pageHeader.match("^<div class=\"pagetext\">") && pageFooter.match("</div>$") ) {
150 - pageHeader = pageHeader.substr(22,pageHeader.length);
151 - pageFooter = pageFooter.substr(0,pageFooter.length-6);
152 - }
153164
154 - //escape & character
155 - pageBody = pageBody.split("&").join("&amp;")
156 - pageHeader = pageHeader.split("&").join("&amp;")
157 - pageFooter = pageFooter.split("&").join("&amp;")
 165+ // escape & character
 166+ pageBody = pageBody.split( '&' ).join( '&amp;' );
 167+ pageHeader = pageHeader.split( '&' ).join( '&amp;' );
 168+ pageFooter = pageFooter.split( '&' ).join( '&amp;' );
158169
159 - container.innerHTML = ''
160 - + '<div id="prp_header" style="">'
161 - + '<span style="color:gray;font-size:80%;line-height:100%;">'
162 - + escapeQuotesHTML(proofreadPageMessageHeader) + '</span>'
163 - + '<textarea name="wpHeaderTextbox" rows="2" cols="80" tabindex=1>' + pageHeader + '</textarea><br/>'
164 - + '<span style="color:gray;font-size:80%;line-height:100%;">'
165 - + escapeQuotesHTML(proofreadPageMessagePageBody) + '</span></div>'
166 - + '<textarea name="wpTextbox1" id="wpTextbox1" tabindex=1 style="height:' + ( self.DisplayHeight - 6 ) + 'px;">' + pageBody + '</textarea>'
167 - + '<div id="prp_footer" style="">'
168 - + '<span style="color:gray;font-size:80%;line-height:100%;">'
169 - + escapeQuotesHTML(proofreadPageMessageFooter) + '</span><br/>'
170 - + '<textarea name="wpFooterTextbox" rows="2" cols="80" tabindex=1>'+pageFooter+'</textarea></div>';
171 -
172 -
 170+ container.innerHTML = '' +
 171+ '<div id="prp_header" style="">' +
 172+ '<span style="color:gray;font-size:80%;line-height:100%;">' +
 173+ escapeQuotesHTML( proofreadPageMessageHeader ) + '</span>' +
 174+ '<textarea name="wpHeaderTextbox" rows="2" cols="80" tabindex=1>' + pageHeader + '</textarea><br />' +
 175+ '<span style="color:gray;font-size:80%;line-height:100%;">' +
 176+ escapeQuotesHTML( proofreadPageMessagePageBody ) + '</span></div>' +
 177+ '<textarea name="wpTextbox1" id="wpTextbox1" tabindex=1 style="height:' + ( self.DisplayHeight - 6 ) + 'px;">' +
 178+ pageBody + '</textarea>' +
 179+ '<div id="prp_footer" style="">' +
 180+ '<span style="color:gray;font-size:80%;line-height:100%;">' +
 181+ escapeQuotesHTML( proofreadPageMessageFooter ) + '</span><br />' +
 182+ '<textarea name="wpFooterTextbox" rows="2" cols="80" tabindex=1>' +
 183+ pageFooter + '</textarea></div>';
173184 }
174185
175 -
176186 function pr_reset_size() {
177 -
178 - var box = document.getElementById("wpTextbox1");
179 - var h = document.getElementById("prp_header");
180 - var f = document.getElementById("prp_footer");
181 - if( h.style.cssText == 'display:none;') {
182 - box.style.cssText = "height:" + ( self.DisplayHeight - 6 ) + "px";
 187+ var box = document.getElementById( 'wpTextbox1' );
 188+ var h = document.getElementById( 'prp_header' );
 189+ var f = document.getElementById( 'prp_footer' );
 190+ if( h.style.cssText == 'display:none;' ) {
 191+ box.style.cssText = 'height:' + ( self.DisplayHeight - 6 ) + 'px';
183192 } else {
184193 if( self.pr_horiz ) {
185 - box.style.cssText = "height:" + ( self.DisplayHeight - 6 ) + "px";
 194+ box.style.cssText = 'height:' + ( self.DisplayHeight - 6 ) + 'px';
186195 } else {
187 - box.style.cssText = "height:" + ( self.DisplayHeight - 6 - h.offsetHeight - f.offsetHeight) + "px";
 196+ box.style.cssText = 'height:' + ( self.DisplayHeight - 6 - h.offsetHeight - f.offsetHeight ) + 'px';
188197 }
189198 }
190199 }
191200
192201 function pr_toggle_visibility() {
193 -
194 - var box = document.getElementById("wpTextbox1");
195 - var h = document.getElementById("prp_header");
196 - var f = document.getElementById("prp_footer");
197 - if( h.style.cssText == ''){
 202+ var box = document.getElementById( 'wpTextbox1' );
 203+ var h = document.getElementById( 'prp_header' );
 204+ var f = document.getElementById( 'prp_footer' );
 205+ if( h.style.cssText == '' ) {
198206 h.style.cssText = 'display:none';
199207 f.style.cssText = 'display:none';
200208 } else {
@@ -204,191 +212,189 @@
205213 }
206214
207215 function pr_toggle_layout() {
208 -
209216 self.pr_horiz = ! self.pr_horiz;
210217 pr_fill_table();
211218 pr_reset_size();
212 - pr_zoom(0);
 219+ pr_zoom( 0 );
213220 }
214221
215 -
216 -
217 -
218 -
219222 /*
220 - * Mouse Zoom. Credits: http://valid.tjp.hu/zoom/
 223+ * Mouse Zoom. Credits: http://valid.tjp.hu/zoom/
221224 */
222225
223226 // global vars
224227 var lastxx, lastyy, xx, yy;
225228
226 -var zp_clip; //zp_clip is the large image
 229+var zp_clip; // zp_clip is the large image
227230 var zp_container;
228231
229 -var zoomamount_h=2;
230 -var zoomamount_w=2;
231 -var zoomamount=2;
232 -var zoom_status='';
 232+var zoomamount_h = 2;
 233+var zoomamount_w = 2;
 234+var zoomamount = 2;
 235+var zoom_status = '';
233236
234 -var ieox=0; var ieoy=0;
235 -var ffox=0; var ffoy=0;
 237+var ieox = 0;
 238+var ieoy = 0;
 239+var ffox = 0;
 240+var ffoy = 0;
236241
237 -
238 -
239 -/*relative coordinates of the mouse pointer*/
240 -function get_xy(evt){
241 -
242 - if(typeof(evt) == 'object') {
243 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
244 - if(evt.pageX) {
245 - xx=evt.pageX - ffox;
246 - yy=evt.pageY - ffoy;
 242+/* relative coordinates of the mouse pointer */
 243+function get_xy( evt ) {
 244+ if( typeof( evt ) == 'object' ) {
 245+ evt = evt ? evt : window.event ? window.event : null;
 246+ if( !evt ) {
 247+ return false;
247248 }
248 - else {
249 - xx=evt.clientX - ieox;
250 - yy=evt.clientY - ieoy;
 249+ if( evt.pageX ) {
 250+ xx = evt.pageX - ffox;
 251+ yy = evt.pageY - ffoy;
 252+ } else {
 253+ xx = evt.clientX - ieox;
 254+ yy = evt.clientY - ieoy;
251255 }
 256+ } else {
 257+ xx = lastxx;
 258+ yy = lastyy;
252259 }
253 - else {
254 - xx = lastxx;
255 - yy = lastyy;
256 - }
257 - lastxx = xx;
 260+ lastxx = xx;
258261 lastyy = yy;
259 -
260262 }
261263
262 -//mouse move
263 -function zoom_move(evt) {
264 -
265 - if(zoom_status != 1) { return false;}
266 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
267 - get_xy(evt);
268 - zp_clip.style.margin = ((yy > objh )?(objh*(1-zoomamount_h)):(yy*(1-zoomamount_h))) + 'px 0px 0px '
269 - + ((xx > objw )?(objw*(1-zoomamount_w)):(xx*(1-zoomamount_w))) + 'px';
 264+// mouse move
 265+function zoom_move( evt ) {
 266+ if( zoom_status != 1 ) {
 267+ return false;
 268+ }
 269+ evt = evt ? evt : window.event ? window.event : null;
 270+ if( !evt ) {
 271+ return false;
 272+ }
 273+ get_xy( evt );
 274+ zp_clip.style.margin = ( ( yy > objh ) ? ( objh * ( 1 - zoomamount_h ) ) :
 275+ ( yy * ( 1 - zoomamount_h ) ) ) + 'px 0px 0px ' +
 276+ ( ( xx > objw ) ? ( objw * ( 1 - zoomamount_w ) ) :
 277+ ( xx * ( 1 - zoomamount_w ) ) ) + 'px';
270278 return false;
271279 }
272280
273 -
274 -
275 -
276 -
277 -
278281 function zoom_off() {
279 - zp_container.style.width='0px';
280 - zp_container.style.height='0px';
 282+ zp_container.style.width = '0px';
 283+ zp_container.style.height = '0px';
281284 zoom_status = 0;
282285 }
283286
284 -
285 -
286 -
287287 function countoffset() {
288 - zme=document.getElementById("pr_container");
289 - ieox=0; ieoy=0;
290 - for(zmi=0;zmi<50;zmi++) {
291 - if(zme+1 == 1) {
 288+ zme = document.getElementById( 'pr_container' );
 289+ ieox = 0;
 290+ ieoy = 0;
 291+ for( zmi = 0; zmi < 50; zmi++ ) {
 292+ if( zme+1 == 1 ) {
292293 break;
293 - }
294 - else {
295 - ieox+=zme.offsetLeft;
296 - ieoy+=zme.offsetTop;
 294+ } else {
 295+ ieox += zme.offsetLeft;
 296+ ieoy += zme.offsetTop;
297297 }
298 - zme=zme.offsetParent;
 298+ zme=zme.offsetParent;
299299 }
300 - ffox=ieox;
301 - ffoy=ieoy;
302 - ieox-=document.body.scrollLeft;
303 - ieoy-=document.body.scrollTop;
 300+ ffox = ieox;
 301+ ffoy = ieoy;
 302+ ieox -= document.body.scrollLeft;
 303+ ieoy -= document.body.scrollTop;
304304 }
305305
 306+function zoom_mouseup( evt ) {
 307+ evt = evt ? evt : window.event ? window.event : null;
 308+ if( !evt ) {
 309+ return false;
 310+ }
306311
307 -
308 -
309 -function zoom_mouseup(evt) {
310 -
311 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
312 -
313 - //only left button; see http://unixpapa.com/js/mouse.html for why it is this complicated
314 - if(evt.which == null) {
315 - if(evt.button != 1) return false;
 312+ // only left button; see http://unixpapa.com/js/mouse.html for why it is this complicated
 313+ if( evt.which == null) {
 314+ if( evt.button != 1 ) {
 315+ return false;
 316+ }
316317 } else {
317 - if(evt.which > 1) return false;
 318+ if( evt.which > 1 ) {
 319+ return false;
 320+ }
318321 }
319322
320 - if(zoom_status == 0) {
321 - zoom_on(evt);
 323+ if( zoom_status == 0 ) {
 324+ zoom_on( evt );
322325 return false;
323 - }
324 - else if(zoom_status == 1) {
 326+ } else if( zoom_status == 1 ) {
325327 zoom_status = 2;
326328 return false;
327 - }
328 - else if(zoom_status == 2) {
329 - zoom_off();
 329+ } else if( zoom_status == 2 ) {
 330+ zoom_off();
330331 return false;
331332 }
332333 return false;
333334 }
334335
 336+function zoom_on( evt ) {
 337+ evt = evt ? evt : window.event ? window.event : null;
 338+ if( !evt ) {
 339+ return false;
 340+ }
 341+ zoom_status = 1;
335342
336 -function zoom_on(evt) {
337 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
338 - zoom_status=1;
339 -
340 - if(evt.pageX) {
 343+ if( evt.pageX ) {
341344 countoffset();
342 - lastxx=evt.pageX - ffox;
343 - lastyy=evt.pageY - ffoy;
344 - }
345 - else {
 345+ lastxx = evt.pageX - ffox;
 346+ lastyy = evt.pageY - ffoy;
 347+ } else {
346348 countoffset();
347 - lastxx=evt.clientX - ieox;
348 - lastyy=evt.clientY - ieoy;
 349+ lastxx = evt.clientX - ieox;
 350+ lastyy = evt.clientY - ieoy;
349351 }
350352
351 - zoomamount_h = zp_clip.height/objh;
352 - zoomamount_w = zp_clip.width/objw;
 353+ zoomamount_h = zp_clip.height / objh;
 354+ zoomamount_w = zp_clip.width / objw;
353355
354 - zp_container.style.width = objw+'px';
355 - zp_container.style.height = objh+'px';
356 - zp_clip.style.margin = ((lastyy > objh )?(objh*(1-zoomamount_h)):(lastyy*(1-zoomamount_h))) + 'px 0px 0px '
357 - + ((lastxx > objw )?(objw*(1-zoomamount_w)):(lastxx*(1-zoomamount_w))) + 'px';
 356+ zp_container.style.width = objw + 'px';
 357+ zp_container.style.height = objh + 'px';
 358+ zp_clip.style.margin = ( ( lastyy > objh ) ? ( objh * ( 1 - zoomamount_h ) ) :
 359+ ( lastyy * ( 1 - zoomamount_h ) ) ) + 'px 0px 0px ' +
 360+ ( ( lastxx > objw ) ? ( objw * ( 1 - zoomamount_w ) ) : ( lastxx * ( 1 - zoomamount_w ) ) ) + 'px';
358361
359362 return false;
360363 }
361364
362365
363366 //zoom using two images (magnification glass)
364 -function pr_initzoom(){
365 - if(proofreadPageIsEdit) return;
366 - if( !self.proofreadPageThumbURL ) return;
367 - if(self.DisplayWidth>800) return;
 367+function pr_initzoom() {
 368+ if( proofreadPageIsEdit ) {
 369+ return;
 370+ }
 371+ if( !self.proofreadPageThumbURL ) {
 372+ return;
 373+ }
 374+ if( self.DisplayWidth > 800 ) {
 375+ return;
 376+ }
368377
369 - zp = document.getElementById("pr_container");
370 - if(zp){
371 - var hires_url = pr_image_url(800);
 378+ zp = document.getElementById( 'pr_container' );
 379+ if( zp ) {
 380+ var hires_url = pr_image_url( 800 );
372381 self.objw = zp.firstChild.width;
373382 self.objh = zp.firstChild.height;
374383
375384 zp.onmouseup = zoom_mouseup;
376385 zp.onmousemove = zoom_move;
377 - zp_container = document.createElement("div");
378 - zp_container.style.cssText ="position:absolute; width:0; height:0; overflow:hidden;";
379 - zp_clip = document.createElement("img");
380 - zp_clip.setAttribute("src", hires_url);
381 - zp_clip.style.cssText = "padding:0;margin:0;border:0;";
382 - zp_container.appendChild(zp_clip);
383 - zp.insertBefore(zp_container,zp.firstChild);
384 -
 386+ zp_container = document.createElement( 'div' );
 387+ zp_container.style.cssText = 'position:absolute; width:0; height:0; overflow:hidden;';
 388+ zp_clip = document.createElement( 'img' );
 389+ zp_clip.setAttribute( 'src', hires_url );
 390+ zp_clip.style.cssText = 'padding:0;margin:0;border:0;';
 391+ zp_container.appendChild( zp_clip );
 392+ zp.insertBefore( zp_container, zp.firstChild );
385393 }
386394 }
387395
388 -
389 -
390396 /********************************
391397 * new zoom : mouse wheel
392 - *
 398+ *
393399 ********************************/
394400
395401 /* width and margin of the scan */
@@ -408,49 +414,64 @@
409415 /* size of the window */
410416 var pr_width = 0, pr_height = 0;
411417
412 -function set_container_css(show_scrollbars){
413 - var sl = pr_container.scrollLeft;//read scrollbar values
 418+function set_container_css( show_scrollbars ) {
 419+ var sl = pr_container.scrollLeft; // read scrollbar values
414420 var st = pr_container.scrollTop;
415 - if(show_scrollbars) {
416 - self.container_css = self.container_css.replace("overflow:hidden","overflow:auto");
417 - self.container_css = self.container_css.replace("cursor:crosshair","cursor:default");
418 - //we should check if the sb is going to be shown
419 - if(margin_x<0) { sl = - Math.round(margin_x); margin_x=0; }
420 - if(margin_y<0) { st = - Math.round(margin_y); margin_y=0; }
 421+ if( show_scrollbars ) {
 422+ self.container_css = self.container_css.replace( 'overflow:hidden', 'overflow:auto' );
 423+ self.container_css = self.container_css.replace( 'cursor:crosshair', 'cursor:default' );
 424+ // we should check if the sb is going to be shown
 425+ if( margin_x < 0 ) {
 426+ sl = - Math.round( margin_x );
 427+ margin_x = 0;
 428+ }
 429+ if( margin_y < 0 ) {
 430+ st = - Math.round( margin_y );
 431+ margin_y = 0;
 432+ }
421433 } else {
422 - self.container_css = self.container_css.replace("overflow:auto","overflow:hidden");
423 - self.container_css = self.container_css.replace("cursor:default","cursor:crosshair");
424 - if(sl) {
 434+ self.container_css = self.container_css.replace( 'overflow:auto', 'overflow:hidden' );
 435+ self.container_css = self.container_css.replace( 'cursor:default', 'cursor:crosshair' );
 436+ if( sl ) {
425437 margin_x -= sl;
426438 sl = 0;
427439 }
428 - if(st) {
 440+ if( st ) {
429441 margin_y -= st;
430442 st = 0;
431443 }
432444 }
433 - pr_set_margins(margin_x, margin_y, false);
 445+ pr_set_margins( margin_x, margin_y, false );
434446 pr_container.scrollLeft = sl;
435447 pr_container.scrollTop = st;
436 -
437448 }
438449
439 -function pr_drop(evt){
440 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
441 - get_xy(evt); if(xx>pr_container.offsetWidth-20 || yy>pr_container.offsetHeight-20) return false;
 450+function pr_drop( evt ) {
 451+ evt = evt ? evt : window.event ? window.event : null;
 452+ if( !evt ) {
 453+ return false;
 454+ }
 455+ get_xy( evt );
 456+ if( xx > pr_container.offsetWidth - 20 || yy > pr_container.offsetHeight - 20 ) {
 457+ return false;
 458+ }
442459
443460 document.onmouseup = null;
444461 document.onmousemove = null;
445462 document.onmousedown = null;
446463 pr_container.onmousemove = pr_move;
447 - if( is_drag==false ) {
 464+ if( is_drag == false ) {
448465 is_zoom = !is_zoom;
449466 } else {
450 - if(is_zoom) {
451 - is_zoom=false;
452 - if(boxWidth*boxWidth+boxHeight*boxHeight >= 2500){
453 - var ratio_x = Math.abs( pr_container.offsetWidth/self.boxWidth );
454 - pr_set_margins( (margin_x - xMin)*ratio_x, (margin_y - yMin)*ratio_x, img_width*ratio_x ) ;
 467+ if( is_zoom ) {
 468+ is_zoom = false;
 469+ if( boxWidth * boxWidth + boxHeight * boxHeight >= 2500 ) {
 470+ var ratio_x = Math.abs( pr_container.offsetWidth / self.boxWidth );
 471+ pr_set_margins(
 472+ ( margin_x - xMin ) * ratio_x,
 473+ ( margin_y - yMin ) * ratio_x,
 474+ img_width * ratio_x
 475+ );
455476 }
456477 }
457478 }
@@ -460,34 +481,43 @@
461482 return false;
462483 }
463484
464 -function pr_grab(evt){
465 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
466 - get_xy(evt); if(xx>pr_container.offsetWidth-20 || yy>pr_container.offsetHeight-20) return false;
 485+function pr_grab( evt ) {
 486+ evt = evt ? evt : window.event ? window.event : null;
 487+ if( !evt ) {
 488+ return false;
 489+ }
 490+ get_xy( evt );
 491+ if( xx > pr_container.offsetWidth - 20 || yy > pr_container.offsetHeight - 20 ) {
 492+ return false;
 493+ }
467494
468 - //only left button; see http://unixpapa.com/js/mouse.html for why it is this complicated
469 - if(evt.which == null) {
470 - if(evt.button != 1) return false;
 495+ // only left button; see http://unixpapa.com/js/mouse.html for why it is this complicated
 496+ if( evt.which == null ) {
 497+ if( evt.button != 1 ) {
 498+ return false;
 499+ }
471500 } else {
472 - if(evt.which > 1) return false;
 501+ if( evt.which > 1 ) {
 502+ return false;
 503+ }
473504 }
474505
475 - document.onmousedown = function(){return false;};
 506+ document.onmousedown = function() { return false; };
476507 document.onmousemove = pr_drag;
477508 document.onmouseup = pr_drop;
478509 pr_container.onmousemove = pr_drag;
479510
480 - if(evt.pageX) {
 511+ if( evt.pageX ) {
481512 countoffset();
482 - lastxx=evt.pageX - ffox;
483 - lastyy=evt.pageY - ffoy;
484 - }
485 - else {
 513+ lastxx = evt.pageX - ffox;
 514+ lastyy = evt.pageY - ffoy;
 515+ } else {
486516 countoffset();
487 - lastxx=evt.clientX - ieox;
488 - lastyy=evt.clientY - ieoy;
 517+ lastxx = evt.clientX - ieox;
 518+ lastyy = evt.clientY - ieoy;
489519 }
490 -
491 - if(is_zoom){
 520+
 521+ if( is_zoom ) {
492522 init_x = - margin_x + lastxx;
493523 init_y = - margin_y + lastyy;
494524 } else {
@@ -496,22 +526,29 @@
497527 }
498528 is_drag = false;
499529 return false;
500 -
501530 }
502531
503 -
504 -function pr_move(evt) {
505 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
 532+function pr_move( evt ) {
 533+ evt = evt ? evt : window.event ? window.event : null;
 534+ if( !evt ) {
 535+ return false;
 536+ }
506537 countoffset();
507538 get_xy(evt);
508539 }
509540
510 -function pr_drag(evt) {
511 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
512 - get_xy(evt); if(xx>pr_container.offsetWidth-20 || yy>pr_container.offsetHeight-20) return false;
513 - if(!is_zoom) {
514 - pr_container.scrollLeft = (init_x-xx);
515 - pr_container.scrollTop = (init_y-yy);
 541+function pr_drag( evt ) {
 542+ evt = evt ? evt : window.event ? window.event : null;
 543+ if( !evt ) {
 544+ return false;
 545+ }
 546+ get_xy( evt );
 547+ if( xx > pr_container.offsetWidth - 20 || yy > pr_container.offsetHeight - 20 ) {
 548+ return false;
 549+ }
 550+ if( !is_zoom ) {
 551+ pr_container.scrollLeft = ( init_x - xx );
 552+ pr_container.scrollTop = ( init_y - yy );
516553 } else {
517554 self.xMin = Math.min( init_x + margin_x, xx );
518555 self.yMin = Math.min( init_y + margin_y, yy );
@@ -519,437 +556,477 @@
520557 self.yMax = Math.max( init_y + margin_y, yy );
521558 self.boxWidth = Math.max( xMax-xMin, 1 );
522559 self.boxHeight = Math.max( yMax-yMin, 1 );
523 - if(boxWidth*boxWidth+boxHeight*boxHeight < 2500){
524 - pr_rect.style.cssText = "display:none;";
 560+ if( boxWidth * boxWidth + boxHeight * boxHeight < 2500 ) {
 561+ pr_rect.style.cssText = 'display:none;';
525562 } else {
526 - ratio = pr_container.offsetWidth/pr_container.offsetHeight;
527 - if(boxWidth/boxHeight < ratio ) {
528 - boxWidth = boxHeight*ratio;
529 - if(xx==xMin) xMin = init_x + margin_x - boxWidth;
 563+ ratio = pr_container.offsetWidth / pr_container.offsetHeight;
 564+ if( boxWidth / boxHeight < ratio ) {
 565+ boxWidth = boxHeight * ratio;
 566+ if( xx == xMin ) {
 567+ xMin = init_x + margin_x - boxWidth;
 568+ }
530569 } else {
531 - boxHeight = boxWidth/ratio;
532 - if(yy==yMin) yMin = init_y + margin_y - boxHeight;
 570+ boxHeight = boxWidth / ratio;
 571+ if( yy == yMin ) {
 572+ yMin = init_y + margin_y - boxHeight;
 573+ }
533574 }
534 - pr_rect.style.cssText = "cursor:crosshair;opacity:0.5;position:absolute;left:"+ xMin +"px;top:"+ yMin +"px;width:"+boxWidth+"px;height:"+boxHeight+"px;background:#000000;";
 575+ pr_rect.style.cssText = 'cursor:crosshair;opacity:0.5;position:absolute;left:' +
 576+ xMin + 'px;top:' + yMin + 'px;width:' + boxWidth + 'px;height:' +
 577+ boxHeight + 'px;background:#000000;';
535578 }
536579 }
537 - if (evt.preventDefault) evt.preventDefault();
 580+ if ( evt.preventDefault ) {
 581+ evt.preventDefault();
 582+ }
538583 evt.returnValue = false;
539584 is_drag = true;
540585 return false;
541586 }
542587
543588
544 -function pr_set_margins(mx, my, new_width) {
545 - var zp_img = document.getElementById("ProofReadImage");
546 - if(zp_img) {
 589+function pr_set_margins( mx, my, new_width ) {
 590+ var zp_img = document.getElementById( 'ProofReadImage' );
 591+ if( zp_img ) {
547592 margin_x = mx;
548593 margin_y = my;
549 - zp_img.style.margin = Math.round(margin_y) + 'px 0px 0px ' + Math.round(margin_x) + 'px';
550 - if(new_width) {
551 - img_width = Math.round(new_width);
 594+ zp_img.style.margin = Math.round( margin_y ) + 'px 0px 0px ' + Math.round( margin_x ) + 'px';
 595+ if( new_width ) {
 596+ img_width = Math.round( new_width );
552597 zp_img.width = img_width;
553598 }
554 - pr_container.style.cssText = self.container_css; //needed by IE6
 599+ pr_container.style.cssText = self.container_css; // needed by IE6
555600 }
556601 }
557602
558 -
559 -function pr_zoom(delta) {
560 -
561 - if (delta == 0) {
562 - //reduce width by 20 pixels in order to prevent horizontal scrollbar from showing up
563 - pr_set_margins(0, 0, pr_container.offsetWidth-20);
 603+function pr_zoom( delta ) {
 604+ if ( delta == 0 ) {
 605+ // reduce width by 20 pixels in order to prevent horizontal scrollbar
 606+ // from showing up
 607+ pr_set_margins( 0, 0, pr_container.offsetWidth - 20 );
564608 } else {
565609 var old_margin_x = margin_x;
566610 var old_margin_y = margin_y;
567611 var old_width = img_width;
568 - var new_width = Math.round(old_width*Math.pow(1.1,delta));
 612+ var new_width = Math.round( old_width * Math.pow( 1.1, delta ) );
569613 var delta_w = new_width - old_width;
570 - if(delta_w==0) return;
571 - var s = (delta_w>0)?1:-1;
572 - for(var dw=s; dw != delta_w; dw=dw+s){
573 - var lambda = (old_width + dw)/old_width;
574 - pr_set_margins(xx - lambda*(xx - old_margin_x), yy - lambda*(yy - old_margin_y), old_width+dw);
 614+ if( delta_w == 0 ) {
 615+ return;
575616 }
 617+ var s = ( delta_w > 0 ) ? 1 : -1;
 618+ for( var dw = s; dw != delta_w; dw = dw + s ) {
 619+ var lambda = ( old_width + dw ) / old_width;
 620+ pr_set_margins(
 621+ xx - lambda * ( xx - old_margin_x ),
 622+ yy - lambda * ( yy - old_margin_y ),
 623+ old_width + dw
 624+ );
 625+ }
576626 }
577627 }
578628
579 -function pr_zoom_wheel(evt) {
580 -
581 - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;}
 629+function pr_zoom_wheel( evt ) {
 630+ evt = evt ? evt : window.event ? window.event : null;
 631+ if( !evt ) {
 632+ return false;
 633+ }
582634 var delta = 0;
583 - if (evt.wheelDelta) {
 635+ if ( evt.wheelDelta ) {
584636 /* IE/Opera. */
585 - delta = evt.wheelDelta/120;
 637+ delta = evt.wheelDelta / 120;
 638+ } else if ( evt.detail ) {
 639+ /**
 640+ * Mozilla case.
 641+ * In Mozilla, sign of delta is different than in IE.
 642+ * Also, delta is multiple of 3.
 643+ */
 644+ delta = -evt.detail / 3;
586645 }
587 - else if (evt.detail) {
588 - /** Mozilla case. */
589 - /** In Mozilla, sign of delta is different than in IE.
590 - * Also, delta is multiple of 3.
591 - */
592 - delta = -evt.detail/3;
593 - }
594 - if(is_zoom && delta) {
595 - if(!self.proofreadpage_disable_wheelzoom) pr_zoom(delta);
596 - if(evt.preventDefault) evt.preventDefault();
 646+ if( is_zoom && delta ) {
 647+ if( !self.proofreadpage_disable_wheelzoom ) {
 648+ pr_zoom( delta );
 649+ }
 650+ if( evt.preventDefault ) {
 651+ evt.preventDefault();
 652+ }
597653 evt.returnValue = false;
598654 }
599655 }
600656
601 -
602 -
603 -
604657 /* fill table with textbox and image */
605 -function pr_fill_table(){
606 -
607 - //remove existing table
608 - while(self.table.firstChild){
609 - self.table.removeChild(self.table.firstChild);
 658+function pr_fill_table() {
 659+ // remove existing table
 660+ while( self.table.firstChild ) {
 661+ self.table.removeChild( self.table.firstChild );
610662 }
611663
612 - //setup the layout
613 - if(!pr_horiz) {
614 - //use a table only here
615 - var t_table = document.createElement("table");
616 - var t_body = document.createElement("tbody");
617 - var cell_left = document.createElement("td");
618 - var cell_right = document.createElement("td");
619 - t_table.appendChild(t_body);
 664+ // setup the layout
 665+ if( !pr_horiz ) {
 666+ // use a table only here
 667+ var t_table = document.createElement( 'table' );
 668+ var t_body = document.createElement( 'tbody' );
 669+ var cell_left = document.createElement( 'td' );
 670+ var cell_right = document.createElement( 'td' );
 671+ t_table.appendChild( t_body );
620672
621 - var t_row = document.createElement("tr");
622 - t_row.setAttribute("valign","top");
623 - cell_left.style.cssText = "width:50%; padding-right:0.5em;vertical-align:top;";
624 - cell_right.setAttribute("rowspan","3");
625 - cell_right.style.cssText = "vertical-align:top;";
626 - t_row.appendChild(cell_left);
627 - t_row.appendChild(cell_right);
628 - t_body.appendChild(t_row);
629 - cell_right.appendChild(pr_container_parent);
630 - cell_left.appendChild(self.text_container);
631 - self.table.appendChild(t_table);
 673+ var t_row = document.createElement( 'tr' );
 674+ t_row.setAttribute( 'valign', 'top' );
 675+ cell_left.style.cssText = 'width:50%; padding-right:0.5em;vertical-align:top;';
 676+ cell_right.setAttribute( 'rowspan', '3' );
 677+ cell_right.style.cssText = 'vertical-align:top;';
 678+ t_row.appendChild( cell_left );
 679+ t_row.appendChild( cell_right );
 680+ t_body.appendChild( t_row );
 681+ cell_right.appendChild( pr_container_parent );
 682+ cell_left.appendChild( self.text_container );
 683+ self.table.appendChild( t_table );
632684 } else {
633 - self.table.appendChild(self.text_container);
634 - form = document.getElementById("editform");
635 - tb = document.getElementById("toolbar");
636 - if(tb) tb.parentNode.insertBefore(pr_container_parent,tb);
637 - else if(form) form.parentNode.insertBefore(pr_container_parent,form);
638 - else self.table.insertBefore(pr_container_parent,self.table.firstChild);
 685+ self.table.appendChild( self.text_container );
 686+ form = document.getElementById( 'editform' );
 687+ tb = document.getElementById( 'toolbar' );
 688+ if( tb ) {
 689+ tb.parentNode.insertBefore( pr_container_parent, tb );
 690+ } else if( form ) {
 691+ form.parentNode.insertBefore( pr_container_parent, form );
 692+ } else {
 693+ self.table.insertBefore( pr_container_parent, self.table.firstChild );
 694+ }
639695 }
640 -
641 - if(proofreadPageIsEdit) {
642 - if(!pr_horiz){
643 - self.DisplayHeight = Math.ceil(pr_height*0.85);
644 - self.DisplayWidth = parseInt(pr_width/2-70);
645 - css_wh = "width:"+self.DisplayWidth+"px; height:"+self.DisplayHeight+"px;";
646 - pr_container_parent.style.cssText="position:relative;width:"+self.DisplayWidth+"px;";
 696+
 697+ if( proofreadPageIsEdit ) {
 698+ if( !pr_horiz ) {
 699+ self.DisplayHeight = Math.ceil( pr_height * 0.85);
 700+ self.DisplayWidth = parseInt( pr_width / 2 - 70 );
 701+ css_wh = 'width:' + self.DisplayWidth + 'px; height:' + self.DisplayHeight + 'px;';
 702+ pr_container_parent.style.cssText = 'position:relative;width:' + self.DisplayWidth + 'px;';
647703 } else {
648 - self.DisplayHeight = Math.ceil(pr_height*0.4);
649 - css_wh = "width:100%; height:"+self.DisplayHeight+"px;";
650 - pr_container_parent.style.cssText="position:relative;height:"+self.DisplayHeight+"px;";
 704+ self.DisplayHeight = Math.ceil( pr_height * 0.4 );
 705+ css_wh = 'width:100%; height:' + self.DisplayHeight + 'px;';
 706+ pr_container_parent.style.cssText = 'position:relative;height:' + self.DisplayHeight + 'px;';
651707 }
652 - self.container_css = "position:absolute;top:0px;cursor:default; background:#000000; overflow:auto; " + css_wh;
 708+ self.container_css = 'position:absolute;top:0px;cursor:default; background:#000000; overflow:auto; ' + css_wh;
653709 pr_container.style.cssText = self.container_css;
654710 }
655 - pr_zoom(0);
 711+ pr_zoom( 0 );
656712 }
657713
658 -
659 -
660714 function pr_load_image( view_url ) {
661 - pr_container.innerHTML = "<img id=\"ProofReadImage\" src=\""
662 - + escapeQuotesHTML( view_url )
663 - + "\" width=\"" + img_width + "\" />";
664 - pr_zoom(0);
 715+ pr_container.innerHTML = '<img id="ProofReadImage" src="' +
 716+ escapeQuotesHTML( view_url ) + '" width="' + img_width + '" />';
 717+ pr_zoom( 0 );
665718 }
666719
667 -
668 -
669720 function pr_setup() {
 721+ self.pr_horiz = ( self.proofreadpage_default_layout ==' horizontal' );
 722+ if( !proofreadPageIsEdit ) {
 723+ pr_horiz = false;
 724+ }
670725
671 - self.pr_horiz = (self.proofreadpage_default_layout=='horizontal');
672 - if(!proofreadPageIsEdit) pr_horiz = false;
 726+ self.table = document.createElement( 'div' );
 727+ self.text_container = document.createElement( 'div' );
673728
674 - self.table = document.createElement("div");
675 - self.text_container = document.createElement("div");
 729+ pr_container = document.createElement( 'div' );
 730+ pr_container.setAttribute( 'id', 'pr_container' );
676731
677 - pr_container = document.createElement("div");
678 - pr_container.setAttribute("id", "pr_container");
 732+ self.pr_container_parent = document.createElement( 'div' );
 733+ pr_container_parent.appendChild( pr_container );
679734
680 - self.pr_container_parent = document.createElement("div");
681 - pr_container_parent.appendChild(pr_container);
682 -
683 - //get the size of the window
 735+ // Get the size of the window
684736 if( typeof( window.innerWidth ) == 'number' ) {
685 - //Non-IE
 737+ // Non-IE
686738 pr_width = window.innerWidth;
687739 pr_height = window.innerHeight;
688740 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
689 - //IE 6+ in 'standards compliant mode'
 741+ // IE 6+ in 'standards compliant mode'
690742 pr_width = document.documentElement.clientWidth;
691743 pr_height = document.documentElement.clientHeight;
692744 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
693 - //IE 4 compatible
 745+ // IE 4 compatible
694746 pr_width = document.body.clientWidth;
695747 pr_height = document.body.clientHeight;
696748 }
697749
698 - //fill the image container
699 - if(!proofreadPageIsEdit) {
700 - //this sets DisplayWidth and DisplayHeight
701 - var thumb_url = pr_image_url(parseInt(pr_width/2-70));
702 - var image = document.createElement("img");
703 - image.setAttribute("id", "ProofReadImage");
704 - image.setAttribute("src", thumb_url);
705 - image.setAttribute("width", self.DisplayWidth);
706 - image.style.cssText = "padding:0;margin:0;border:0;";
707 - pr_container.appendChild(image);
708 - pr_container.style.cssText = "overflow:hidden;width:"+self.DisplayWidth+"px;";
 750+ // fill the image container
 751+ if( !proofreadPageIsEdit ) {
 752+ // this sets DisplayWidth and DisplayHeight
 753+ var thumb_url = pr_image_url( parseInt( pr_width / 2 - 70 ) );
 754+ var image = document.createElement( 'img' );
 755+ image.setAttribute( 'id', 'ProofReadImage' );
 756+ image.setAttribute( 'src', thumb_url );
 757+ image.setAttribute( 'width', self.DisplayWidth );
 758+ image.style.cssText = 'padding:0;margin:0;border:0;';
 759+ pr_container.appendChild( image );
 760+ pr_container.style.cssText = 'overflow:hidden;width:' + self.DisplayWidth + 'px;';
709761 } else {
710 - var w = parseInt(self.proofreadPageEditWidth);
711 - if( !w ) w = self.proofreadPageDefaultEditWidth;
712 - if( !w ) w = 1024; /* Default size in edit mode */
713 - var view_url = pr_image_url( Math.min( w, self.proofreadPageWidth ) );
714 - //prevent the container from being resized once the image is downloaded.
715 - img_width = pr_horiz?0:parseInt(pr_width/2-70)-20;
 762+ var w = parseInt( self.proofreadPageEditWidth );
 763+ if( !w ) {
 764+ w = self.proofreadPageDefaultEditWidth;
 765+ }
 766+ if( !w ) {
 767+ w = 1024; /* Default size in edit mode */
 768+ }
 769+ var view_url = pr_image_url( Math.min( w, self.proofreadPageWidth ) );
 770+ // prevent the container from being resized once the image is downloaded.
 771+ img_width = pr_horiz ? 0 : parseInt( pr_width / 2 - 70 ) - 20;
716772 pr_container.onmousedown = pr_grab;
717773 pr_container.onmousemove = pr_move;
718 - if (pr_container.addEventListener)
719 - pr_container.addEventListener('DOMMouseScroll', pr_zoom_wheel, false);
720 - pr_container.onmousewheel = pr_zoom_wheel;//IE,Opera.
721 - hookEvent( 'load', function() { pr_load_image(view_url); } );
 774+ if ( pr_container.addEventListener ) {
 775+ pr_container.addEventListener( 'DOMMouseScroll', pr_zoom_wheel, false );
 776+ }
 777+ pr_container.onmousewheel = pr_zoom_wheel; // IE, Opera.
 778+ hookEvent( 'load', function() { pr_load_image( view_url ); } );
722779 }
723780
724 - table.setAttribute("id", "textBoxTable");
725 - table.style.cssText = "width:100%;";
 781+ table.setAttribute( 'id', 'textBoxTable' );
 782+ table.style.cssText = 'width:100%;';
726783
727784 pr_fill_table();
728 -
729 - //insert the image
730 - if(proofreadPageIsEdit) {
731 - var text = document.getElementById("wpTextbox1");
 785+
 786+ // insert the image
 787+ if( proofreadPageIsEdit ) {
 788+ var text = document.getElementById( 'wpTextbox1' );
 789+ } else {
 790+ var text = document.getElementById( 'bodyContent' );
732791 }
733 - else {
734 - var text = document.getElementById("bodyContent");
 792+ if( !text ) {
 793+ return;
735794 }
736 - if(!text) return;
737 - var f = text.parentNode;
738 - var new_text = f.removeChild(text);
 795+ var f = text.parentNode;
 796+ var new_text = f.removeChild( text );
739797
740 - if(proofreadPageIsEdit) {
741 - pr_make_edit_area(self.text_container,new_text.value);
742 - var copywarn = document.getElementById("editpage-copywarn");
743 - f.insertBefore(table,copywarn);
744 - if ( ! self.proofreadpage_show_headers){
 798+ if( proofreadPageIsEdit ) {
 799+ pr_make_edit_area( self.text_container, new_text.value );
 800+ var copywarn = document.getElementById( 'editpage-copywarn' );
 801+ f.insertBefore( table, copywarn );
 802+ if ( !self.proofreadpage_show_headers ) {
745803 hookEvent( 'load', pr_toggle_visibility );
746804 }
 805+ } else {
 806+ self.text_container.appendChild( new_text );
 807+ f.appendChild( self.table );
747808 }
748 - else {
749 - self.text_container.appendChild(new_text);
750 - f.appendChild(self.table);
751 - }
752 -
753 - //add buttons
754 - if(proofreadPageIsEdit) {
755809
756 - var toolbar = document.getElementById("toolbar");
 810+ // add buttons
 811+ if( proofreadPageIsEdit ) {
 812+ var toolbar = document.getElementById( 'toolbar' );
757813
758 - var image = document.createElement("img");
 814+ var image = document.createElement( 'img' );
759815 image.width = 23;
760816 image.height = 22;
761 - image.className = "mw-toolbar-editbutton";
762 - image.src = wgScriptPath+'/extensions/ProofreadPage/button_category_plus.png';
 817+ image.className = 'mw-toolbar-editbutton';
 818+ image.src = wgScriptPath + '/extensions/ProofreadPage/button_category_plus.png';
763819 image.border = 0;
764820 image.alt = proofreadPageMessageToggleHeaders;
765821 image.title = proofreadPageMessageToggleHeaders;
766 - image.style.cursor = "pointer";
 822+ image.style.cursor = 'pointer';
767823 image.onclick = pr_toggle_visibility;
768 -
769 - var image3 = document.createElement("img");
 824+
 825+ var image3 = document.createElement( 'img' );
770826 image3.width = 23;
771827 image3.height = 22;
772828 image3.border = 0;
773 - image3.className = "mw-toolbar-proofread";
774 - image3.style.cursor = "pointer";
775 - image3.alt = "-";
776 - image3.title = "zoom out";
777 - image3.src = wgScriptPath+"/extensions/ProofreadPage/Button_zoom_out.png";
778 - image3.onclick = new Function("xx=0;yy=0;pr_zoom(-2);");
779 -
780 - var image4 = document.createElement("img");
 829+ image3.className = 'mw-toolbar-proofread';
 830+ image3.style.cursor = 'pointer';
 831+ image3.alt = '-';
 832+ image3.title = 'zoom out';
 833+ image3.src = wgScriptPath + '/extensions/ProofreadPage/Button_zoom_out.png';
 834+ image3.onclick = new Function( 'xx=0;yy=0;pr_zoom(-2);' );
 835+
 836+ var image4 = document.createElement( 'img' );
781837 image4.width = 23;
782838 image4.height = 22;
783839 image4.border = 0;
784 - image4.className = "mw-toolbar-proofread";
785 - image4.style.cursor = "pointer";
786 - image4.alt = "-";
787 - image4.title = "reset zoom";
788 - image4.src = wgScriptPath+"/extensions/ProofreadPage/Button_examine.png";
 840+ image4.className = 'mw-toolbar-proofread';
 841+ image4.style.cursor = 'pointer';
 842+ image4.alt = '-';
 843+ image4.title = 'reset zoom';
 844+ image4.src = wgScriptPath + '/extensions/ProofreadPage/Button_examine.png';
789845 image4.onclick = new Function("pr_zoom(0);");
790 -
791 - var image2 = document.createElement("img");
 846+
 847+ var image2 = document.createElement( 'img' );
792848 image2.width = 23;
793849 image2.height = 22;
794850 image2.border = 0;
795 - image2.className = "mw-toolbar-proofread";
796 - image2.style.cursor = "pointer";
797 - image2.alt = "+";
798 - image2.title = "zoom in";
799 - image2.src = wgScriptPath+"/extensions/ProofreadPage/Button_zoom_in.png";
800 - image2.onclick = new Function("xx=0;yy=0;pr_zoom(2);");
801 -
802 - var image1 = document.createElement("img");
 851+ image2.className = 'mw-toolbar-proofread';
 852+ image2.style.cursor = 'pointer';
 853+ image2.alt = '+';
 854+ image2.title = 'zoom in';
 855+ image2.src = wgScriptPath + '/extensions/ProofreadPage/Button_zoom_in.png';
 856+ image2.onclick = new Function( 'xx=0;yy=0;pr_zoom(2);' );
 857+
 858+ var image1 = document.createElement( 'img' );
803859 image1.width = 23;
804860 image1.height = 22;
805 - image1.className = "mw-toolbar-editbutton";
806 - image1.src = wgScriptPath+'/extensions/ProofreadPage/Button_multicol.png';
 861+ image1.className = 'mw-toolbar-editbutton';
 862+ image1.src = wgScriptPath + '/extensions/ProofreadPage/Button_multicol.png';
807863 image1.border = 0;
808 - image1.alt = " ";
809 - image1.title = "vertical/horizontal layout";
810 - image1.style.cursor = "pointer";
 864+ image1.alt = ' ';
 865+ image1.title = 'vertical/horizontal layout';
 866+ image1.style.cursor = 'pointer';
811867 image1.onclick = pr_toggle_layout;
812868
813 - pr_rect = document.createElement("div");
814 - pr_container_parent.appendChild(pr_rect);
 869+ pr_rect = document.createElement( 'div' );
 870+ pr_container_parent.appendChild( pr_rect );
815871
816 - if( (!toolbar) || (self.wgWikiEditorPreferences && self.wgWikiEditorPreferences["toolbar"] ) ) {
817 - toolbar = document.createElement("div");
818 - toolbar.style.cssText="position:absolute;";
819 - pr_container_parent.appendChild(toolbar);
 872+ if( ( !toolbar ) || ( self.wgWikiEditorPreferences && self.wgWikiEditorPreferences['toolbar'] ) ) {
 873+ toolbar = document.createElement( 'div' );
 874+ toolbar.style.cssText = 'position:absolute;';
 875+ pr_container_parent.appendChild( toolbar );
820876 }
821 - toolbar.appendChild(image);
822 - toolbar.appendChild(image3);
823 - toolbar.appendChild(image4);
824 - toolbar.appendChild(image2);
825 - toolbar.appendChild(image1);
 877+ toolbar.appendChild( image );
 878+ toolbar.appendChild( image3 );
 879+ toolbar.appendChild( image4 );
 880+ toolbar.appendChild( image2 );
 881+ toolbar.appendChild( image1 );
826882 }
827883 }
828884
829 -
830 -
831 -
832 -
833885 function pr_init() {
 886+ if( document.getElementById( 'pr_container' ) ) {
 887+ return;
 888+ }
834889
835 - if( document.getElementById("pr_container")) return;
 890+ if( document.URL.indexOf( 'action=protect' ) > 0 || document.URL.indexOf( 'action=unprotect' ) > 0 ) {
 891+ return;
 892+ }
 893+ if( document.URL.indexOf( 'action=delete' ) > 0 || document.URL.indexOf( 'action=undelete' ) > 0 ) {
 894+ return;
 895+ }
 896+ if( document.URL.indexOf( 'action=watch' ) > 0 || document.URL.indexOf( 'action=unwatch' ) > 0 ) {
 897+ return;
 898+ }
 899+ if( document.URL.indexOf( 'action=history' ) > 0 ) {
 900+ return;
 901+ }
836902
837 - if(document.URL.indexOf("action=protect") > 0 || document.URL.indexOf("action=unprotect") > 0) return;
838 - if(document.URL.indexOf("action=delete") > 0 || document.URL.indexOf("action=undelete") > 0) return;
839 - if(document.URL.indexOf("action=watch") > 0 || document.URL.indexOf("action=unwatch") > 0) return;
840 - if(document.URL.indexOf("action=history") > 0 ) return;
841 -
842 - /*check if external url is provided*/
 903+ /* check if external URL is provided */
843904 if( !self.proofreadPageThumbURL ) {
844 - var text = document.getElementById("wpTextbox1");
845 - if (text) {
 905+ var text = document.getElementById( 'wpTextbox1' );
 906+ if ( text ) {
846907 var proofreadPageIsEdit = true;
847908 re = /<span class="hiddenStructure" id="pageURL">\[http:\/\/(.*?)\]<\/span>/;
848 - m = re.exec(text.value);
849 - if( m ) {
850 - self.proofreadPageExternalURL = "http://"+m[1];
 909+ m = re.exec( text.value );
 910+ if( m ) {
 911+ self.proofreadPageExternalURL = 'http://' + m[1];
851912 }
852 - }
853 - else {
 913+ } else {
854914 var proofreadPageIsEdit = false;
855 - text = document.getElementById("bodyContent");
856 - try {
857 - var a = document.getElementById("pageURL");
 915+ text = document.getElementById( 'bodyContent' );
 916+ try {
 917+ var a = document.getElementById( 'pageURL' );
858918 var b = a.firstChild;
859 - self.proofreadPageExternalURL = b.getAttribute("href");
860 - } catch(err){};
 919+ self.proofreadPageExternalURL = b.getAttribute( 'href' );
 920+ } catch( err ) {
 921+ };
861922 }
862 - //set to dummy values, not used
 923+ // set to dummy values, not used
863924 self.proofreadPageWidth = 400;
864925 self.proofreadPageHeight = 400;
865926 }
866927
867 - if( !self.proofreadPageThumbURL ) return;
 928+ if( !self.proofreadPageThumbURL ) {
 929+ return;
 930+ }
868931
869932 if( self.proofreadpage_setup ) {
870 -
871933 proofreadpage_setup(
872934 proofreadPageWidth,
873 - proofreadPageHeight,
874 - proofreadPageIsEdit);
 935+ proofreadPageHeight,
 936+ proofreadPageIsEdit
 937+ );
 938+ } else {
 939+ pr_setup();
875940 }
876 - else pr_setup();
877941
878 - //add css classes to the container div
879 - var c = document.getElementById("pagequality");
880 - if(c) {
881 - c = c.nextSibling;
882 - if(c.className=="pagetext") {
883 - c.className += " "+self.proofreadPageCss;
 942+ // add CSS classes to the container div
 943+ var c = document.getElementById( 'pagequality' );
 944+ if( c ) {
 945+ c = c.nextSibling;
 946+ if( c.className == 'pagetext' ) {
 947+ c.className += ' ' + self.proofreadPageCss;
884948 }
885949 }
886950 }
887951
 952+addOnloadHook( pr_init );
 953+addOnloadHook( pr_init_tabs );
888954
 955+hookEvent( 'load', pr_initzoom );
889956
890 -addOnloadHook(pr_init);
891 -addOnloadHook(pr_init_tabs);
892 -
893 -
894 -hookEvent("load", pr_initzoom );
895 -
896 -
897 -/*Quality buttons*/
898 -
899 -function pr_add_quality(form,value){
900 -
 957+/* Quality buttons */
 958+function pr_add_quality( form, value ) {
901959 self.proofreadpage_quality = value;
902960 self.proofreadpage_username = proofreadPageUserName;
903 - var text="";
 961+ var text = '';
904962 switch( value ) {
905 - case 0: text = proofreadPageMessageQuality0; break;
906 - case 1: text = proofreadPageMessageQuality1; break;
907 - case 2: text = proofreadPageMessageQuality2; break;
908 - case 3: text = proofreadPageMessageQuality3; break;
909 - case 4: text = proofreadPageMessageQuality4; break;
 963+ case 0:
 964+ text = proofreadPageMessageQuality0;
 965+ break;
 966+ case 1:
 967+ text = proofreadPageMessageQuality1;
 968+ break;
 969+ case 2:
 970+ text = proofreadPageMessageQuality2;
 971+ break;
 972+ case 3:
 973+ text = proofreadPageMessageQuality3;
 974+ break;
 975+ case 4:
 976+ text = proofreadPageMessageQuality4;
 977+ break;
910978 }
911 - form.elements["wpSummary"].value="/* " + text + " */ ";
912 - form.elements["wpProofreader"].value=self.proofreadpage_username;
913 -
 979+ form.elements['wpSummary'].value = '/* ' + text + ' */ ';
 980+ form.elements['wpProofreader'].value = self.proofreadpage_username;
914981 }
915982
 983+function pr_add_quality_buttons() {
 984+ var ig = document.getElementById( 'wpWatchthis' );
 985+ if( !ig ) {
 986+ ig = document.getElementById( 'wpSummary' );
 987+ }
 988+ if( !ig ) {
 989+ return;
 990+ }
 991+ var f = document.createElement( 'span' );
 992+ ig.parentNode.insertBefore( f, ig.nextSibling.nextSibling.nextSibling );
916993
917 -function pr_add_quality_buttons(){
918 -
919 - var ig = document.getElementById("wpWatchthis");
920 - if( !ig ) ig = document.getElementById("wpSummary");
921 - if( !ig ) return;
922 - var f = document.createElement("span");
923 - ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling);
924 -
925994 if( !proofreadPageAddButtons ) {
926 - f.innerHTML =
927 - ' <input type="hidden" name="wpProofreader" value="' + self.proofreadpage_username + '">'
928 - +'<input type="hidden" name="quality" value=' + self.proofreadpage_quality + ' >';
 995+ f.innerHTML =
 996+ ' <input type="hidden" name="wpProofreader" value="' + self.proofreadpage_username + '">' +
 997+ '<input type="hidden" name="quality" value=' + self.proofreadpage_quality + ' >';
929998 return;
930999 }
9311000
932 - f.innerHTML =
933 -' <input type="hidden" name="wpProofreader" value="'+self.proofreadpage_username+'">'
 1001+ f.innerHTML =
 1002+' <input type="hidden" name="wpProofreader" value="' + self.proofreadpage_username + '">'
9341003 +'<span class="quality0"> <input type="radio" name="quality" value=0 onclick="pr_add_quality(this.form,0)" tabindex=4> </span>'
9351004 +'<span class="quality2"> <input type="radio" name="quality" value=2 onclick="pr_add_quality(this.form,2)" tabindex=4> </span>'
9361005 +'<span class="quality1"> <input type="radio" name="quality" value=1 onclick="pr_add_quality(this.form,1)" tabindex=4> </span>'
9371006 +'<span class="quality3"> <input type="radio" name="quality" value=3 onclick="pr_add_quality(this.form,3)" tabindex=4> </span>'
9381007 +'<span class="quality4"> <input type="radio" name="quality" value=4 onclick="pr_add_quality(this.form,4)" tabindex=4> </span>';
939 - f.innerHTML = f.innerHTML + '&nbsp;' + escapeQuotesHTML(proofreadPageMessageStatus);
 1008+ f.innerHTML = f.innerHTML + '&nbsp;' + escapeQuotesHTML( proofreadPageMessageStatus );
9401009
941 - if( ! ( ( self.proofreadpage_quality == 4 ) || ( ( self.proofreadpage_quality == 3 ) && ( self.proofreadpage_username != proofreadPageUserName ) ) ) ) {
 1010+ if( !( ( self.proofreadpage_quality == 4 ) || ( ( self.proofreadpage_quality == 3 ) && ( self.proofreadpage_username != proofreadPageUserName ) ) ) ) {
9421011 document.editform.quality[4].parentNode.style.cssText = 'display:none';
9431012 document.editform.quality[4].disabled = true;
9441013 }
9451014 switch( self.proofreadpage_quality ) {
946 - case 4: document.editform.quality[4].checked = true; break;
947 - case 3: document.editform.quality[3].checked = true; break;
948 - case 1: document.editform.quality[2].checked = true; break;
949 - case 2: document.editform.quality[1].checked = true; break;
950 - case 0: document.editform.quality[0].checked = true; break;
 1015+ case 4:
 1016+ document.editform.quality[4].checked = true;
 1017+ break;
 1018+ case 3:
 1019+ document.editform.quality[3].checked = true;
 1020+ break;
 1021+ case 1:
 1022+ document.editform.quality[2].checked = true;
 1023+ break;
 1024+ case 2:
 1025+ document.editform.quality[1].checked = true;
 1026+ break;
 1027+ case 0:
 1028+ document.editform.quality[0].checked = true;
 1029+ break;
9511030 }
9521031 }
9531032
954 -
955 -
956 -addOnloadHook(pr_add_quality_buttons);
 1033+addOnloadHook( pr_add_quality_buttons );
\ No newline at end of file
Index: trunk/extensions/ProofreadPage/proofread_article.js
@@ -1,21 +1,25 @@
22 // Author : ThomasV - License : GPL
33
4 -/* add backlink to index page*/
 4+/* add backlink to index page */
55 function pr_add_source() {
6 - var a = document.getElementById("ca-nstab-main");
7 - if(!a) return;
8 - var q = document.getElementById("pr_index")
 6+ var a = document.getElementById( 'ca-nstab-main' );
 7+ if( !a ) {
 8+ return;
 9+ }
 10+ var q = document.getElementById( 'pr_index' );
911 if( q ) {
10 - href = q.firstChild;
11 - if(!href) return;
12 - q.removeChild(href);
 12+ href = q.firstChild;
 13+ if( !href ) {
 14+ return;
 15+ }
 16+ q.removeChild( href );
1317 href.innerHTML = prp_source;
14 - href.setAttribute("title", prp_source_message);
15 - var new_li = document.createElement("li");
16 - new_li.appendChild(href);
17 - var new_span = document.createElement("span");
18 - new_span.appendChild(new_li);
19 - a.parentNode.insertBefore(new_span,a.nextSibling);
 18+ href.setAttribute( 'title', prp_source_message );
 19+ var new_li = document.createElement( 'li' );
 20+ new_li.appendChild( href );
 21+ var new_span = document.createElement( 'span' );
 22+ new_span.appendChild( new_li );
 23+ a.parentNode.insertBefore( new_span, a.nextSibling );
2024 }
2125 }
22 -addOnloadHook(pr_add_source);
 26+addOnloadHook( pr_add_source );
\ No newline at end of file

Status & tagging log