Index: trunk/extensions/ProofreadPage/Button_examine.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/ProofreadPage/Button_examine.png |
___________________________________________________________________ |
Name: svn:mime-type |
1 | 1 | + image/png |
Index: trunk/extensions/ProofreadPage/ProofreadPage.php |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | |
42 | 42 | |
43 | 43 | # Bump the version number every time you change proofread.js |
44 | | -$wgProofreadPageVersion = 17; |
| 44 | +$wgProofreadPageVersion = 18; |
45 | 45 | |
46 | 46 | /** |
47 | 47 | * |
Index: trunk/extensions/ProofreadPage/Button_multicol.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/ProofreadPage/Button_multicol.png |
___________________________________________________________________ |
Name: svn:mime-type |
48 | 48 | + image/png |
Index: trunk/extensions/ProofreadPage/Button_zoom_in.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/ProofreadPage/Button_zoom_in.png |
___________________________________________________________________ |
Name: svn:mime-type |
49 | 49 | + image/png |
Index: trunk/extensions/ProofreadPage/Button_zoom_out.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/ProofreadPage/Button_zoom_out.png |
___________________________________________________________________ |
Name: svn:mime-type |
50 | 50 | + image/png |
Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -1,8 +1,12 @@ |
2 | 2 | // Author : ThomasV - License : GPL |
3 | 3 | |
| 4 | +//todo : |
| 5 | +//add a state for empty pages : detect if textbox is empty |
| 6 | +//use the API |
4 | 7 | |
5 | | -function proofreadpage_init_tabs(){ |
6 | 8 | |
| 9 | +function pr_init_tabs(){ |
| 10 | + |
7 | 11 | var a = document.getElementById("p-cactions"); |
8 | 12 | if (!a) return; |
9 | 13 | var b = a.getElementsByTagName("ul"); |
— | — | @@ -43,10 +47,10 @@ |
44 | 48 | |
45 | 49 | |
46 | 50 | |
47 | | -function proofreadpage_image_url(requested_width){ |
48 | | - var image_url; |
| 51 | +function pr_image_url(requested_width){ |
| 52 | + var image_url; |
49 | 53 | |
50 | | - if(self.proofreadPageExternalURL) { |
| 54 | + if(self.proofreadPageExternalURL) { |
51 | 55 | image_url = proofreadPageExternalURL; |
52 | 56 | } |
53 | 57 | else { |
— | — | @@ -71,7 +75,7 @@ |
72 | 76 | |
73 | 77 | |
74 | 78 | |
75 | | -function proofreadpage_make_edit_area(container,text){ |
| 79 | +function pr_make_edit_area(container,text){ |
76 | 80 | |
77 | 81 | re = /^<noinclude>([\s\S]*?)\n*<\/noinclude>([\s\S]*)<noinclude>([\s\S]*?)<\/noinclude>\n$/; |
78 | 82 | m = text.match(re); |
— | — | @@ -106,7 +110,7 @@ |
107 | 111 | } |
108 | 112 | } |
109 | 113 | |
110 | | - //escape & character |
| 114 | + //escape & character |
111 | 115 | pageBody = pageBody.split("&").join("&") |
112 | 116 | pageHeader = pageHeader.split("&").join("&") |
113 | 117 | pageFooter = pageFooter.split("&").join("&") |
— | — | @@ -124,18 +128,18 @@ |
125 | 129 | var previewButton = document.getElementById("wpPreview"); |
126 | 130 | var diffButton = document.getElementById("wpDiff") |
127 | 131 | if(saveButton){ |
128 | | - saveButton.onclick = proofreadPageFillForm; |
129 | | - previewButton.onclick = proofreadPageFillForm; |
130 | | - diffButton.onclick = proofreadPageFillForm; |
| 132 | + saveButton.onclick = pr_fill_form; |
| 133 | + previewButton.onclick = pr_fill_form; |
| 134 | + diffButton.onclick = pr_fill_form; |
131 | 135 | } |
132 | 136 | else { |
| 137 | + //make the text area readonly |
133 | 138 | container.firstChild.nextSibling.setAttribute("readonly","readonly"); |
134 | 139 | } |
135 | | - |
136 | 140 | } |
137 | 141 | |
138 | 142 | |
139 | | -function proofreadpage_toggle_visibility() { |
| 143 | +function pr_toggle_visibility() { |
140 | 144 | |
141 | 145 | var box = document.getElementById("wpTextbox1"); |
142 | 146 | var h = document.getElementById("prp_header"); |
— | — | @@ -151,70 +155,202 @@ |
152 | 156 | } |
153 | 157 | } |
154 | 158 | |
| 159 | +function pr_toggle_layout() { |
155 | 160 | |
| 161 | + if (!self.pr_horiz) |
| 162 | + pr_fill_table(true); |
| 163 | + else |
| 164 | + pr_fill_table(false); |
| 165 | + |
| 166 | +} |
156 | 167 | |
157 | 168 | |
158 | | -function proofreadpage_default_setup() { |
159 | 169 | |
160 | | - self.displayWidth = 400; //default value |
| 170 | +//vertical mode |
| 171 | +self.vertHeight = 0; |
| 172 | +var ImgWidth = 0; |
161 | 173 | |
162 | | - if (parseInt(navigator.appVersion)>3) { |
163 | | - if (navigator.appName.indexOf("Microsoft")!=-1) { |
164 | | - displayWidth = parseInt(document.body.offsetWidth/2-70); |
165 | | - } else { |
166 | | - displayWidth = parseInt(window.innerWidth/2-70); |
167 | | - } |
| 174 | +function pr_content(image_url){ |
| 175 | + |
| 176 | + if (self.vertHeight == 0) { |
| 177 | + if(document.selection && !is_gecko) |
| 178 | + self.vertHeight=Math.ceil(document.body.clientHeight*0.4); |
| 179 | + else |
| 180 | + self.vertHeight=Math.ceil(window.innerHeight*0.4); |
168 | 181 | } |
| 182 | + var s = "<div style=\"overflow: auto; height: " + self.vertHeight + "px; width: 100%;\">"; |
| 183 | + s = s + "<img id=\"ProofReadImage\" src=\""+ image_url +"\" alt=\""+ image_url +"\""; |
| 184 | + s = s + " width=\"" + ImgWidth +"\"></div>"; |
| 185 | + return s; |
| 186 | +} |
169 | 187 | |
170 | | - var image_url = proofreadpage_image_url(displayWidth); |
171 | 188 | |
172 | | - if(self.DisplayHeight) self.TextBoxHeight = DisplayHeight; |
173 | | - else self.TextBoxHeight = 700; |
| 189 | +function pr_zoom(value) { |
174 | 190 | |
175 | | - if(proofreadPageIsEdit) { |
176 | | - var text = document.getElementById("wpTextbox1"); |
177 | | - if (!text) return; |
| 191 | + if(!document.getElementById("ImageContainer")) return; |
| 192 | + |
| 193 | + var PrImage = document.getElementById("ProofReadImage"); |
| 194 | + |
| 195 | + if (value == 0) |
| 196 | + PrImage.width = document.getElementById("ImageContainer").offsetWidth-20; |
| 197 | + else |
| 198 | + PrImage.width = PrImage.width + value; |
| 199 | + |
| 200 | + ImgWidth = PrImage.width; |
| 201 | + |
| 202 | + if(document.selection && !is_gecko) { |
| 203 | + //IE: |
| 204 | + document.getElementById("ImageContainer").innerHTML = pr_content(PrImage.src); |
178 | 205 | } |
179 | | - else { |
180 | | - var text = document.getElementById("bodyContent"); |
181 | | - if(!text) return; |
| 206 | +} |
| 207 | + |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | + |
| 212 | +function pr_fill_table(horizontal_layout){ |
| 213 | + |
| 214 | + //remove existing body |
| 215 | + if(self.table.firstChild){ |
| 216 | + self.table.removeChild(self.table.firstChild); |
182 | 217 | } |
183 | 218 | |
| 219 | + //create table body |
| 220 | + var t_body = document.createElement("tbody"); |
| 221 | + self.table.appendChild(t_body); |
| 222 | + var cell_left = document.createElement("td"); |
| 223 | + var cell_right = document.createElement("td"); |
| 224 | + |
| 225 | + if(!proofreadPageIsEdit) horizontal_layout=false; |
184 | 226 | |
185 | | - //image |
186 | | - var image = document.createElement("img"); |
187 | | - image.setAttribute("src", image_url); |
188 | | - image.style.cssText = "padding:0;margin:0;border:0;"; |
| 227 | + //first setup the layout |
| 228 | + if(!horizontal_layout) { |
| 229 | + var t_row = document.createElement("tr"); |
| 230 | + t_row.setAttribute("valign","top"); |
| 231 | + cell_left.style.cssText = "width:50%; padding-right:0.5em;"; |
| 232 | + cell_right.setAttribute("rowspan","3"); |
| 233 | + t_row.appendChild(cell_left); |
| 234 | + t_row.appendChild(cell_right); |
| 235 | + t_body.appendChild(t_row); |
| 236 | + } |
| 237 | + else { |
| 238 | + var t_row1 = document.createElement("tr"); |
| 239 | + var t_row2 = document.createElement("tr"); |
| 240 | + t_body.appendChild(t_row2); |
| 241 | + t_body.appendChild(t_row1); |
| 242 | + t_row1.appendChild(cell_left); |
| 243 | + t_row2.appendChild(cell_right); |
| 244 | + } |
| 245 | + |
189 | 246 | |
190 | | - //container |
191 | | - //useful for hooking elements to the image, eg href or zoom. |
192 | | - var container = document.createElement("div"); |
193 | | - container.setAttribute("id", "proofreadImage"); |
194 | | - container.appendChild(image); |
| 247 | + //create image and text containers |
| 248 | + var image_container = document.createElement("div"); |
| 249 | + image_container.setAttribute("id", "ImageContainer"); |
| 250 | + cell_right.appendChild(image_container); |
| 251 | + cell_left.appendChild(self.text_container); |
195 | 252 | |
196 | | - var table = document.createElement("table"); |
| 253 | + |
| 254 | + //fill the image container |
| 255 | + if(!horizontal_layout){ |
| 256 | + |
| 257 | + self.pr_horiz = false; |
| 258 | + var displayWidth = 400; |
| 259 | + if (parseInt(navigator.appVersion)>3) { |
| 260 | + if (navigator.appName.indexOf("Microsoft")!=-1) { |
| 261 | + displayWidth = parseInt(document.body.offsetWidth/2-70); |
| 262 | + } |
| 263 | + else { |
| 264 | + displayWidth = parseInt(window.innerWidth/2-70); |
| 265 | + } |
| 266 | + } |
| 267 | + //this function sets self.DisplayHeight |
| 268 | + var image_url = pr_image_url(displayWidth); |
| 269 | + |
| 270 | + if(self.DisplayHeight) |
| 271 | + self.TextBoxHeight = DisplayHeight; |
| 272 | + else |
| 273 | + self.TextBoxHeight = 700; |
| 274 | + |
| 275 | + //fill image container |
| 276 | + if(!proofreadPageIsEdit) { |
| 277 | + var image = document.createElement("img"); |
| 278 | + image.setAttribute("src", image_url); |
| 279 | + image.style.cssText = "padding:0;margin:0;border:0;"; |
| 280 | + image_container.appendChild(image); |
| 281 | + } |
| 282 | + else{ |
| 283 | + var image_url = proofreadPageViewURL; |
| 284 | + var s = "<div style=\"overflow: auto; width: 100%; height:"+self.DisplayHeight+"px;\">"; |
| 285 | + s = s + "<img id=\"ProofReadImage\" src=\""+ image_url +"\" alt=\""+ image_url +"\""; |
| 286 | + s = s + " width=\"" + displayWidth +"\"></div>"; |
| 287 | + image_container.innerHTML = s; |
| 288 | + document.getElementById("wpTextbox1").style.cssText = "height:"+(self.TextBoxHeight-7)+"px"; |
| 289 | + pr_zoom(0); |
| 290 | + } |
| 291 | + //document.getElementById("contentSub").appendChild(ImageContainer); |
| 292 | + |
| 293 | + } |
| 294 | + else{ |
| 295 | + self.pr_horiz = true; |
| 296 | + image_container.innerHTML = pr_content(proofreadPageViewURL); |
| 297 | + |
| 298 | + if(proofreadPageIsEdit){ |
| 299 | + document.getElementById("wpTextbox1").style.cssText = "height:"+self.vertHeight+"px"; |
| 300 | + pr_zoom(0); |
| 301 | + } |
| 302 | + } |
| 303 | +} |
| 304 | + |
| 305 | + |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | +function pr_setup() { |
| 312 | + |
| 313 | + self.table = document.createElement("table"); |
| 314 | + self.text_container = document.createElement("div"); |
| 315 | + self.image_container = document.createElement("div"); |
197 | 316 | table.setAttribute("id", "textBoxTable"); |
198 | 317 | table.style.cssText = "width:100%;"; |
199 | | - var t_body = document.createElement("tbody"); |
200 | | - var t_row = document.createElement("tr"); |
201 | | - t_row.setAttribute("valign","top"); |
202 | | - var cell_left = document.createElement("td"); |
203 | | - cell_left.style.cssText = "width:50%; padding-right:0.5em;"; |
204 | | - var cell_right = document.createElement("td"); |
205 | | - cell_right.appendChild(container); |
206 | | - cell_right.setAttribute("rowspan","3"); |
207 | | - t_row.appendChild(cell_left); |
208 | | - t_row.appendChild(cell_right); |
209 | | - t_body.appendChild(t_row); |
210 | | - table.appendChild(t_body); |
211 | 318 | |
212 | | - |
| 319 | + //fill table |
| 320 | + if(self.proofreadpage_default_layout=='horizontal') |
| 321 | + pr_fill_table(true); |
| 322 | + else |
| 323 | + pr_fill_table(false); |
| 324 | + |
| 325 | + //insert the image |
| 326 | + if(proofreadPageIsEdit) { |
| 327 | + var text = document.getElementById("wpTextbox1"); |
| 328 | + } |
| 329 | + else { |
| 330 | + var text = document.getElementById("bodyContent"); |
| 331 | + } |
| 332 | + if(!text) return; |
213 | 333 | var f = text.parentNode; |
214 | 334 | var new_text = f.removeChild(text); |
215 | 335 | |
216 | 336 | if(proofreadPageIsEdit) { |
217 | | - proofreadpage_make_edit_area(cell_left,new_text.value); |
| 337 | + pr_make_edit_area(self.text_container,new_text.value); |
| 338 | + var copywarn = document.getElementById("editpage-copywarn"); |
| 339 | + f.insertBefore(table,copywarn); |
| 340 | + |
| 341 | + } |
| 342 | + else { |
| 343 | + self.text_container.appendChild(new_text); |
| 344 | + f.appendChild(self.table); |
| 345 | + } |
| 346 | + |
| 347 | + //add buttons |
| 348 | + if(proofreadPageIsEdit) { |
| 349 | + |
218 | 350 | var toolbar = document.getElementById("toolbar"); |
| 351 | + /*var f = tb.parentNode; |
| 352 | + var toolbar = f.removeChild(tb); |
| 353 | + self.text_container.insertBefore(toolbar,self.text_container.firstChild);*/ |
| 354 | + |
219 | 355 | if(toolbar){ |
220 | 356 | var image = document.createElement("img"); |
221 | 357 | image.width = 23; |
— | — | @@ -225,24 +361,65 @@ |
226 | 362 | image.alt = proofreadPageMessageToggleHeaders; |
227 | 363 | image.title = proofreadPageMessageToggleHeaders; |
228 | 364 | image.style.cursor = "pointer"; |
229 | | - image.onclick = proofreadpage_toggle_visibility; |
| 365 | + image.onclick = pr_toggle_visibility; |
230 | 366 | toolbar.appendChild(image); |
| 367 | + |
| 368 | + var image3 = document.createElement("img"); |
| 369 | + image3.width = 23; |
| 370 | + image3.height = 22; |
| 371 | + image3.border = 0; |
| 372 | + image3.className = "mw-toolbar-proofread"; |
| 373 | + image3.style.cursor = "pointer"; |
| 374 | + image3.alt = "-"; |
| 375 | + image3.title = "zoom out"; |
| 376 | + image3.src = wgScriptPath+"/extensions/ProofreadPage/Button_zoom_out.png"; |
| 377 | + image3.onclick = new Function("pr_zoom(-50);"); |
| 378 | + toolbar.appendChild(image3); |
| 379 | + |
| 380 | + var image4 = document.createElement("img"); |
| 381 | + image4.width = 23; |
| 382 | + image4.height = 22; |
| 383 | + image4.border = 0; |
| 384 | + image4.className = "mw-toolbar-proofread"; |
| 385 | + image4.style.cursor = "pointer"; |
| 386 | + image4.alt = "-"; |
| 387 | + image4.title = "reset zoom"; |
| 388 | + image4.src = wgScriptPath+"/extensions/ProofreadPage/Button_examine.png"; |
| 389 | + image4.onclick = new Function("pr_zoom(0);"); |
| 390 | + toolbar.appendChild(image4); |
| 391 | + |
| 392 | + var image2 = document.createElement("img"); |
| 393 | + image2.width = 23; |
| 394 | + image2.height = 22; |
| 395 | + image2.border = 0; |
| 396 | + image2.className = "mw-toolbar-proofread"; |
| 397 | + image2.style.cursor = "pointer"; |
| 398 | + image2.alt = "+"; |
| 399 | + image2.title = "zoom in"; |
| 400 | + image2.src = wgScriptPath+"/extensions/ProofreadPage/Button_zoom_in.png"; |
| 401 | + image2.onclick = new Function("pr_zoom(50);"); |
| 402 | + toolbar.appendChild(image2); |
| 403 | + |
| 404 | + var image1 = document.createElement("img"); |
| 405 | + image1.width = 23; |
| 406 | + image1.height = 22; |
| 407 | + image1.className = "mw-toolbar-editbutton"; |
| 408 | + image1.src = wgScriptPath+'/extensions/ProofreadPage/Button_multicol.png'; |
| 409 | + image1.border = 0; |
| 410 | + image1.alt = " "; |
| 411 | + image1.title = "vertical/horizontal layout"; |
| 412 | + image1.style.cursor = "pointer"; |
| 413 | + image1.onclick = pr_toggle_layout; |
| 414 | + toolbar.appendChild(image1); |
| 415 | + |
231 | 416 | } |
232 | | - copywarn = document.getElementById("editpage-copywarn"); |
233 | | - f.insertBefore(table,copywarn); |
234 | | - document.getElementById("wpTextbox1").style.cssText = "height:"+(TextBoxHeight-7)+"px"; |
235 | | - |
236 | | - } else { |
237 | | - cell_left.appendChild(new_text); |
238 | | - f.appendChild(table); |
239 | 417 | } |
240 | | - |
241 | 418 | } |
242 | 419 | |
243 | 420 | |
244 | 421 | |
245 | 422 | |
246 | | -function proofreadPageFillForm() { |
| 423 | +function pr_fill_form() { |
247 | 424 | var form = document.getElementById("editform"); |
248 | 425 | var header = form.elements["headerTextbox"]; |
249 | 426 | var footer = form.elements["footerTextbox"]; |
— | — | @@ -258,187 +435,13 @@ |
259 | 436 | form.elements["wpTextbox1"].value = h+form.elements["wpTextbox1"].value+f; |
260 | 437 | form.elements["wpTextbox1"].setAttribute('readonly',"readonly"); |
261 | 438 | } |
262 | | - |
263 | 439 | } |
264 | 440 | |
265 | 441 | |
266 | 442 | |
267 | 443 | |
| 444 | +function pr_init() { |
268 | 445 | |
269 | | - |
270 | | -/* |
271 | | - * Mouse Zoom. Credits: http://valid.tjp.hu/zoom/ |
272 | | - */ |
273 | | - |
274 | | -// global vars |
275 | | -var lastxx, lastyy, xx, yy; |
276 | | - |
277 | | -var zp_clip; //zp_clip is the large image |
278 | | -var zp_container; |
279 | | - |
280 | | -var zoomamount_h=2; |
281 | | -var zoomamount_w=2; |
282 | | -var zoom_status=''; |
283 | | - |
284 | | -var ieox=0; var ieoy=0; |
285 | | -var ffox=0; var ffoy=0; |
286 | | - |
287 | | - |
288 | | -//mouse move |
289 | | -function zoom_move(evt) { |
290 | | - |
291 | | - if(zoom_status != 1) { return false;} |
292 | | - |
293 | | - if(typeof(evt) == 'object') { |
294 | | - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;} |
295 | | - if(evt.pageX) { |
296 | | - xx=evt.pageX - ffox; |
297 | | - yy=evt.pageY - ffoy; |
298 | | - } |
299 | | - else { |
300 | | - if(typeof(document.getElementById("proofreadImage")+1) == 'number') {return true;} |
301 | | - xx=evt.clientX - ieox; |
302 | | - yy=evt.clientY - ieoy; |
303 | | - } |
304 | | - } |
305 | | - else { |
306 | | - xx = lastxx; |
307 | | - yy = lastyy; |
308 | | - } |
309 | | - lastxx = xx; |
310 | | - lastyy = yy; |
311 | | - |
312 | | - //new |
313 | | - zp_clip.style.margin = |
314 | | - ((yy > objh )?(objh*(1-zoomamount_h)):(yy*(1-zoomamount_h))) + 'px 0px 0px ' |
315 | | - + ((xx > objw )?(objw*(1-zoomamount_w)):(xx*(1-zoomamount_w))) |
316 | | - + 'px'; |
317 | | - |
318 | | - return false; |
319 | | -} |
320 | | - |
321 | | - |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | | -function zoom_off() { |
327 | | - zp_container.style.width='0px'; |
328 | | - zp_container.style.height='0px'; |
329 | | - zoom_status = 0; |
330 | | -} |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | -function countoffset() { |
336 | | - zme=document.getElementById("proofreadImage"); |
337 | | - ieox=0; ieoy=0; |
338 | | - for(zmi=0;zmi<50;zmi++) { |
339 | | - if(zme+1 == 1) { |
340 | | - break; |
341 | | - } |
342 | | - else { |
343 | | - ieox+=zme.offsetLeft; |
344 | | - ieoy+=zme.offsetTop; |
345 | | - } |
346 | | - zme=zme.offsetParent; |
347 | | - } |
348 | | - ffox=ieox; |
349 | | - ffoy=ieoy; |
350 | | - ieox-=document.body.scrollLeft; |
351 | | - ieoy-=document.body.scrollTop; |
352 | | -} |
353 | | - |
354 | | - |
355 | | - |
356 | | - |
357 | | -function zoom_mouseup(evt) { |
358 | | - |
359 | | - evt = evt?evt:window.event?window.event:null; |
360 | | - if(!evt) return false; |
361 | | - |
362 | | - //only left button; see http://unixpapa.com/js/mouse.html for why it is this complicated |
363 | | - if(evt.which == null) { |
364 | | - if(evt.button != 1) return false; |
365 | | - } else { |
366 | | - if(evt.which > 1) return false; |
367 | | - } |
368 | | - |
369 | | - if(zoom_status == 0) { |
370 | | - zoom_on(evt); |
371 | | - return false; |
372 | | - } |
373 | | - else if(zoom_status == 1) { |
374 | | - zoom_status = 2; |
375 | | - return false; |
376 | | - } |
377 | | - else if(zoom_status == 2) { |
378 | | - zoom_off(); |
379 | | - return false; |
380 | | - } |
381 | | - return false; |
382 | | -} |
383 | | - |
384 | | - |
385 | | -function zoom_on(evt) { |
386 | | - evt = evt?evt:window.event?window.event:null; if(!evt){ return false;} |
387 | | - zoom_status=1; |
388 | | - |
389 | | - if(evt.pageX) { |
390 | | - countoffset(); |
391 | | - lastxx=evt.pageX - ffox; |
392 | | - lastyy=evt.pageY - ffoy; |
393 | | - } |
394 | | - else { |
395 | | - countoffset(); |
396 | | - lastxx=evt.clientX - ieox; |
397 | | - lastyy=evt.clientY - ieoy; |
398 | | - } |
399 | | - |
400 | | - zoomamount_h = zp_clip.height/objh; |
401 | | - zoomamount_w = zp_clip.width/objw; |
402 | | - |
403 | | - zp_container.style.margin = '0px 0px 0px 0px'; |
404 | | - zp_container.style.width = objw+'px'; |
405 | | - zp_container.style.height = objh+'px'; |
406 | | - |
407 | | - zoom_move(''); |
408 | | - return false; |
409 | | -} |
410 | | - |
411 | | - |
412 | | -function proofreadPageZoom(){ |
413 | | - |
414 | | - if(navigator.appName == "Microsoft Internet Explorer") return; |
415 | | - if(!self.proofreadPageViewURL) return; |
416 | | - if(self.DisplayWidth>800) return; |
417 | | - |
418 | | - zp = document.getElementById("proofreadImage"); |
419 | | - if(zp){ |
420 | | - var hires_url = proofreadpage_image_url(800); |
421 | | - self.objw = zp.firstChild.width; |
422 | | - self.objh = zp.firstChild.height; |
423 | | - |
424 | | - zp.setAttribute("onmouseup","zoom_mouseup(event);" ); |
425 | | - zp.setAttribute("onmousemove","zoom_move(event);" ); |
426 | | - |
427 | | - zp_container = document.createElement("div"); |
428 | | - zp_container.style.cssText ="position:absolute; width:0; height:0; overflow:hidden;"; |
429 | | - zp_clip = document.createElement("img"); |
430 | | - zp_clip.setAttribute("src", hires_url); |
431 | | - zp_clip.style.cssText = "padding:0;margin:0;border:0;"; |
432 | | - zp_container.appendChild(zp_clip); |
433 | | - zp.insertBefore(zp_container,zp.firstChild); |
434 | | - |
435 | | - } |
436 | | -} |
437 | | - |
438 | | - |
439 | | - |
440 | | - |
441 | | -function proofreadpage_init() { |
442 | | - |
443 | 446 | if( document.getElementById("proofreadImage")) return; |
444 | 447 | |
445 | 448 | if(document.URL.indexOf("action=protect") > 0 || document.URL.indexOf("action=unprotect") > 0) return; |
— | — | @@ -450,7 +453,7 @@ |
451 | 454 | if(!self.proofreadPageViewURL) { |
452 | 455 | var text = document.getElementById("wpTextbox1"); |
453 | 456 | if (text) { |
454 | | - proofreadPageIsEdit = true; |
| 457 | + var proofreadPageIsEdit = true; |
455 | 458 | re = /<span class="hiddenStructure" id="pageURL">\[http:\/\/(.*?)\]<\/span>/; |
456 | 459 | m = re.exec(text.value); |
457 | 460 | if( m ) { |
— | — | @@ -458,7 +461,7 @@ |
459 | 462 | } |
460 | 463 | } |
461 | 464 | else { |
462 | | - proofreadPageIsEdit = false; |
| 465 | + var proofreadPageIsEdit = false; |
463 | 466 | text = document.getElementById("bodyContent"); |
464 | 467 | try { |
465 | 468 | var a = document.getElementById("pageURL"); |
— | — | @@ -473,28 +476,38 @@ |
474 | 477 | |
475 | 478 | if(!self.proofreadPageViewURL && !self.proofreadPageExternalURL) return; |
476 | 479 | |
477 | | - if( self.proofreadpage_setup ) |
478 | | - |
479 | | - proofreadpage_setup( |
| 480 | + if( self.proofreadpage_setup ) { |
| 481 | + |
| 482 | + proofreadpage_setup( |
480 | 483 | proofreadPageWidth, |
481 | 484 | proofreadPageHeight, |
482 | 485 | proofreadPageIsEdit); |
483 | 486 | |
484 | | - else proofreadpage_default_setup(); |
| 487 | + } |
| 488 | + else pr_setup(); |
485 | 489 | } |
486 | 490 | |
487 | 491 | |
488 | 492 | |
489 | | -addOnloadHook(proofreadpage_init); |
490 | | -addOnloadHook(proofreadpage_init_tabs); |
491 | | -hookEvent("load", proofreadPageZoom); |
| 493 | +addOnloadHook(pr_init); |
| 494 | +addOnloadHook(pr_init_tabs); |
492 | 495 | |
493 | 496 | |
| 497 | +function pr_initzoom(){ |
| 498 | + if(self.pr_horiz){ |
| 499 | + document.getElementById("wpTextbox1").style.cssText = "height:"+self.vertHeight+"px"; |
| 500 | + } |
| 501 | + else{ |
| 502 | + document.getElementById("wpTextbox1").style.cssText = "height:"+(self.TextBoxHeight-7)+"px"; |
| 503 | + } |
| 504 | + pr_zoom(0); |
| 505 | +} |
| 506 | +hookEvent("load", pr_initzoom ); |
494 | 507 | |
495 | 508 | |
496 | 509 | /*Quality buttons*/ |
497 | 510 | |
498 | | -function proofreadpage_add_quality(form,value){ |
| 511 | +function pr_add_quality(form,value){ |
499 | 512 | |
500 | 513 | var text=""; |
501 | 514 | switch(value){ |
— | — | @@ -515,9 +528,9 @@ |
516 | 529 | } |
517 | 530 | |
518 | 531 | |
519 | | -function proofreadpage_add_quality_buttons(){ |
| 532 | +function pr_add_quality_buttons(){ |
520 | 533 | |
521 | | - if(self.proofreadpage_no_quality_buttons) return; |
| 534 | + if(self.proofreadpage_no_quality_buttons) return; |
522 | 535 | |
523 | 536 | var ig = document.getElementById("wpWatchthis"); |
524 | 537 | if(!ig) return; |
— | — | @@ -538,11 +551,11 @@ |
539 | 552 | } |
540 | 553 | var f = document.createElement("span"); |
541 | 554 | f.innerHTML = |
542 | | -' <span class="quality2"> <input type="radio" name="quality" onclick="proofreadpage_add_quality(this.form,2)"> </span>' |
543 | | -+'<span class="quality1"> <input type="radio" name="quality" onclick="proofreadpage_add_quality(this.form,1)"> </span>' |
544 | | -+'<span class="quality3"> <input type="radio" name="quality" onclick="proofreadpage_add_quality(this.form,3)"> </span>'; |
| 555 | +' <span class="quality2"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,2)"> </span>' |
| 556 | ++'<span class="quality1"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,1)"> </span>' |
| 557 | ++'<span class="quality3"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,3)"> </span>'; |
545 | 558 | if(show4) f.innerHTML = f.innerHTML |
546 | | -+ '<span class="quality4"> <input type="radio" name="quality" onclick="proofreadpage_add_quality(this.form,4)"> </span>'; |
| 559 | ++ '<span class="quality4"> <input type="radio" name="quality" onclick="pr_add_quality(this.form,4)"> </span>'; |
547 | 560 | f.innerHTML = f.innerHTML + ' '+proofreadPageMessageStatus; |
548 | 561 | ig.parentNode.insertBefore(f,ig.nextSibling.nextSibling.nextSibling); |
549 | 562 | if(m) { |
— | — | @@ -557,4 +570,4 @@ |
558 | 571 | |
559 | 572 | |
560 | 573 | |
561 | | -addOnloadHook(proofreadpage_add_quality_buttons); |
| 574 | +addOnloadHook(pr_add_quality_buttons); |