+++ /dev/null
-<attach event="ondocumentready" handler="parseStylesheets" />\r
-<script>\r
-/**\r
- * Whatever:hover - V1.42.060206 - hover & active\r
- * ------------------------------------------------------------\r
- * (c) 2005 - Peter Nederlof\r
- * Peterned - http://www.xs4all.nl/~peterned/\r
- * License - http://creativecommons.org/licenses/LGPL/2.1/\r
- *\r
- * Whatever:hover is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * Whatever:hover is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- *\r
- * Credits and thanks to:\r
- * Arnoud Berendsen, Martin Reurings, Robert Hanson\r
- *\r
- * howto: body { behavior:url("csshover.htc"); }\r
- * ------------------------------------------------------------\r
- */\r
-\r
-var csshoverReg = /(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i,\r
-currentSheet, doc = window.document, hoverEvents = [], activators = {\r
- onhover:{on:'onmouseover', off:'onmouseout'},\r
- onactive:{on:'onmousedown', off:'onmouseup'}\r
-}\r
-\r
-function parseStylesheets() {\r
- if(!/MSIE (5|6)/.test(navigator.userAgent)) return;\r
- window.attachEvent('onunload', unhookHoverEvents);\r
- var sheets = doc.styleSheets, l = sheets.length;\r
- for(var i=0; i<l; i++) \r
- parseStylesheet(sheets[i]);\r
-}\r
- function parseStylesheet(sheet) {\r
- if(sheet.imports) {\r
- try {\r
- var imports = sheet.imports, l = imports.length;\r
- for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]);\r
- } catch(securityException){}\r
- }\r
-\r
- try {\r
- var rules = (currentSheet = sheet).rules, l = rules.length;\r
- for(var j=0; j<l; j++) parseCSSRule(rules[j]);\r
- } catch(securityException){}\r
- }\r
-\r
- function parseCSSRule(rule) {\r
- var select = rule.selectorText, style = rule.style.cssText;\r
- if(!csshoverReg.test(select) || !style) return;\r
-\r
- var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1');\r
- var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo);\r
- var className = (/\.([a-z0-9_-]*on(hover|active))/i).exec(newSelect)[1];\r
- var affected = select.replace(/:(hover|active).*$/, '');\r
- var elements = getElementsBySelect(affected);\r
- if(elements.length == 0) return;\r
-\r
- currentSheet.addRule(newSelect, style);\r
- for(var i=0; i<elements.length; i++)\r
- new HoverElement(elements[i], className, activators[pseudo]);\r
- }\r
-\r
-function HoverElement(node, className, events) {\r
- if(!node.hovers) node.hovers = {};\r
- if(node.hovers[className]) return;\r
- node.hovers[className] = true;\r
- hookHoverEvent(node, events.on, function() { node.className += ' ' + className; });\r
- hookHoverEvent(node, events.off, function() { node.className = node.className.replace(new RegExp('\\s+'+className, 'g'),''); });\r
-}\r
- function hookHoverEvent(node, type, handler) {\r
- node.attachEvent(type, handler);\r
- hoverEvents[hoverEvents.length] = { \r
- node:node, type:type, handler:handler \r
- };\r
- }\r
-\r
- function unhookHoverEvents() {\r
- for(var e,i=0; i<hoverEvents.length; i++) {\r
- e = hoverEvents[i]; \r
- e.node.detachEvent(e.type, e.handler);\r
- }\r
- }\r
-\r
-function getElementsBySelect(rule) {\r
- var parts, nodes = [doc];\r
- parts = rule.split(' ');\r
- for(var i=0; i<parts.length; i++) {\r
- nodes = getSelectedNodes(parts[i], nodes);\r
- } return nodes;\r
-}\r
- function getSelectedNodes(select, elements) {\r
- var result, node, nodes = [];\r
- var identify = (/\#([a-z0-9_-]+)/i).exec(select);\r
- if(identify) {\r
- var element = doc.getElementById(identify[1]);\r
- return element? [element]:nodes;\r
- }\r
- \r
- var classname = (/\.([a-z0-9_-]+)/i).exec(select);\r
- var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');\r
- var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false;\r
- for(var i=0; i<elements.length; i++) {\r
- result = tagName? elements[i].all.tags(tagName):elements[i].all; \r
- for(var j=0; j<result.length; j++) {\r
- node = result[j];\r
- if(classReg && !classReg.test(node.className)) continue;\r
- nodes[nodes.length] = node;\r
- }\r
- } \r
- \r
- return nodes;\r
- }\r
-\r
-window.parseStylesheets = parseStylesheets;\r
-</script>
\ No newline at end of file