Index: trunk/extensions/ProofreadPage/proofread.js |
— | — | @@ -173,11 +173,11 @@ |
174 | 174 | if( h.style.cssText == ''){ |
175 | 175 | h.style.cssText = 'display:none'; |
176 | 176 | f.style.cssText = 'display:none'; |
177 | | - if(self.vertHeight) box.style.cssText = "height:"+(vertHeight-7)+"px"; |
| 177 | + if(self.DisplayHeight) box.style.cssText = "height:"+(self.DisplayHeight-7)+"px"; |
178 | 178 | } else { |
179 | 179 | h.style.cssText = ''; |
180 | 180 | f.style.cssText = ''; |
181 | | - if(self.vertHeight) box.style.cssText = "height:"+(vertHeight-190)+"px"; |
| 181 | + if(self.DisplayHeight) box.style.cssText = "height:"+(self.DisplayHeight-190)+"px"; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
— | — | @@ -448,7 +448,7 @@ |
449 | 449 | |
450 | 450 | function pr_zoom(delta){ |
451 | 451 | |
452 | | - image_container = document.getElementById("pr_container"); |
| 452 | + var image_container = document.getElementById("pr_container"); |
453 | 453 | zp_img = document.getElementById("ProofReadImage"); |
454 | 454 | if(!zp_img) return; |
455 | 455 | |
— | — | @@ -529,7 +529,6 @@ |
530 | 530 | //create image container |
531 | 531 | var image_container = document.createElement("div"); |
532 | 532 | image_container.setAttribute("id", "pr_container"); |
533 | | - image_container.style.cssText = "background:#0000ff; overflow:hidden;"; |
534 | 533 | |
535 | 534 | //setup the layout |
536 | 535 | if(!horizontal_layout) { |
— | — | @@ -560,54 +559,49 @@ |
561 | 560 | |
562 | 561 | self.pr_horiz = horizontal_layout; |
563 | 562 | |
564 | | - //compute the dimensions of the image container |
565 | | - if(!horizontal_layout){ |
566 | | - |
567 | | - var desired_width = 400; |
568 | | - if (parseInt(navigator.appVersion)>3) { |
569 | | - if (navigator.appName.indexOf("Microsoft")!=-1) |
570 | | - desired_width = parseInt(document.body.offsetWidth/2-70); |
571 | | - else |
572 | | - desired_width = parseInt(window.innerWidth/2-70); |
| 563 | + //get the size of the window |
| 564 | + var width, height; |
| 565 | + if (parseInt(navigator.appVersion)>3) { |
| 566 | + if (navigator.appName.indexOf("Microsoft")!=-1) { |
| 567 | + height = document.body.clientHeight; |
| 568 | + width = document.body.offsetWidth; |
573 | 569 | } |
574 | | - //this sets DisplayWidth and DisplayHeight |
575 | | - var thumb_url = pr_image_url(desired_width); |
576 | | - |
577 | | - //self.DisplayHeight is known if the image is not external |
578 | | - if(self.DisplayHeight) |
579 | | - self.vertHeight = self.DisplayHeight; |
580 | | - else |
581 | | - self.vertHeight = 700; |
| 570 | + else{ |
| 571 | + height = window.innerHeight; |
| 572 | + width = window.innerWidth; |
| 573 | + } |
582 | 574 | } |
583 | | - else{ |
584 | | - if (navigator.appName.indexOf("Microsoft")!=-1) |
585 | | - self.vertHeight = Math.ceil(document.body.clientHeight*0.4); |
586 | | - else |
587 | | - self.vertHeight = Math.ceil(window.innerHeight*0.4); |
| 575 | + else { |
| 576 | + width = 800; height = 600; |
588 | 577 | } |
589 | 578 | |
590 | | - |
591 | 579 | //fill the image container |
592 | 580 | if(!proofreadPageIsEdit) { |
| 581 | + //this sets DisplayWidth and DisplayHeight |
| 582 | + var thumb_url = pr_image_url(parseInt(width/2-70)); |
593 | 583 | var image = document.createElement("img"); |
594 | 584 | image_container.appendChild(image); |
595 | 585 | image.setAttribute("id", "ProofReadImage"); |
596 | 586 | image.setAttribute("src", thumb_url); |
597 | 587 | image.setAttribute("width", self.DisplayWidth); |
598 | 588 | image.style.cssText = "padding:0;margin:0;border:0;"; |
| 589 | + image_container.style.cssText = "background:#0000ff; overflow:hidden;width:"+self.DisplayWidth+"px;"; |
599 | 590 | } |
600 | 591 | else{ |
601 | 592 | if(!horizontal_layout){ |
| 593 | + self.DisplayHeight = Math.ceil(height*0.9); |
| 594 | + self.DisplayWidth = parseInt(width/2-70); |
602 | 595 | img_w = self.DisplayWidth; |
603 | | - self.container_css = "background:#000000; overflow:hidden; width:"+self.DisplayWidth+"px; height:"+self.vertHeight+"px;"; |
| 596 | + self.container_css = "background:#000000; overflow:hidden; width:"+self.DisplayWidth+"px; height:"+self.DisplayHeight+"px;"; |
604 | 597 | } |
605 | 598 | else{ |
| 599 | + self.DisplayHeight = Math.ceil(height*0.4); |
606 | 600 | img_w = 0; //prevent the container from being resized when the image is downloaded. |
607 | | - self.container_css = "background:#000000; overflow:auto; width:100%; height:"+self.vertHeight+"px;"; |
| 601 | + self.container_css = "background:#000000; overflow:auto; width:100%; height:"+self.DisplayHeight+"px;"; |
608 | 602 | } |
609 | 603 | image_container.innerHTML = "<img id=\"ProofReadImage\" src=\""+proofreadPageViewURL+"\" width=\""+img_w+"\" />"; |
610 | 604 | image_container.style.cssText = self.container_css; |
611 | | - document.getElementById("wpTextbox1").style.cssText = "height:"+self.vertHeight+"px"; |
| 605 | + document.getElementById("wpTextbox1").style.cssText = "height:"+self.DisplayHeight+"px"; |
612 | 606 | pr_zoom(0); |
613 | 607 | } |
614 | 608 | |
— | — | @@ -818,9 +812,9 @@ |
819 | 813 | function pr_initzoom(){ |
820 | 814 | if(document.getElementById("wpTextbox1")){ |
821 | 815 | if(self.pr_horiz) |
822 | | - document.getElementById("wpTextbox1").style.cssText = "height:"+self.vertHeight+"px"; |
| 816 | + document.getElementById("wpTextbox1").style.cssText = "height:"+self.DisplayHeight+"px"; |
823 | 817 | else |
824 | | - document.getElementById("wpTextbox1").style.cssText = "height:"+self.vertHeight+"px"; |
| 818 | + document.getElementById("wpTextbox1").style.cssText = "height:"+self.DisplayHeight+"px"; |
825 | 819 | pr_zoom(0); |
826 | 820 | } |
827 | 821 | else proofreadPageZoom(); |