http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60994

Revision: 60994
Author:   simetrical
Date:     2010-01-12 23:36:02 +0000 (Tue, 12 Jan 2010)

Log Message:
-----------
Merge IEFixes.js into wikibits.js

Not actually tested, but it should theoretically work fine.  This
previously wasn't getting loaded for skins other than Monobook, Modern,
and Vector, and each one had separate code to load it.

I also removed <meta http-equiv="imagetoolbar" content="no" />.  This
was added by Gabriel Wicke without explanation as part of the original
davinci.pt back in r2786, in March 2004.  As far as I can tell, it
disables some minor feature of IE6 for some reason.  I assume it can be
removed completely at this point.  If not, it should be readded without
the conditional comment, which is probably unnecessary.

Modified Paths:
--------------
    trunk/phase3/skins/Modern.php
    trunk/phase3/skins/MonoBook.php
    trunk/phase3/skins/Vector.php
    trunk/phase3/skins/common/wikibits.js

Removed Paths:
-------------
    trunk/phase3/skins/common/IEFixes.js

Modified: trunk/phase3/skins/Modern.php
===================================================================
--- trunk/phase3/skins/Modern.php       2010-01-12 23:05:41 UTC (rev 60993)
+++ trunk/phase3/skins/Modern.php       2010-01-12 23:36:02 UTC (rev 60994)
@@ -36,13 +36,6 @@
                $out->addStyle( 'modern/main.css', 'screen' );
                $out->addStyle( 'modern/print.css', 'print' );
                $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' );
-
-               $path = htmlspecialchars( $wgStylePath );
-               $out->addScript( <<<HTML
-<!--[if lt IE 7]><script type="$wgJsMimeType" 
src="$path/common/IEFixes.js?$wgStyleVersion"></script>
-       <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
-HTML
-               );
        }
 }
 

Modified: trunk/phase3/skins/MonoBook.php
===================================================================
--- trunk/phase3/skins/MonoBook.php     2010-01-12 23:05:41 UTC (rev 60993)
+++ trunk/phase3/skins/MonoBook.php     2010-01-12 23:36:02 UTC (rev 60994)
@@ -42,13 +42,6 @@
 
                $out->addStyle( 'monobook/rtl.css', 'screen', '', 'rtl' );
 
-               # FIXME: What is this?  Should it apply to all skins?
-               $path = htmlspecialchars( $wgStylePath );
-               $out->addScript( <<<HTML
-<!--[if lt IE 7]><script type="$wgJsMimeType" 
src="$path/common/IEFixes.js?$wgStyleVersion"></script>
-       <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
-HTML
-               );
        }
 }
 

Modified: trunk/phase3/skins/Vector.php
===================================================================
--- trunk/phase3/skins/Vector.php       2010-01-12 23:05:41 UTC (rev 60993)
+++ trunk/phase3/skins/Vector.php       2010-01-12 23:36:02 UTC (rev 60994)
@@ -48,17 +48,6 @@
                                $out->addStyle( 'vector/' . $style, 'screen' );
                        }
                }
