Revision: 52512
Author:   thomasv
Date:     2009-06-28 15:20:51 +0000 (Sun, 28 Jun 2009)

Log Message:
-----------
improved window size detection

Modified Paths:
--------------
    trunk/extensions/ProofreadPage/proofread.js

Modified: trunk/extensions/ProofreadPage/proofread.js
===================================================================
--- trunk/extensions/ProofreadPage/proofread.js 2009-06-28 15:15:52 UTC (rev 
52511)
+++ trunk/extensions/ProofreadPage/proofread.js 2009-06-28 15:20:51 UTC (rev 
52512)
@@ -580,20 +580,20 @@
        self.pr_horiz = horizontal_layout;
 
        //get the size of the window
-       var width, height;
-       if (parseInt(navigator.appVersion)>3) {
-               if (navigator.appName.indexOf("Microsoft")!=-1) {
-                       height = document.body.clientHeight;
-                       width = document.body.offsetWidth;
-               }
-               else{
-                       height = window.innerHeight;
-                       width = window.innerWidth;
-               }
+       var width = 0, height = 0;
+       if( typeof( window.innerWidth ) == 'number' ) {
+               //Non-IE
+               width = window.innerWidth;
+               height = window.innerHeight;
+       } else if( document.documentElement && ( 
document.documentElement.clientWidth || document.documentElement.clientHeight ) 
) {
+               //IE 6+ in 'standards compliant mode'
+               width = document.documentElement.clientWidth;
+               height = document.documentElement.clientHeight;
+       } else if( document.body && ( document.body.clientWidth || 
document.body.clientHeight ) ) {
+               //IE 4 compatible
+               width = document.body.clientWidth;
+               height = document.body.clientHeight;
        }
-       else {
-               width = 800; height = 600;
-       }
 
        //fill the image container      
        if(!proofreadPageIsEdit) { 



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to