Warning, /OnlineDB/EcalCondDB/webapp/csshover.htc is written in an unsupported language. File is not indexed.
0001 <attach event="ondocumentready" handler="parseStylesheets" />
0002 <script>
0003 /**
0004 * Whatever:hover - V2.02.060206 - hover, active & focus
0005 * ------------------------------------------------------------
0006 * (c) 2005 - Peter Nederlof
0007 * Peterned - http://www.xs4all.nl/~peterned/
0008 * License - http://creativecommons.org/licenses/LGPL/2.1/
0009 *
0010 * Whatever:hover is free software; you can redistribute it and/or
0011 * modify it under the terms of the GNU Lesser General Public
0012 * License as published by the Free Software Foundation; either
0013 * version 2.1 of the License, or (at your option) any later version.
0014 *
0015 * Whatever:hover is distributed in the hope that it will be useful,
0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0018 * Lesser General Public License for more details.
0019 *
0020 * Credits and thanks to:
0021 * Arnoud Berendsen, Martin Reurings, Robert Hanson
0022 *
0023 * howto: body { behavior:url("csshover.htc"); }
0024 * ------------------------------------------------------------
0025 */
0026
0027 var csshoverReg = /(^|\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active))|((a|input|textarea)([#.][^ ]+)?:unknown)/i,
0028 currentSheet, doc = window.document, hoverEvents = [], activators = {
0029 onhover:{on:'onmouseover', off:'onmouseout'},
0030 onactive:{on:'onmousedown', off:'onmouseup'},
0031 onunknown:{on:'onfocus', off:'onblur'}
0032 }
0033
0034 function parseStylesheets() {
0035 if(!/MSIE (5|6)/.test(navigator.userAgent)) return;
0036 window.attachEvent('onunload', unhookHoverEvents);
0037 var sheets = doc.styleSheets, l = sheets.length;
0038 for(var i=0; i<l; i++)
0039 parseStylesheet(sheets[i]);
0040 }
0041 function parseStylesheet(sheet) {
0042 if(sheet.imports) {
0043 try {
0044 var imports = sheet.imports, l = imports.length;
0045 for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]);
0046 } catch(securityException){}
0047 }
0048
0049 try {
0050 var rules = (currentSheet = sheet).rules, l = rules.length;
0051 for(var j=0; j<l; j++) parseCSSRule(rules[j]);
0052 } catch(securityException){}
0053 }
0054
0055 function parseCSSRule(rule) {
0056 var select = rule.selectorText, style = rule.style.cssText;
0057 if(!csshoverReg.test(select) || !style) return;
0058
0059 var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1');
0060 var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo);
0061 var className = (/\.([a-z0-9_-]*on(hover|active|unknown))/i).exec(newSelect)[1];
0062 var affected = select.replace(/:(hover|active|unknown).*$/, '');
0063 var elements = getElementsBySelect(affected);
0064 if(elements.length == 0) return;
0065
0066 currentSheet.addRule(newSelect, style);
0067 for(var i=0; i<elements.length; i++)
0068 new HoverElement(elements[i], className, activators[pseudo]);
0069 }
0070
0071 function HoverElement(node, className, events) {
0072 if(!node.hovers) node.hovers = {};
0073 if(node.hovers[className]) return;
0074 node.hovers[className] = true;
0075 hookHoverEvent(node, events.on, function() { node.className += ' ' + className; });
0076 hookHoverEvent(node, events.off, function() { node.className = node.className.replace(new RegExp('\\s+'+className, 'g'),''); });
0077 }
0078 function hookHoverEvent(node, type, handler) {
0079 node.attachEvent(type, handler);
0080 hoverEvents[hoverEvents.length] = {
0081 node:node, type:type, handler:handler
0082 };
0083 }
0084
0085 function unhookHoverEvents() {
0086 for(var e,i=0; i<hoverEvents.length; i++) {
0087 e = hoverEvents[i];
0088 e.node.detachEvent(e.type, e.handler);
0089 }
0090 }
0091
0092 function getElementsBySelect(rule) {
0093 var parts, nodes = [doc];
0094 parts = rule.split(' ');
0095 for(var i=0; i<parts.length; i++) {
0096 nodes = getSelectedNodes(parts[i], nodes);
0097 } return nodes;
0098 }
0099 function getSelectedNodes(select, elements) {
0100 var result, node, nodes = [];
0101 var identify = (/\#([a-z0-9_-]+)/i).exec(select);
0102 if(identify) {
0103 var element = doc.getElementById(identify[1]);
0104 return element? [element]:nodes;
0105 }
0106
0107 var classname = (/\.([a-z0-9_-]+)/i).exec(select);
0108 var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');
0109 var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false;
0110 for(var i=0; i<elements.length; i++) {
0111 result = tagName? elements[i].all.tags(tagName):elements[i].all;
0112 for(var j=0; j<result.length; j++) {
0113 node = result[j];
0114 if(classReg && !classReg.test(node.className)) continue;
0115 nodes[nodes.length] = node;
0116 }
0117 }
0118
0119 return nodes;
0120 }
0121 </script>