Index: trunk/phase3/skins/common/IEFixes.js |
— | — | @@ -1,127 +0,0 @@ |
2 | | -// IE fixes javascript |
3 | | - |
4 | | -var isMSIE55 = (window.showModalDialog && window.clipboardData && window.createPopup); |
5 | | -var doneIETransform; |
6 | | -var doneIEAlphaFix; |
7 | | - |
8 | | -if (document.attachEvent) |
9 | | - document.attachEvent('onreadystatechange', hookit); |
10 | | - |
11 | | -function hookit() { |
12 | | - if (!doneIETransform && document.getElementById && document.getElementById('bodyContent')) { |
13 | | - doneIETransform = true; |
14 | | - relativeforfloats(); |
15 | | - fixalpha(); |
16 | | - } |
17 | | -} |
18 | | - |
19 | | -// png alpha transparency fixes |
20 | | -function fixalpha( logoId ) { |
21 | | - // bg |
22 | | - if (isMSIE55 && !doneIEAlphaFix) |
23 | | - { |
24 | | - var plogo = document.getElementById( logoId || 'p-logo' ); |
25 | | - if (!plogo) return; |
26 | | - |
27 | | - var logoa = plogo.getElementsByTagName('a')[0]; |
28 | | - if (!logoa) return; |
29 | | - |
30 | | - var bg = logoa.currentStyle.backgroundImage; |
31 | | - var imageUrl = bg.substring(5, bg.length-2); |
32 | | - |
33 | | - doneIEAlphaFix = true; |
34 | | - |
35 | | - if (imageUrl.substr(imageUrl.length-4).toLowerCase() == '.png') { |
36 | | - var logospan = logoa.appendChild(document.createElement('span')); |
37 | | - |
38 | | - logoa.style.backgroundImage = 'none'; |
39 | | - logospan.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')'; |
40 | | - logospan.style.height = '100%'; |
41 | | - logospan.style.position = 'absolute'; |
42 | | - logospan.style.width = logoa.currentStyle.width; |
43 | | - logospan.style.cursor = 'hand'; |
44 | | - // Center image with hack for IE5.5 |
45 | | - if (document.documentElement.dir == "rtl") |
46 | | - { |
47 | | - logospan.style.right = '50%'; |
48 | | - logospan.style.setExpression('marginRight', '"-" + (this.offsetWidth / 2) + "px"'); |
49 | | - } |
50 | | - else |
51 | | - { |
52 | | - logospan.style.left = '50%'; |
53 | | - logospan.style.setExpression('marginLeft', '"-" + (this.offsetWidth / 2) + "px"'); |
54 | | - } |
55 | | - logospan.style.top = '50%'; |
56 | | - logospan.style.setExpression('marginTop', '"-" + (this.offsetHeight / 2) + "px"'); |
57 | | - |
58 | | - var linkFix = logoa.appendChild(logoa.cloneNode()); |
59 | | - linkFix.style.position = 'absolute'; |
60 | | - linkFix.style.height = '100%'; |
61 | | - linkFix.style.width = '100%'; |
62 | | - } |
63 | | - } |
64 | | -} |
65 | | - |
66 | | -// fix ie6 disappering float bug |
67 | | -function relativeforfloats() { |
68 | | - var bc = document.getElementById('bodyContent'); |
69 | | - if (bc) { |
70 | | - var tables = bc.getElementsByTagName('table'); |
71 | | - var divs = bc.getElementsByTagName('div'); |
72 | | - } |
73 | | - setrelative(tables); |
74 | | - setrelative(divs); |
75 | | -} |
76 | | -function setrelative (nodes) { |
77 | | - var i = 0; |
78 | | - while (i < nodes.length) { |
79 | | - if(((nodes[i].style.float && nodes[i].style.float != ('none') || |
80 | | - (nodes[i].align && nodes[i].align != ('none'))) && |
81 | | - (!nodes[i].style.position || nodes[i].style.position != 'relative'))) |
82 | | - { |
83 | | - nodes[i].style.position = 'relative'; |
84 | | - } |
85 | | - i++; |
86 | | - } |
87 | | -} |
88 | | - |
89 | | - |
90 | | -// Expand links for printing |
91 | | - |
92 | | -String.prototype.hasClass = function(classWanted) |
93 | | -{ |
94 | | - var classArr = this.split(/\s/); |
95 | | - for (var i=0; i<classArr.length; i++) |
96 | | - if (classArr[i].toLowerCase() == classWanted.toLowerCase()) return true; |
97 | | - return false; |
98 | | -} |
99 | | - |
100 | | -var expandedURLs; |
101 | | - |
102 | | -onbeforeprint = function() { |
103 | | - expandedURLs = []; |
104 | | - |
105 | | - var contentEl = document.getElementById("content"); |
106 | | - |
107 | | - if (contentEl) |
108 | | - { |
109 | | - var allLinks = contentEl.getElementsByTagName("a"); |
110 | | - |
111 | | - for (var i=0; i < allLinks.length; i++) { |
112 | | - if (allLinks[i].className.hasClass("external") && !allLinks[i].className.hasClass("free")) { |
113 | | - var expandedLink = document.createElement("span"); |
114 | | - var expandedText = document.createTextNode(" (" + allLinks[i].href + ")"); |
115 | | - expandedLink.appendChild(expandedText); |
116 | | - allLinks[i].parentNode.insertBefore(expandedLink, allLinks[i].nextSibling); |
117 | | - expandedURLs[i] = expandedLink; |
118 | | - } |
119 | | - } |
120 | | - } |
121 | | -} |
122 | | - |
123 | | -onafterprint = function() |
124 | | -{ |
125 | | - for (var i=0; i < expandedURLs.length; i++) |
126 | | - if (expandedURLs[i]) |
127 | | - expandedURLs[i].removeNode(true); |
128 | | -} |
Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -25,6 +25,8 @@ |
26 | 26 | var opera7_bugs = is_opera_seven && !is_opera_95; |
27 | 27 | var opera95_bugs = /opera\/(9\.5)/.test( clientPC ); |
28 | 28 | } |
| 29 | +// Start at 4 to minimize the chance of breaking on IE10 :) |
| 30 | +var ie6_bugs = /msie [4-6]/.test( clientPC ); |
29 | 31 | |
30 | 32 | // Global external objects used by this script. |
31 | 33 | /*extern ta, stylepath, skin */ |
— | — | @@ -999,3 +1001,130 @@ |
1000 | 1002 | //note: all skins should call runOnloadHook() at the end of html output, |
1001 | 1003 | // so the below should be redundant. It's there just in case. |
1002 | 1004 | hookEvent("load", runOnloadHook); |
| 1005 | + |
| 1006 | +if ( ie6_bugs ) { |
| 1007 | + var isMSIE55 = (window.showModalDialog && window.clipboardData && window.createPopup); |
| 1008 | + var doneIETransform; |
| 1009 | + var doneIEAlphaFix; |
| 1010 | + |
| 1011 | + if (document.attachEvent) |
| 1012 | + document.attachEvent('onreadystatechange', hookit); |
| 1013 | + |
| 1014 | + function hookit() { |
| 1015 | + if (!doneIETransform && document.getElementById && document.getElementById('bodyContent')) { |
| 1016 | + doneIETransform = true; |
| 1017 | + relativeforfloats(); |
| 1018 | + fixalpha(); |
| 1019 | + } |
| 1020 | + } |
| 1021 | + |
| 1022 | + // png alpha transparency fixes |
| 1023 | + function fixalpha( logoId ) { |
| 1024 | + // bg |
| 1025 | + if (isMSIE55 && !doneIEAlphaFix) |
| 1026 | + { |
| 1027 | + var plogo = document.getElementById( logoId || 'p-logo' ); |
| 1028 | + if (!plogo) return; |
| 1029 | + |
| 1030 | + var logoa = plogo.getElementsByTagName('a')[0]; |
| 1031 | + if (!logoa) return; |
| 1032 | + |
| 1033 | + var bg = logoa.currentStyle.backgroundImage; |
| 1034 | + var imageUrl = bg.substring(5, bg.length-2); |
| 1035 | + |
| 1036 | + doneIEAlphaFix = true; |
| 1037 | + |
| 1038 | + if (imageUrl.substr(imageUrl.length-4).toLowerCase() == '.png') { |
| 1039 | + var logospan = logoa.appendChild(document.createElement('span')); |
| 1040 | + |
| 1041 | + logoa.style.backgroundImage = 'none'; |
| 1042 | + logospan.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')'; |
| 1043 | + logospan.style.height = '100%'; |
| 1044 | + logospan.style.position = 'absolute'; |
| 1045 | + logospan.style.width = logoa.currentStyle.width; |
| 1046 | + logospan.style.cursor = 'hand'; |
| 1047 | + // Center image with hack for IE5.5 |
| 1048 | + if (document.documentElement.dir == "rtl") |
| 1049 | + { |
| 1050 | + logospan.style.right = '50%'; |
| 1051 | + logospan.style.setExpression('marginRight', '"-" + (this.offsetWidth / 2) + "px"'); |
| 1052 | + } |
| 1053 | + else |
| 1054 | + { |
| 1055 | + logospan.style.left = '50%'; |
| 1056 | + logospan.style.setExpression('marginLeft', '"-" + (this.offsetWidth / 2) + "px"'); |
| 1057 | + } |
| 1058 | + logospan.style.top = '50%'; |
| 1059 | + logospan.style.setExpression('marginTop', '"-" + (this.offsetHeight / 2) + "px"'); |
| 1060 | + |
| 1061 | + var linkFix = logoa.appendChild(logoa.cloneNode()); |
| 1062 | + linkFix.style.position = 'absolute'; |
| 1063 | + linkFix.style.height = '100%'; |
| 1064 | + linkFix.style.width = '100%'; |
| 1065 | + } |
| 1066 | + } |
| 1067 | + } |
| 1068 | + |
| 1069 | + // fix ie6 disappering float bug |
| 1070 | + function relativeforfloats() { |
| 1071 | + var bc = document.getElementById('bodyContent'); |
| 1072 | + if (bc) { |
| 1073 | + var tables = bc.getElementsByTagName('table'); |
| 1074 | + var divs = bc.getElementsByTagName('div'); |
| 1075 | + } |
| 1076 | + setrelative(tables); |
| 1077 | + setrelative(divs); |
| 1078 | + } |
| 1079 | + function setrelative (nodes) { |
| 1080 | + var i = 0; |
| 1081 | + while (i < nodes.length) { |
| 1082 | + if(((nodes[i].style.float && nodes[i].style.float != ('none') || |
| 1083 | + (nodes[i].align && nodes[i].align != ('none'))) && |
| 1084 | + (!nodes[i].style.position || nodes[i].style.position != 'relative'))) |
| 1085 | + { |
| 1086 | + nodes[i].style.position = 'relative'; |
| 1087 | + } |
| 1088 | + i++; |
| 1089 | + } |
| 1090 | + } |
| 1091 | + |
| 1092 | + |
| 1093 | + // Expand links for printing |
| 1094 | + |
| 1095 | + String.prototype.hasClass = function(classWanted) |
| 1096 | + { |
| 1097 | + var classArr = this.split(/\s/); |
| 1098 | + for (var i=0; i<classArr.length; i++) |
| 1099 | + if (classArr[i].toLowerCase() == classWanted.toLowerCase()) return true; |
| 1100 | + return false; |
| 1101 | + } |
| 1102 | + |
| 1103 | + var expandedURLs; |
| 1104 | + |
| 1105 | + onbeforeprint = function() { |
| 1106 | + expandedURLs = []; |
| 1107 | + |
| 1108 | + var contentEl = document.getElementById("content"); |
| 1109 | + |
| 1110 | + if (contentEl) |
| 1111 | + { |
| 1112 | + var allLinks = contentEl.getElementsByTagName("a"); |
| 1113 | + |
| 1114 | + for (var i=0; i < allLinks.length; i++) { |
| 1115 | + if (allLinks[i].className.hasClass("external") && !allLinks[i].className.hasClass("free")) { |
| 1116 | + var expandedLink = document.createElement("span"); |
| 1117 | + var expandedText = document.createTextNode(" (" + allLinks[i].href + ")"); |
| 1118 | + expandedLink.appendChild(expandedText); |
| 1119 | + allLinks[i].parentNode.insertBefore(expandedLink, allLinks[i].nextSibling); |
| 1120 | + expandedURLs[i] = expandedLink; |
| 1121 | + } |
| 1122 | + } |
| 1123 | + } |
| 1124 | + } |
| 1125 | + |
| 1126 | + onafterprint = function() { |
| 1127 | + for (var i=0; i < expandedURLs.length; i++) |
| 1128 | + if (expandedURLs[i]) |
| 1129 | + expandedURLs[i].removeNode(true); |
| 1130 | + } |
| 1131 | +} |
Index: trunk/phase3/skins/Vector.php |
— | — | @@ -48,17 +48,6 @@ |
49 | 49 | $out->addStyle( 'vector/' . $style, 'screen' ); |
50 | 50 | } |
51 | 51 | } |
52 | | - // Append common IE fixes, which perhaps should be included in all |
53 | | - // skins, but for now it seems each skin needs to include them |
54 | | - // explicitly |
55 | | - $out->addScript( |
56 | | - '<!--[if lt IE 7]><script type="' . $wgJsMimeType . '" src="' . |
57 | | - $wgStylePath . |
58 | | - '/common/IEFixes.js?' . |
59 | | - $wgStyleVersion . |
60 | | - '"></script>' . |
61 | | - '<meta http-equiv="imagetoolbar" content="no" /><![endif]-->' |
62 | | - ); |
63 | 52 | } |
64 | 53 | /** |
65 | 54 | * Builds a structured array of links used for tabs and menus |
Index: trunk/phase3/skins/MonoBook.php |
— | — | @@ -42,13 +42,6 @@ |
43 | 43 | |
44 | 44 | $out->addStyle( 'monobook/rtl.css', 'screen', '', 'rtl' ); |
45 | 45 | |
46 | | - # FIXME: What is this? Should it apply to all skins? |
47 | | - $path = htmlspecialchars( $wgStylePath ); |
48 | | - $out->addScript( <<<HTML |
49 | | -<!--[if lt IE 7]><script type="$wgJsMimeType" src="$path/common/IEFixes.js?$wgStyleVersion"></script> |
50 | | - <meta http-equiv="imagetoolbar" content="no" /><![endif]--> |
51 | | -HTML |
52 | | - ); |
53 | 46 | } |
54 | 47 | } |
55 | 48 | |
Index: trunk/phase3/skins/Modern.php |
— | — | @@ -36,13 +36,6 @@ |
37 | 37 | $out->addStyle( 'modern/main.css', 'screen' ); |
38 | 38 | $out->addStyle( 'modern/print.css', 'print' ); |
39 | 39 | $out->addStyle( 'modern/rtl.css', 'screen', '', 'rtl' ); |
40 | | - |
41 | | - $path = htmlspecialchars( $wgStylePath ); |
42 | | - $out->addScript( <<<HTML |
43 | | -<!--[if lt IE 7]><script type="$wgJsMimeType" src="$path/common/IEFixes.js?$wgStyleVersion"></script> |
44 | | - <meta http-equiv="imagetoolbar" content="no" /><![endif]--> |
45 | | -HTML |
46 | | - ); |
47 | 40 | } |
48 | 41 | } |
49 | 42 | |