-               // Append common IE fixes, which perhaps should be included in 
all
-               // skins, but for now it seems each skin needs to include them
-               // explicitly
-               $out->addScript(
-                       '<!--[if lt IE 7]><script type="' . $wgJsMimeType . '" 
src="' .
-                               $wgStylePath .
-                               '/common/IEFixes.js?' .
-                               $wgStyleVersion .
-                               '"></script>' .
-                               '<meta http-equiv="imagetoolbar" content="no" 
/><![endif]-->'
-               );
        }
        /**
         * Builds a structured array of links used for tabs and menus

Deleted: trunk/phase3/skins/common/IEFixes.js
===================================================================
--- trunk/phase3/skins/common/IEFixes.js        2010-01-12 23:05:41 UTC (rev 
60993)
+++ trunk/phase3/skins/common/IEFixes.js        2010-01-12 23:36:02 UTC (rev 
60994)
@@ -1,127 +0,0 @@
-// IE fixes javascript
-
-var isMSIE55 = (window.showModalDialog && window.clipboardData && 
window.createPopup);
-var doneIETransform;
-var doneIEAlphaFix;
-
-if (document.attachEvent)
-  document.attachEvent('onreadystatechange', hookit);
-
-function hookit() {
-    if (!doneIETransform && document.getElementById && 
document.getElementById('bodyContent')) {
-        doneIETransform = true;
-        relativeforfloats();
-        fixalpha();
-    }
-}
-
-// png alpha transparency fixes
-function fixalpha( logoId ) {
-    // bg
-    if (isMSIE55 && !doneIEAlphaFix)
-    {
-        var plogo = document.getElementById( logoId || 'p-logo' );
-        if (!plogo) return;
-
-        var logoa = plogo.getElementsByTagName('a')[0];
-        if (!logoa) return;
-
-        var bg = logoa.currentStyle.backgroundImage;
-        var imageUrl = bg.substring(5, bg.length-2);
-
-        doneIEAlphaFix = true;
-
-        if (imageUrl.substr(imageUrl.length-4).toLowerCase() == '.png') {
-            var logospan = logoa.appendChild(document.createElement('span'));
-
-            logoa.style.backgroundImage = 'none';
-            logospan.style.filter = 
'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')';
-            logospan.style.height = '100%';
-            logospan.style.position = 'absolute';
-            logospan.style.width = logoa.currentStyle.width;
-            logospan.style.cursor = 'hand';
-            // Center image with hack for IE5.5
-            if (document.documentElement.dir == "rtl")
-            {
-              logospan.style.right = '50%';
-              logospan.style.setExpression('marginRight', '"-" + 
(this.offsetWidth / 2) + "px"');
-            }
-            else
-            {
-              logospan.style.left = '50%';
-              logospan.style.setExpression('marginLeft', '"-" + 
(this.offsetWidth / 2) + "px"');
-            }
-            logospan.style.top = '50%';
-            logospan.style.setExpression('marginTop', '"-" + 
(this.offsetHeight / 2) + "px"');
-
-            var linkFix = logoa.appendChild(logoa.cloneNode());
-            linkFix.style.position = 'absolute';
-            linkFix.style.height = '100%';
-            linkFix.style.width = '100%';
-        }
-    }
-}
-
-// fix ie6 disappering float bug
-function relativeforfloats() {
-    var bc = document.getElementById('bodyContent');
-    if (bc) {
-        var tables = bc.getElementsByTagName('table');
-        var divs = bc.getElementsByTagName('div');
-    }
-    setrelative(tables);
-    setrelative(divs);
-}
-function setrelative (nodes) {
-    var i = 0;
-    while (i < nodes.length) {
-        if(((nodes[i].style.float && nodes[i].style.float != ('none') ||
-        (nodes[i].align && nodes[i].align != ('none'))) &&
-        (!nodes[i].style.position || nodes[i].style.position != 'relative'))) 
-        {
-            nodes[i].style.position = 'relative';
-        }
-        i++;
-    }
-}
-
-
-// Expand links for printing
-
-String.prototype.hasClass = function(classWanted)
-{
-    var classArr = this.split(/\s/);
-    for (var i=0; i<classArr.length; i++)
-      if (classArr[i].toLowerCase() == classWanted.toLowerCase()) return true;
-    return false;
-}
-
-var expandedURLs;
-
-onbeforeprint = function() { 
-    expandedURLs = [];
-
-    var contentEl = document.getElementById("content");
-
-    if (contentEl)
-    {
-      var allLinks = contentEl.getElementsByTagName("a");
-
-      for (var i=0; i < allLinks.length; i++) {
-          if (allLinks[i].className.hasClass("external") && 
!allLinks[i].className.hasClass("free")) {
-              var expandedLink = document.createElement("span");
-              var expandedText = document.createTextNode(" (" + 
allLinks[i].href + ")");
-              expandedLink.appendChild(expandedText);
-              allLinks[i].parentNode.insertBefore(expandedLink, 
allLinks[i].nextSibling);
-              expandedURLs[i] = expandedLink;
-          }
-      }
-   }
-}
-
-onafterprint = function()
-{
-    for (var i=0; i < expandedURLs.length; i++)
-        if (expandedURLs[i])
-            expandedURLs[i].removeNode(true);
-}

Modified: trunk/phase3/skins/common/wikibits.js
===================================================================
--- trunk/phase3/skins/common/wikibits.js       2010-01-12 23:05:41 UTC (rev 
60993)
+++ trunk/phase3/skins/common/wikibits.js       2010-01-12 23:36:02 UTC (rev 
60994)
@@ -25,6 +25,8 @@
        var opera7_bugs = is_opera_seven && !is_opera_95;
        var opera95_bugs = /opera\/(9\.5)/.test( clientPC );
 }
+// Start at 4 to minimize the chance of breaking on IE10 :)
+var ie6_bugs = /msie [4-6]/.test( clientPC );
 
 // Global external objects used by this script.
 /*extern ta, stylepath, skin */
@@ -999,3 +1001,130 @@
 //note: all skins should call runOnloadHook() at the end of html output,
 //      so the below should be redundant. It's there just in case.
 hookEvent("load", runOnloadHook);
