Version Description
- Fixed dropdown errors for IE7. Report any bugs with a screenshot please. Thanks.
Download this release
Release Info
Developer | mattsay |
Plugin | Dropdown Menu Widget |
Version | 1.3.4 |
Comparing to | |
See all releases |
Code changes from version 1.3.3 to 1.3.4
- csshover.htc +120 -0
- include.js +11 -0
- readme.txt +6 -3
- shailan.DropDownMenu.php +11 -2
csshover.htc
ADDED
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<attach event="ondocumentready" handler="parseStylesheets" />
|
2 |
+
<script>
|
3 |
+
/**
|
4 |
+
* Whatever:hover - V1.42.060206 - hover & active
|
5 |
+
* ------------------------------------------------------------
|
6 |
+
* (c) 2005 - Peter Nederlof
|
7 |
+
* Peterned - http://www.xs4all.nl/~peterned/
|
8 |
+
* License - http://creativecommons.org/licenses/LGPL/2.1/
|
9 |
+
*
|
10 |
+
* Whatever:hover is free software; you can redistribute it and/or
|
11 |
+
* modify it under the terms of the GNU Lesser General Public
|
12 |
+
* License as published by the Free Software Foundation; either
|
13 |
+
* version 2.1 of the License, or (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Whatever:hover is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
18 |
+
* Lesser General Public License for more details.
|
19 |
+
*
|
20 |
+
* Credits and thanks to:
|
21 |
+
* Arnoud Berendsen, Martin Reurings, Robert Hanson
|
22 |
+
*
|
23 |
+
* howto: body { behavior:url("csshover.htc"); }
|
24 |
+
* ------------------------------------------------------------
|
25 |
+
*/
|
26 |
+
|
27 |
+
var csshoverReg = /(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i,
|
28 |
+
currentSheet, doc = window.document, hoverEvents = [], activators = {
|
29 |
+
onhover:{on:'onmouseover', off:'onmouseout'},
|
30 |
+
onactive:{on:'onmousedown', off:'onmouseup'}
|
31 |
+
}
|
32 |
+
|
33 |
+
function parseStylesheets() {
|
34 |
+
if(!/MSIE (5|6)/.test(navigator.userAgent)) return;
|
35 |
+
window.attachEvent('onunload', unhookHoverEvents);
|
36 |
+
var sheets = doc.styleSheets, l = sheets.length;
|
37 |
+
for(var i=0; i<l; i++)
|
38 |
+
parseStylesheet(sheets[i]);
|
39 |
+
}
|
40 |
+
function parseStylesheet(sheet) {
|
41 |
+
if(sheet.imports) {
|
42 |
+
try {
|
43 |
+
var imports = sheet.imports, l = imports.length;
|
44 |
+
for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]);
|
45 |
+
} catch(securityException){}
|
46 |
+
}
|
47 |
+
|
48 |
+
try {
|
49 |
+
var rules = (currentSheet = sheet).rules, l = rules.length;
|
50 |
+
for(var j=0; j<l; j++) parseCSSRule(rules[j]);
|
51 |
+
} catch(securityException){}
|
52 |
+
}
|
53 |
+
|
54 |
+
function parseCSSRule(rule) {
|
55 |
+
var select = rule.selectorText, style = rule.style.cssText;
|
56 |
+
if(!csshoverReg.test(select) || !style) return;
|
57 |
+
|
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);
|
60 |
+
var className = (/\.([a-z0-9_-]*on(hover|active))/i).exec(newSelect)[1];
|
61 |
+
var affected = select.replace(/:(hover|active).*$/, '');
|
62 |
+
var elements = getElementsBySelect(affected);
|
63 |
+
if(elements.length == 0) return;
|
64 |
+
|
65 |
+
currentSheet.addRule(newSelect, style);
|
66 |
+
for(var i=0; i<elements.length; i++)
|
67 |
+
new HoverElement(elements[i], className, activators[pseudo]);
|
68 |
+
}
|
69 |
+
|
70 |
+
function HoverElement(node, className, events) {
|
71 |
+
if(!node.hovers) node.hovers = {};
|
72 |
+
if(node.hovers[className]) return;
|
73 |
+
node.hovers[className] = true;
|
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'),''); });
|
76 |
+
}
|
77 |
+
function hookHoverEvent(node, type, handler) {
|
78 |
+
node.attachEvent(type, handler);
|
79 |
+
hoverEvents[hoverEvents.length] = {
|
80 |
+
node:node, type:type, handler:handler
|
81 |
+
};
|
82 |
+
}
|
83 |
+
|
84 |
+
function unhookHoverEvents() {
|
85 |
+
for(var e,i=0; i<hoverEvents.length; i++) {
|
86 |
+
e = hoverEvents[i];
|
87 |
+
e.node.detachEvent(e.type, e.handler);
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
function getElementsBySelect(rule) {
|
92 |
+
var parts, nodes = [doc];
|
93 |
+
parts = rule.split(' ');
|
94 |
+
for(var i=0; i<parts.length; i++) {
|
95 |
+
nodes = getSelectedNodes(parts[i], nodes);
|
96 |
+
} return nodes;
|
97 |
+
}
|
98 |
+
function getSelectedNodes(select, elements) {
|
99 |
+
var result, node, nodes = [];
|
100 |
+
var identify = (/\#([a-z0-9_-]+)/i).exec(select);
|
101 |
+
if(identify) {
|
102 |
+
var element = doc.getElementById(identify[1]);
|
103 |
+
return element? [element]:nodes;
|
104 |
+
}
|
105 |
+
|
106 |
+
var classname = (/\.([a-z0-9_-]+)/i).exec(select);
|
107 |
+
var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');
|
108 |
+
var classReg = classname? new RegExp('\\b' + classname[1] + '\\b'):false;
|
109 |
+
for(var i=0; i<elements.length; i++) {
|
110 |
+
result = tagName? elements[i].all.tags(tagName):elements[i].all;
|
111 |
+
for(var j=0; j<result.length; j++) {
|
112 |
+
node = result[j];
|
113 |
+
if(classReg && !classReg.test(node.className)) continue;
|
114 |
+
nodes[nodes.length] = node;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
return nodes;
|
119 |
+
}
|
120 |
+
</script>
|
include.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Dom Ready
|
2 |
+
jQuery(document).ready(function($) {
|
3 |
+
|
4 |
+
// Dropdown menu support for IE
|
5 |
+
$('.dropdown li').hover(function(){
|
6 |
+
$(this).addClass('hover');
|
7 |
+
}, function(){
|
8 |
+
$(this).removeClass('hover');
|
9 |
+
});
|
10 |
+
|
11 |
+
});
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: mattsay
|
3 |
Donate link: http://shailan.com/donate
|
4 |
Tags: css, dropdown, menu, widget, pages, categories
|
5 |
-
Requires at least: 2.
|
6 |
-
Tested up to: 2.9.
|
7 |
-
Stable tag: 1.3.
|
8 |
|
9 |
This widget adds a beatiful vertical/horizontal CSS only dropdown menu of pages OR categories of your blog.
|
10 |
|
@@ -48,6 +48,9 @@ You can submit errors and bugs using the [online form](http://shailan.com/contac
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
51 |
= 1.3.3 =
|
52 |
* Fixed function name collisions with "Exclude Pages" plugin. The plugin is fully functional now.
|
53 |
|
2 |
Contributors: mattsay
|
3 |
Donate link: http://shailan.com/donate
|
4 |
Tags: css, dropdown, menu, widget, pages, categories
|
5 |
+
Requires at least: 2.8
|
6 |
+
Tested up to: 2.9.2
|
7 |
+
Stable tag: 1.3.4
|
8 |
|
9 |
This widget adds a beatiful vertical/horizontal CSS only dropdown menu of pages OR categories of your blog.
|
10 |
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.3.4 =
|
52 |
+
* Fixed dropdown errors for IE7. Report any bugs with a screenshot please. Thanks.
|
53 |
+
|
54 |
= 1.3.3 =
|
55 |
* Fixed function name collisions with "Exclude Pages" plugin. The plugin is fully functional now.
|
56 |
|
shailan.DropDownMenu.php
CHANGED
@@ -3,13 +3,13 @@
|
|
3 |
Plugin Name: Shailan Dropdown Menu Widget
|
4 |
Plugin URI: http://shailan.com/wordpress/plugins/dropdown-menu
|
5 |
Description: A multi widget to generate drop-down menus from your pages and categories. This widget is best used in <a href="http://shailan.com">Shailan.com</a> themes. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
|
6 |
-
Version: 1.3.
|
7 |
Author: Matt Say
|
8 |
Author URI: http://shailan.com
|
9 |
Text Domain: shailan-dropdown-menu
|
10 |
*/
|
11 |
|
12 |
-
define('SHAILAN_DM_VERSION','1.3.
|
13 |
define('SHAILAN_DM_TITLE', 'Dropdown Menu');
|
14 |
define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
|
15 |
|
@@ -26,6 +26,8 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
26 |
// if ( is_active_widget(false, false, $this->id_base) )
|
27 |
// @shailan: disabled for the_widget support.
|
28 |
add_action( 'wp_head', array(&$this, 'styles') );
|
|
|
|
|
29 |
}
|
30 |
|
31 |
// Add settings page
|
@@ -323,6 +325,7 @@ Please support if you like this plugin:
|
|
323 |
|
324 |
echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/shailan-dropdown.css" type="text/css" />';
|
325 |
|
|
|
326 |
if($theme!='NONE'){
|
327 |
echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/themes/'.$theme.'.css" type="text/css" />';
|
328 |
}
|
@@ -334,6 +337,12 @@ Please support if you like this plugin:
|
|
334 |
echo ' ul.dropdown {font-family: '.$font_family.' font-size:'.$font_size.'; }';
|
335 |
echo '</style>';
|
336 |
|
|
|
|
|
|
|
|
|
|
|
|
|
337 |
}
|
338 |
|
339 |
} // class shailan_DropdownWidget
|
3 |
Plugin Name: Shailan Dropdown Menu Widget
|
4 |
Plugin URI: http://shailan.com/wordpress/plugins/dropdown-menu
|
5 |
Description: A multi widget to generate drop-down menus from your pages and categories. This widget is best used in <a href="http://shailan.com">Shailan.com</a> themes. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
|
6 |
+
Version: 1.3.4
|
7 |
Author: Matt Say
|
8 |
Author URI: http://shailan.com
|
9 |
Text Domain: shailan-dropdown-menu
|
10 |
*/
|
11 |
|
12 |
+
define('SHAILAN_DM_VERSION','1.3.4');
|
13 |
define('SHAILAN_DM_TITLE', 'Dropdown Menu');
|
14 |
define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
|
15 |
|
26 |
// if ( is_active_widget(false, false, $this->id_base) )
|
27 |
// @shailan: disabled for the_widget support.
|
28 |
add_action( 'wp_head', array(&$this, 'styles') );
|
29 |
+
|
30 |
+
wp_enqueue_script( 'dropdown-ie-support', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/include.js', 'jQuery' );
|
31 |
}
|
32 |
|
33 |
// Add settings page
|
325 |
|
326 |
echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/shailan-dropdown.css" type="text/css" />';
|
327 |
|
328 |
+
|
329 |
if($theme!='NONE'){
|
330 |
echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/themes/'.$theme.'.css" type="text/css" />';
|
331 |
}
|
337 |
echo ' ul.dropdown {font-family: '.$font_family.' font-size:'.$font_size.'; }';
|
338 |
echo '</style>';
|
339 |
|
340 |
+
echo '<!--[if lte IE 7]>';
|
341 |
+
echo '<style type="text/css" media="screen">';
|
342 |
+
echo 'body { behavior:url("'.WP_PLUGIN_URL.'/'.SHAILAN_DM_FOLDER.'/csshover.htc"); }';
|
343 |
+
echo '</style>';
|
344 |
+
echo '<![endif]-->';
|
345 |
+
|
346 |
}
|
347 |
|
348 |
} // class shailan_DropdownWidget
|