r50146 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50145‎ | r50146 | r50147 >
Date:22:09, 2 May 2009
Author:thomasv
Status:ok
Tags:
Comment:
minor fixes
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/proofread.js
@@ -50,16 +50,22 @@
5151
5252 if(self.proofreadPageExternalURL) {
5353 thumb_url = proofreadPageViewURL;
 54+ self.DisplayWidth = requested_width;
 55+ self.DisplayHeight = "";
5456 }
5557 else {
5658 //enforce quantization: width must be multiple of 100px
5759 var width = (100*requested_width)/100;
5860 //compare to the width of the image
5961 if(width < proofreadPageWidth) {
60 - thumb_url = proofreadPageThumbURL.replace('##WIDTH##',""+width);
 62+ thumb_url = proofreadPageThumbURL.replace('##WIDTH##',""+width);
 63+ self.DisplayWidth = requested_width;
 64+ self.DisplayHeight = requested_width*proofreadPageHeight/proofreadPageWidth;
6165 }
6266 else {
63 - thumb_url = proofreadPageViewURL;
 67+ thumb_url = proofreadPageViewURL;
 68+ self.DisplayWidth = proofreadPageWidth;
 69+ self.DisplayHeight = proofreadPageHeight;
6470 }
6571 }
6672 return thumb_url;
@@ -428,7 +434,7 @@
429435 if(!zp_img) return;
430436
431437 if (delta == 0) {
432 - zp_img.width = document.getElementById("ImageContainer").offsetWidth-20;
 438+ zp_img.width = document.getElementById("ImageContainer").offsetWidth; //-20;
433439 zp_img.style.margin = '0px 0px 0px 0px';
434440 prev_margin_x = margin_x = 0;
435441 prev_margin_y = margin_y = 0;
@@ -537,8 +543,9 @@
538544 desired_width = parseInt(window.innerWidth/2-70);
539545 }
540546 }
 547+ //this sets DisplayWidth and DisplayHeight
541548 var thumb_url = pr_image_url(desired_width);
542 -
 549+
543550 //self.DisplayHeight is known if the image is not external
544551 if(self.DisplayHeight)
545552 self.TextBoxHeight = self.DisplayHeight;
@@ -550,14 +557,14 @@
551558 var image = document.createElement("img");
552559 image.setAttribute("src", thumb_url);
553560 image.setAttribute("id", "ProofReadImage");
554 - image.setAttribute("width", desired_width);
 561+ image.setAttribute("width", self.DisplayWidth);
555562 image.style.cssText = "padding:0;margin:0;border:0;";
556563 image_container.appendChild(image);
557564 }
558565 else{
559 - var s = "<div id=\"pr_container\" style=\"background:#000000; overflow: auto; width: "+desired_width+"px;\">";
 566+ var s = "<div id=\"pr_container\" style=\"background:#000000; overflow: auto; width: "+self.DisplayWidth+"px; height:"+self.TextBoxHeight+"px;\">";
560567 s = s + "<img id=\"ProofReadImage\" src=\""+ proofreadPageViewURL +"\" alt=\""+ proofreadPageViewURL +"\"";
561 - s = s + " width=\"" + desired_width +"\"></div>";
 568+ s = s + " width=\"" + self.DisplayWidth +"\"></div>";
562569 image_container.innerHTML = s;
563570 document.getElementById("wpTextbox1").style.cssText = "height:"+(self.TextBoxHeight-7)+"px";
564571 pr_zoom(0);

Status & tagging log