+
+if ( ie6_bugs ) {
+       var isMSIE55 = (window.showModalDialog && window.clipboardData && 
window.createPopup);
+       var doneIETransform;
+       var doneIEAlphaFix;
+
+       if (document.attachEvent)
+         document.attachEvent('onreadystatechange', hookit);
+
+       function hookit() {
+               if (!doneIETransform && document.getElementById && 
document.getElementById('bodyContent')) {
+                       doneIETransform = true;
+                       relativeforfloats();
+                       fixalpha();
+               }
+       }
+
+       // png alpha transparency fixes
+       function fixalpha( logoId ) {
+               // bg
+               if (isMSIE55 && !doneIEAlphaFix)
+               {
+                       var plogo = document.getElementById( logoId || 'p-logo' 
);
+                       if (!plogo) return;
+
+                       var logoa = plogo.getElementsByTagName('a')[0];
+                       if (!logoa) return;
+
+                       var bg = logoa.currentStyle.backgroundImage;
+                       var imageUrl = bg.substring(5, bg.length-2);
+
+                       doneIEAlphaFix = true;
+
+                       if (imageUrl.substr(imageUrl.length-4).toLowerCase() == 
'.png') {
+                               var logospan = 
logoa.appendChild(document.createElement('span'));
+
+                               logoa.style.backgroundImage = 'none';
+                               logospan.style.filter = 
'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')';
+                               logospan.style.height = '100%';
+                               logospan.style.position = 'absolute';
+                               logospan.style.width = logoa.currentStyle.width;
+                               logospan.style.cursor = 'hand';
+                               // Center image with hack for IE5.5
+                               if (document.documentElement.dir == "rtl")
+                               {
+                                 logospan.style.right = '50%';
+                                 logospan.style.setExpression('marginRight', 
'"-" + (this.offsetWidth / 2) + "px"');
+                               }
+                               else
+                               {
+                                 logospan.style.left = '50%';
+                                 logospan.style.setExpression('marginLeft', 
'"-" + (this.offsetWidth / 2) + "px"');
+                               }
+                               logospan.style.top = '50%';
+                               logospan.style.setExpression('marginTop', '"-" 
+ (this.offsetHeight / 2) + "px"');
+
+                               var linkFix = 
logoa.appendChild(logoa.cloneNode());
+                               linkFix.style.position = 'absolute';
+                               linkFix.style.height = '100%';
+                               linkFix.style.width = '100%';
+                       }
+               }
+       }
+
+       // fix ie6 disappering float bug
+       function relativeforfloats() {
+               var bc = document.getElementById('bodyContent');
+               if (bc) {
+                       var tables = bc.getElementsByTagName('table');
+                       var divs = bc.getElementsByTagName('div');
+               }
+               setrelative(tables);
+               setrelative(divs);
+       }
+       function setrelative (nodes) {
+               var i = 0;
+               while (i < nodes.length) {
+                       if(((nodes[i].style.float && nodes[i].style.float != 
('none') ||
+                       (nodes[i].align && nodes[i].align != ('none'))) &&
+                       (!nodes[i].style.position || nodes[i].style.position != 
'relative')))
+                       {
+                               nodes[i].style.position = 'relative';
+                       }
+                       i++;
+               }
+       }
+
+
+       // Expand links for printing
+
+       String.prototype.hasClass = function(classWanted)
+       {
+               var classArr = this.split(/\s/);
+               for (var i=0; i<classArr.length; i++)
+                 if (classArr[i].toLowerCase() == classWanted.toLowerCase()) 
return true;
+               return false;
+       }
+
+       var expandedURLs;
+
+       onbeforeprint = function() {
+               expandedURLs = [];
+
+               var contentEl = document.getElementById("content");
+
+               if (contentEl)
+               {
+                 var allLinks = contentEl.getElementsByTagName("a");
+
+                 for (var i=0; i < allLinks.length; i++) {
+                         if (allLinks[i].className.hasClass("external") && 
!allLinks[i].className.hasClass("free")) {
+                                 var expandedLink = 
document.createElement("span");
+                                 var expandedText = document.createTextNode(" 
(" + allLinks[i].href + ")");
+                                 expandedLink.appendChild(expandedText);
+                                 
allLinks[i].parentNode.insertBefore(expandedLink, allLinks[i].nextSibling);
+                                 expandedURLs[i] = expandedLink;
+                         }
+                 }
+          }
+       }
+
+       onafterprint = function() {
+               for (var i=0; i < expandedURLs.length; i++)
+                       if (expandedURLs[i])
+                               expandedURLs[i].removeNode(true);
+       }
+}



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

Reply via email to