Changeset 512
- Timestamp:
- 09/07/06 08:25:40
- Files:
-
- qPloneDropDownMenu/trunk/Extensions/Install.py (modified) (2 diffs)
- qPloneDropDownMenu/trunk/HISTORY.txt (modified) (1 diff)
- qPloneDropDownMenu/trunk/__init__.py (modified) (2 diffs)
- qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/csshover.htc.dtml (modified) (7 diffs)
- qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/csshover_save.cpy (added)
- qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/csshover_save.cpy.metadata (added)
- qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/drop_down.css.dtml (modified) (4 diffs)
- qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/prefs_csshover_edit_form.cpt (added)
- qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/prefs_csshover_edit_form.cpt.metadata (added)
- qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/prefs_dropdownmenu_edit_form.cpt (modified) (1 diff)
- qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/prefs_dropdownmenu_edit_form.cpt.metadata (modified) (previous)
- qPloneDropDownMenu/trunk/utils.py (added)
- qPloneDropDownMenu/trunk/version.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneDropDownMenu/trunk/Extensions/Install.py
r511 r512 18 18 'appId':PROJECT_NAME, 19 19 'permission':VIEW_PERMISSION, 20 'imageUrl':'qplonedropdownmenu.gif' },) 20 'imageUrl':'qplonedropdownmenu.gif'}, 21 {'id':'csshover', 22 'name':'CSS Hover', 23 'action':'string:${portal_url}/prefs_csshover_edit_form', 24 'condition':'', 25 'category':'Products', 26 'visible':1, 27 'appId':'csshover', 28 'permission':VIEW_PERMISSION},) 21 29 22 30 def registerCSS(self, out): … … 87 95 ap = getattr(portal_props, PROPERTY_SHEET) 88 96 safeEditProperty(ap, 'menu', out, 'text') 89 97 90 98 def setupSkin(self, out, skinFolder): 91 99 qPloneDropDownMenu/trunk/HISTORY.txt
r511 r512 1 0.1.10 2 3 * fixed kupu related bug (during editing with kupu in zoomed mode) 4 1 5 0.1.9 2 6 qPloneDropDownMenu/trunk/__init__.py
r511 r512 1 from AccessControl import allow_module 1 2 from Products.CMFCore import utils 2 3 from Products.CMFCore.DirectoryView import registerDirectory … … 4 5 from Products.qPloneDropDownMenu.DropDownMenuTool import DropDownMenuTool 5 6 from Products.qPloneDropDownMenu.config import PROJECT_NAME, SKINS_DIR, GLOBALS, VIEW_PERMISSION 7 8 allow_module('Products.qPloneDropDownMenu.utils') 6 9 7 10 registerDirectory(SKINS_DIR, GLOBALS) qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/csshover.htc.dtml
r511 r512 14 14 * --------------------------------------------- 15 15 */ 16 17 16 var currentSheet, doc = window.document; 18 17 var csshover_nodes = getElementsByClassName("csshover", doc); 19 var csshover_rules = [] ;20 var IE5 = (doc ument.getElementsByTagName('*').length == 0) ? true : false;21 var DEBUG = false, styles = "", parseCSSRulecounter =0;18 var csshover_rules = [], hoverStyleSheets = "", addRules = true; 19 var IE5 = (doc.getElementsByTagName('*').length == 0) ? true : false, configlet = doc.getElementById('csshovering'); 20 var DEBUG = false, styles = "", parseCSSRulecounter = 0, timer, timerTable = "", d=true; 22 21 23 22 function parseStylesheets() { 24 23 var sheets = doc.styleSheets, l = sheets.length; 25 for(var i=0; i<l; i++) 24 for(var i=0; i<l; i++){ 26 25 parseStylesheet(sheets[i]); 27 if(DEBUG) alert(styles) 28 } 26 }; 27 if (configlet) {configlet.innerText = hoverStyleSheets;}; 28 if(DEBUG) { 29 alert(styles); 30 alert(timerTable); 31 }; 32 }; 29 33 30 34 function parseStylesheet(sheet) { … … 36 40 for(var i=0; i<l; i++) 37 41 parseStylesheet(sheet.imports[i]); 38 } 42 }; 39 43 rules = (currentSheet = sheet).rules, l = rules.length; 40 for(var j=0; j<l; j++){ parseCSSRule(rules[j]);};41 } 44 for(var j=0; j<l; j++){parseCSSRule(rules[j]);}; 45 }; 42 46 43 47 function parseCSSRule(rule) { 44 if(DEBUG) if((parseCSSRulecounter++)%15 == 0) window.status += '.'; 48 if(DEBUG) { 49 if((parseCSSRulecounter++)%15 == 0) window.status += '.'; 50 startTimer(); 51 }; 45 52 var select = rule.selectorText, style = rule.style.cssText; 53 if (addRules && (/\.cssHoverCSSExists/i).test(select)) {addRules = false;}; 54 if(!(/\.csshover/i).test(select)) return; 46 55 if(style.replace(/ /, "") == "") return; 47 if(!(/\.csshover/i).test(select)) return;48 56 if(!(/(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):hover/i).test(select)) return; 49 57 50 58 var newSelect = select.replace(/(\.([a-z0-9_-]+):hover)|(:hover)/g, '.$2onHover'); 51 currentSheet.addRule(newSelect, style); 59 if (addRules) {currentSheet.addRule(newSelect, style);}; 60 if (configlet) {hoverStyleSheets += newSelect + ' \{\n ' + style.replace('; ', '\;\n ') + ';\n\}\n';}; 52 61 53 62 var hasClass = (/(\.([a-z0-9_-]+):hover)/g).exec(select); … … 55 64 var affected = select.replace(/:hover.*$/g, ''); 56 65 affected = affected.replace(/^.*([ ]|^)(([^ ]*)\.csshover)/i, '$2'); 57 66 if (DEBUG) {timerTable += stopTimer() + '\n';}; 58 67 if(!csshover_rules[className + ',' + affected]) { 68 if (DEBUG) {startTimer();}; 59 69 var elements = getElementsBySelect(affected); 60 if(DEBUG) window.status += " "+elements.length; 61 if(DEBUG) styles += "" + elements.length + ": " + affected + '\n'; 70 if(DEBUG) { 71 window.status += " "+elements.length; 72 styles += "" + elements.length + ": " + affected + '\n'; 73 }; 62 74 for(var i=0; i<elements.length; i++) 63 75 new HoverElement(elements[i], className); 64 76 csshover_rules[className + ',' + affected] = true; 65 } 66 } 77 }; 78 }; 67 79 68 80 function HoverElement(node, className) { … … 75 87 function() { node.className = 76 88 node.className.replace((new RegExp('\\s+'+className)),''); }); 77 } 89 }; 78 90 79 91 function getElementsBySelect(rule) { … … 82 94 for(var i=0; i<parts.length; i++) { 83 95 nodes = getSelectedNodes(parts[i], nodes, i==0); 84 } 96 }; 85 97 return nodes; 86 } 98 }; 87 99 88 100 function getSelectedNodes(select, elements, includeRoot) { 89 101 var element, result, node, nodes = []; 90 102 var classname = (/\.([a-z0-9_-]+)/i).exec(select); 91 if(classname) classname_re = new RegExp('\\b' + classname[1] + '\\b');103 if(classname) {classname_re = new RegExp('\\b' + classname[1] + '\\b');}; 92 104 var identify = (/\#([a-z0-9_-]+)/i).exec(select); 93 105 var tagName = (/^[a-z0-9]+/i).exec(select.toUpperCase()) || '*', … … 106 118 if((identify && node.id != identify[1]) || (classname && !(classname_re.exec(node.className))) || arrayHasElement(nodes, node)) continue; 107 119 nodes[nodes.length] = node; 108 } 109 } 120 }; 121 }; 110 122 return nodes; 111 } 123 }; 112 124 113 125 function arrayHasElement(a, el) { … … 115 127 for(var i=0; i<l; i++) if(a[i] == el) return true; 116 128 return false; 117 } 129 }; 118 130 119 131 function getElementsByClassName(className, parentElement) { 120 132 var result = new Array(), 121 list = (parentElement || doc.body). all //getElementsByTagName('*');122 for(var i = 0; i < list.length; i++) {123 if(list[i].className.match(new RegExp('(^|\\s)' + className + '(\\s|$)'))) result[result.length] = list[i];124 }125 return result 133 list = (parentElement || doc.body).getElementsByTagName('*'); 134 if(list.length == 0) list = (parentElement || doc.body).all; 135 var class_re = new RegExp('(^|\\s)' + className + '(\\s|$)'); 136 for(var i = 0; i < list.length; i++) if(list[i].className.match(class_re)) result[result.length] = list[i]; 137 return result; 126 138 }; 127 139 140 function startTimer() {timer = new Date().getTime();}; 141 function stopTimer(message) {return (new Date().getTime()) - timer;}; 142 128 143 </script> qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/drop_down.css.dtml
r511 r512 81 81 82 82 #portal-globalnav li.invisibleHeightKeeper { 83 visib le: none;83 visibility: hidden; 84 84 float: none; 85 85 } … … 94 94 95 95 #portal-globalnav .csshover ul li:hover ul a { 96 background-color: &dtml-backgroundColor; 96 background-color: &dtml-backgroundColor;; 97 97 } 98 98 … … 172 172 173 173 #portal-globalnav .csshover ul li:hover ul li a { 174 color: &dtml-globalFontColor !important;174 color: &dtml-globalFontColor; !important; 175 175 background-color: &dtml-backgroundColor; !important; 176 176 margin:0; … … 184 184 } 185 185 186 .kupu-fulleditor-zoomed #portal-globalnav { 187 display: none; 188 } 189 190 /*Configlet styles************************************************************/ 191 192 .ieVisible {display:none;} 193 194 * html .ieHidden {display: none;} 195 196 * html .ieVisible {display: block;} 197 198 186 199 /* </dtml-with> (do not remove this either :) */ qPloneDropDownMenu/trunk/skins/qPloneDropDownMenu/prefs_dropdownmenu_edit_form.cpt
r511 r512 38 38 action="." 39 39 method="post" 40 tal:attributes="action string:${here/ getId}/${template/getId}" >40 tal:attributes="action string:${here/absolute_url}/${template/getId}" > 41 41 42 42 <div class="formControls" align="right" qPloneDropDownMenu/trunk/version.txt
r511 r512 1 0.1. 91 0.1.11
