r52512 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52511‎ | r52512 | r52513 >
Date:15:20, 28 June 2009
Author:thomasv
Status:deferred
Tags:
Comment:
improved window size detection
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/proofread.js
@@ -580,20 +580,20 @@
581581 self.pr_horiz = horizontal_layout;
582582
583583 //get the size of the window
584 - var width, height;
585 - if (parseInt(navigator.appVersion)>3) {
586 - if (navigator.appName.indexOf("Microsoft")!=-1) {
587 - height = document.body.clientHeight;
588 - width = document.body.offsetWidth;
589 - }
590 - else{
591 - height = window.innerHeight;
592 - width = window.innerWidth;
593 - }
 584+ var width = 0, height = 0;
 585+ if( typeof( window.innerWidth ) == 'number' ) {
 586+ //Non-IE
 587+ width = window.innerWidth;
 588+ height = window.innerHeight;
 589+ } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
 590+ //IE 6+ in 'standards compliant mode'
 591+ width = document.documentElement.clientWidth;
 592+ height = document.documentElement.clientHeight;
 593+ } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
 594+ //IE 4 compatible
 595+ width = document.body.clientWidth;
 596+ height = document.body.clientHeight;
594597 }
595 - else {
596 - width = 800; height = 600;
597 - }
598598
599599 //fill the image container
600600 if(!proofreadPageIsEdit) {

Status & tagging log