##// END OF EJS Templates
Fixed: context submenus on the issue list don't show up with IE6....
Jean-Philippe Lang -
r1011:7f3c5169400f
parent child
Show More
@@ -1,52 +1,52
1 #context-menu { position: absolute; z-index: 10;}
1 #context-menu { position: absolute; z-index: 10;}
2
2
3 #context-menu ul, #context-menu li, #context-menu a {
3 #context-menu ul, #context-menu li, #context-menu a {
4 display:block;
4 display:block;
5 margin:0;
5 margin:0;
6 padding:0;
6 padding:0;
7 border:0;
7 border:0;
8 }
8 }
9
9
10 #context-menu ul {
10 #context-menu ul {
11 width:150px;
11 width:150px;
12 border-top:1px solid #ddd;
12 border-top:1px solid #ddd;
13 border-left:1px solid #ddd;
13 border-left:1px solid #ddd;
14 border-bottom:1px solid #777;
14 border-bottom:1px solid #777;
15 border-right:1px solid #777;
15 border-right:1px solid #777;
16 background:white;
16 background:white;
17 list-style:none;
17 list-style:none;
18 }
18 }
19
19
20 #context-menu li {
20 #context-menu li {
21 position:relative;
21 position:relative;
22 padding:1px;
22 padding:1px;
23 z-index:9;
23 z-index:9;
24 }
24 }
25 #context-menu li.folder ul {
25 #context-menu li.folder ul {
26 position:absolute;
26 position:absolute;
27 left:128px; /* IE */
27 left:168px; /* IE6 */
28 top:-2px;
28 top:-2px;
29 }
29 }
30 #context-menu li.folder>ul { left:148px; }
30 #context-menu li.folder>ul { left:148px; }
31
31
32 #context-menu a {
32 #context-menu a {
33 border:1px solid white;
33 border:1px solid white;
34 text-decoration:none;
34 text-decoration:none;
35 background-repeat: no-repeat;
35 background-repeat: no-repeat;
36 background-position: 1px 50%;
36 background-position: 1px 50%;
37 padding: 2px 0px 2px 20px;
37 padding: 2px 0px 2px 20px;
38 width:100%; /* IE */
38 width:100%; /* IE */
39 }
39 }
40 #context-menu li>a { width:auto; } /* others */
40 #context-menu li>a { width:auto; } /* others */
41 #context-menu a.disabled, #context-menu a.disabled:hover {color: #ccc;}
41 #context-menu a.disabled, #context-menu a.disabled:hover {color: #ccc;}
42 #context-menu li a.submenu { background:url("../images/sub.gif") right no-repeat; }
42 #context-menu li a.submenu { background:url("../images/sub.gif") right no-repeat; }
43 #context-menu a:hover { border-color:gray; background-color:#eee; color:#2A5685; }
43 #context-menu a:hover { border-color:gray; background-color:#eee; color:#2A5685; }
44 #context-menu li.folder a:hover { background-color:#eee; }
44 #context-menu li.folder a:hover { background-color:#eee; }
45 #context-menu li.folder:hover { z-index:10; }
45 #context-menu li.folder:hover { z-index:10; }
46 #context-menu ul ul, #context-menu li:hover ul ul { display:none; }
46 #context-menu ul ul, #context-menu li:hover ul ul { display:none; }
47 #context-menu li:hover ul, #context-menu li:hover li:hover ul { display:block; }
47 #context-menu li:hover ul, #context-menu li:hover li:hover ul { display:block; }
48
48
49 /* selected element */
49 /* selected element */
50 .context-menu-selection { background-color:#507AAA !important; color:#f8f8f8 !important; }
50 .context-menu-selection { background-color:#507AAA !important; color:#f8f8f8 !important; }
51 .context-menu-selection a, .context-menu-selection a:hover { color:#f8f8f8 !important; }
51 .context-menu-selection a, .context-menu-selection a:hover { color:#f8f8f8 !important; }
52 .context-menu-selection:hover { background-color:#507AAA !important; color:#f8f8f8 !important; }
52 .context-menu-selection:hover { background-color:#507AAA !important; color:#f8f8f8 !important; }
@@ -1,120 +1,122
1 <attach event="ondocumentready" handler="parseStylesheets" />
1 <attach event="ondocumentready" handler="parseStylesheets" />
2 <script>
2 <script>
3 /**
3 /**
4 * Whatever:hover - V1.42.060206 - hover & active
4 * Whatever:hover - V1.42.060206 - hover & active
5 * ------------------------------------------------------------
5 * ------------------------------------------------------------
6 * (c) 2005 - Peter Nederlof
6 * (c) 2005 - Peter Nederlof
7 * Peterned - http://www.xs4all.nl/~peterned/
7 * Peterned - http://www.xs4all.nl/~peterned/
8 * License - http://creativecommons.org/licenses/LGPL/2.1/
8 * License - http://creativecommons.org/licenses/LGPL/2.1/
9 *
9 *
10 * Whatever:hover is free software; you can redistribute it and/or
10 * Whatever:hover is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
13 * version 2.1 of the License, or (at your option) any later version.
14 *
14 *
15 * Whatever:hover is distributed in the hope that it will be useful,
15 * Whatever:hover is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
18 * Lesser General Public License for more details.
19 *
19 *
20 * Credits and thanks to:
20 * Credits and thanks to:
21 * Arnoud Berendsen, Martin Reurings, Robert Hanson
21 * Arnoud Berendsen, Martin Reurings, Robert Hanson
22 *
22 *
23 * howto: body { behavior:url("csshover.htc"); }
23 * howto: body { behavior:url("csshover.htc"); }
24 * ------------------------------------------------------------
24 * ------------------------------------------------------------
25 */
25 */
26
26
27 var csshoverReg = /(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i,
27 var csshoverReg = /(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i,
28 currentSheet, doc = window.document, hoverEvents = [], activators = {
28 currentSheet, doc = window.document, hoverEvents = [], activators = {
29 onhover:{on:'onmouseover', off:'onmouseout'},
29 onhover:{on:'onmouseover', off:'onmouseout'},
30 onactive:{on:'onmousedown', off:'onmouseup'}
30 onactive:{on:'onmousedown', off:'onmouseup'}
31 }
31 }
32
32
33 function parseStylesheets() {
33 function parseStylesheets() {
34 if(!/MSIE (5|6)/.test(navigator.userAgent)) return;
34 if(!/MSIE (5|6)/.test(navigator.userAgent)) return;
35 window.attachEvent('onunload', unhookHoverEvents);
35 window.attachEvent('onunload', unhookHoverEvents);
36 var sheets = doc.styleSheets, l = sheets.length;
36 var sheets = doc.styleSheets, l = sheets.length;
37 for(var i=0; i<l; i++)
37 for(var i=0; i<l; i++)
38 parseStylesheet(sheets[i]);
38 parseStylesheet(sheets[i]);
39 }
39 }
40 function parseStylesheet(sheet) {
40 function parseStylesheet(sheet) {
41 if(sheet.imports) {
41 if(sheet.imports) {
42 try {
42 try {
43 var imports = sheet.imports, l = imports.length;
43 var imports = sheet.imports, l = imports.length;
44 for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]);
44 for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]);
45 } catch(securityException){}
45 } catch(securityException){}
46 }
46 }
47
47
48 try {
48 try {
49 var rules = (currentSheet = sheet).rules, l = rules.length;
49 var rules = (currentSheet = sheet).rules, l = rules.length;
50 for(var j=0; j<l; j++) parseCSSRule(rules[j]);
50 for(var j=0; j<l; j++) parseCSSRule(rules[j]);
51 } catch(securityException){}
51 } catch(securityException){}
52 }
52 }
53
53
54 function parseCSSRule(rule) {
54 function parseCSSRule(rule) {
55 var select = rule.selectorText, style = rule.style.cssText;
55 var select = rule.selectorText, style = rule.style.cssText;
56 if(!csshoverReg.test(select) || !style) return;
56 if(!csshoverReg.test(select) || !style) return;
57
57
58 var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1');
58 var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1');
59 var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo);
59 var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo);
60 var className = (/\.([a-z0-9_-]*on(hover|active))/i).exec(newSelect)[1];
60 var className = (/\.([a-z0-9_-]*on(hover|active))/i).exec(newSelect)[1];
61 var affected = select.replace(/:(hover|active).*$/, '');
61 var affected = select.replace(/:(hover|active).*$/, '');
62 var elements = getElementsBySelect(affected);
62 var elements = getElementsBySelect(affected);
63 if(elements.length == 0) return;
63 if(elements.length == 0) return;
64
64
65 currentSheet.addRule(newSelect, style);
65 currentSheet.addRule(newSelect, style);
66 for(var i=0; i<elements.length; i++)
66 for(var i=0; i<elements.length; i++)
67 new HoverElement(elements[i], className, activators[pseudo]);
67 new HoverElement(elements[i], className, activators[pseudo]);
68 }
68 }
69
69
70 function HoverElement(node, className, events) {
70 function HoverElement(node, className, events) {
71 if(!node.hovers) node.hovers = {};
71 if(!node.hovers) node.hovers = {};
72 if(node.hovers[className]) return;
72 if(node.hovers[className]) return;
73 node.hovers[className] = true;
73 node.hovers[className] = true;
74 hookHoverEvent(node, events.on, function() { node.className += ' ' + className; });
74 hookHoverEvent(node, events.on, function() { node.className += ' ' + className; });
75 hookHoverEvent(node, events.off, function() { node.className = node.className.replace(new RegExp('\\s+'+className, 'g'),''); });
75 hookHoverEvent(node, events.off, function() { node.className = node.className.replace(new RegExp('\\s+'+className, 'g'),''); });
76 }
76 }
77 function hookHoverEvent(node, type, handler) {
77 function hookHoverEvent(node, type, handler) {
78 node.attachEvent(type, handler);
78 node.attachEvent(type, handler);
79 hoverEvents[hoverEvents.length] = {
79 hoverEvents[hoverEvents.length] = {
80 node:node, type:type, handler:handler
80 node:node, type:type, handler:handler
81 };
81 };
82 }
82 }
83
83
84 function unhookHoverEvents() {
84 function unhookHoverEvents() {
85 for(var e,i=0; i<hoverEvents.length; i++) {
85 for(var e,i=0; i<hoverEvents.length; i++) {
86 e = hoverEvents[i];
86 e = hoverEvents[i];
87 e.node.detachEvent(e.type, e.handler);
87 e.node.detachEvent(e.type, e.handler);
88 }
88 }
89 }
89 }
90
90
91 function getElementsBySelect(rule) {
91 function getElementsBySelect(rule) {
92 var parts, nodes = [doc];
92 var parts, nodes = [doc];
93 parts = rule.split(' ');
93 parts = rule.split(' ');
94 for(var i=0; i<parts.length; i++) {
94 for(var i=0; i<parts.length; i++) {
95 nodes = getSelectedNodes(parts[i], nodes);
95 nodes = getSelectedNodes(parts[i], nodes);
96 } return nodes;
96 } return nodes;
97 }
97 }
98 function getSelectedNodes(select, elements) {
98 function getSelectedNodes(select, elements) {
99 var result, node, nodes = [];
99 var result, node, nodes = [];
100 var identify = (/\#([a-z0-9_-]+)/i).exec(select);
100 var identify = (/\#([a-z0-9_-]+)/i).exec(select);
101 if(identify) {
101 if(identify) {
102 var element = doc.getElementById(identify[1]);
102 var element = doc.getElementById(identify[1]);
103 return element? [element]:nodes;
103 return element? [element]:nodes;
104 }
104 }
105
105
106 var classname = (/\.([a-z0-9_-]+)/i).exec(select);
106 var classname = (/\.([a-z0-9_-]+)/i).exec(select);
107 var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');
107 var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');
108 var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false;
108 var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false;
109 for(var i=0; i<elements.length; i++) {
109 for(var i=0; i<elements.length; i++) {
110 result = tagName? elements[i].all.tags(tagName):elements[i].all;
110 result = tagName? elements[i].all.tags(tagName):elements[i].all;
111 for(var j=0; j<result.length; j++) {
111 for(var j=0; j<result.length; j++) {
112 node = result[j];
112 node = result[j];
113 if(classReg && !classReg.test(node.className)) continue;
113 if(classReg && !classReg.test(node.className)) continue;
114 nodes[nodes.length] = node;
114 nodes[nodes.length] = node;
115 }
115 }
116 }
116 }
117
117
118 return nodes;
118 return nodes;
119 }
119 }
120
121 window.parseStylesheets = parseStylesheets;
120 </script> No newline at end of file
122 </script>
General Comments 0
You need to be logged in to leave comments. Login now