Version Description
- Added option to show title on widget.
- Added capability to find dropdown.css on your theme folder.
- Added jQuery dropdown effects.
- Added remove title attributes option.
- Added remove links from top level option.
- Many more to come..
Download this release
Release Info
Developer | mattsay |
Plugin | Dropdown Menu Widget |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.8 to 1.6
- admin.css → css/admin.css +6 -1
- shailan-dropdown-old.css → css/shailan-dropdown-old.css +0 -0
- css/shailan-dropdown.css +42 -0
- js/admin.js +1 -1
- js/hoverIntent.js +84 -0
- js/include-test.js +9 -0
- js/include.js +1 -0
- js/jquery.bgiframe.min.js +10 -0
- js/superfish.js +121 -0
- js/supersubs.js +90 -0
- js/widgets.js +4 -0
- options-page.php +12 -16
- readme.txt +11 -3
- shailan-dropdown.css +0 -39
- shailan.DropDownMenu.php +206 -79
admin.css → css/admin.css
RENAMED
@@ -1,5 +1,7 @@
|
|
1 |
/** Dropdown Menu Widget Admin Styles */
|
2 |
.shailan_dm_input{padding:10px;}
|
|
|
|
|
3 |
.shailan_dm_input small{font-style:italic; font-size:smaller; color:#666;}
|
4 |
.shailan_dm_input label{ font-size:12px;
|
5 |
width:200px;
|
@@ -25,4 +27,7 @@
|
|
25 |
.sidebar-name span{float:right;}
|
26 |
|
27 |
input.selected{border:1px solid #f93}
|
28 |
-
input.color-error{border:1px solid #f00;}
|
|
|
|
|
|
1 |
/** Dropdown Menu Widget Admin Styles */
|
2 |
.shailan_dm_input{padding:10px;}
|
3 |
+
.shailan_dm_input.shailan_dm_paragraph{ background: #ddd; padding:10px; }
|
4 |
+
.shailan_dm_paragraph p{ margin:0; line-height:1.5em; }
|
5 |
.shailan_dm_input small{font-style:italic; font-size:smaller; color:#666;}
|
6 |
.shailan_dm_input label{ font-size:12px;
|
7 |
width:200px;
|
27 |
.sidebar-name span{float:right;}
|
28 |
|
29 |
input.selected{border:1px solid #f93}
|
30 |
+
input.color-error{border:1px solid #f00;}
|
31 |
+
|
32 |
+
#widgets-right .shailan-dropdown, #widgets-left .shailan-dropdown .widget-top{ border-color: #F90; }
|
33 |
+
#widgets-right .shailan-dropdown-multi, #widgets-left .shailan-dropdown-multi .widget-top{ border-color: #F90; }
|
shailan-dropdown-old.css → css/shailan-dropdown-old.css
RENAMED
File without changes
|
css/shailan-dropdown.css
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Reset */
|
2 |
+
div.shailan-dropdown-menu table, div.shailan-dropdown-menu tbody, div.shailan-dropdown-menu tr, div.shailan-dropdown-menu td, div.shailan-dropdown-menu ul, div.shailan-dropdown-menu li, div.dropdown-horizontal-container, ul.dropdown * { margin:0; padding:0; border:0; }
|
3 |
+
|
4 |
+
.dropdown-horizontal-container{ width:100%; }
|
5 |
+
|
6 |
+
/* Remove list styling */
|
7 |
+
ul.dropdown, ul.dropdown li, ul.dropdown ul { list-style: none; margin: 0; padding: 0; }
|
8 |
+
|
9 |
+
/* Z-index */
|
10 |
+
ul.dropdown, ul.dropdown li, ul.dropdown ul li, ul.dropdown li.hover, ul.dropdown li:hover { position: relative; }
|
11 |
+
ul.dropdown li { /*z-index: 598;*/ }
|
12 |
+
ul.dropdown ul { position:absolute; z-index: 597; }
|
13 |
+
ul.dropdown ul li { z-index: 598; }
|
14 |
+
|
15 |
+
ul.dropdown li.hover, ul.dropdown li:hover{ cursor: default; }
|
16 |
+
|
17 |
+
/* Top level */
|
18 |
+
ul.dropdown li { display:inline; vertical-align: middle; zoom:1; }
|
19 |
+
ul.dropdown > li { float:left; }
|
20 |
+
ul.dropdown li a{ padding: .3em .8em; }
|
21 |
+
|
22 |
+
/* Sub levels */
|
23 |
+
ul.dropdown ul { position: absolute; top: 100%; left: 0; }
|
24 |
+
ul.dropdown ul li { float: none; display: list-item; list-style: none; }
|
25 |
+
|
26 |
+
ul.dropdown ul ul { top: 1px; left: 99%; }
|
27 |
+
ul.dropdown a:active, ul.dropdown a:focus { outline-style:none; }
|
28 |
+
|
29 |
+
* html ul.dropdown li { height: 1px; }
|
30 |
+
|
31 |
+
/* IE Submenu margin fix */
|
32 |
+
ul.dropdown ul li, ul.dropdown-vertical { margin-left: -16px; mar\gin-left: 0; }
|
33 |
+
|
34 |
+
/* Hide submenus */
|
35 |
+
ul.dropdown ul, ul.dropdown li.hover ul ul, ul.dropdown li.hover ul ul ul, ul.dropdown li.hover ul ul ul ul, ul.dropdown li.hover ul ul ul ul ul, ul.dropdown ul, ul.dropdown li:hover ul ul, ul.dropdown li:hover ul ul ul, ul.dropdown li:hover ul ul ul ul, ul.dropdown li:hover ul ul ul ul ul { display: none; }
|
36 |
+
|
37 |
+
ul.dropdown ul ul ul ul ul ul { display: none !important; }
|
38 |
+
|
39 |
+
/* Vertical menu support */
|
40 |
+
ul.dropdown-vertical { /*width: 240px;*/ }
|
41 |
+
ul.dropdown-vertical ul { top: 1px; left: 99%; }
|
42 |
+
ul.dropdown-vertical li { float: none; }
|
js/admin.js
CHANGED
@@ -6,7 +6,7 @@ function pickColor(obj, color) {
|
|
6 |
}
|
7 |
|
8 |
jQuery(document).ready(function() {
|
9 |
-
|
10 |
var f = jQuery.farbtastic('#picker');
|
11 |
var p = jQuery('#picker').fadeOut();
|
12 |
var selected;
|
6 |
}
|
7 |
|
8 |
jQuery(document).ready(function() {
|
9 |
+
|
10 |
var f = jQuery.farbtastic('#picker');
|
11 |
var p = jQuery('#picker').fadeOut();
|
12 |
var selected;
|
js/hoverIntent.js
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
/* hoverIntent by Brian Cherne */
|
3 |
+
$.fn.hoverIntent = function(f,g) {
|
4 |
+
// default configuration options
|
5 |
+
var cfg = {
|
6 |
+
sensitivity: 7,
|
7 |
+
interval: 100,
|
8 |
+
timeout: 0
|
9 |
+
};
|
10 |
+
// override configuration options with user supplied object
|
11 |
+
cfg = $.extend(cfg, g ? { over: f, out: g } : f );
|
12 |
+
|
13 |
+
// instantiate variables
|
14 |
+
// cX, cY = current X and Y position of mouse, updated by mousemove event
|
15 |
+
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
|
16 |
+
var cX, cY, pX, pY;
|
17 |
+
|
18 |
+
// A private function for getting mouse position
|
19 |
+
var track = function(ev) {
|
20 |
+
cX = ev.pageX;
|
21 |
+
cY = ev.pageY;
|
22 |
+
};
|
23 |
+
|
24 |
+
// A private function for comparing current and previous mouse position
|
25 |
+
var compare = function(ev,ob) {
|
26 |
+
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
27 |
+
// compare mouse positions to see if they've crossed the threshold
|
28 |
+
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
|
29 |
+
$(ob).unbind("mousemove",track);
|
30 |
+
// set hoverIntent state to true (so mouseOut can be called)
|
31 |
+
ob.hoverIntent_s = 1;
|
32 |
+
return cfg.over.apply(ob,[ev]);
|
33 |
+
} else {
|
34 |
+
// set previous coordinates for next time
|
35 |
+
pX = cX; pY = cY;
|
36 |
+
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
|
37 |
+
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
|
38 |
+
}
|
39 |
+
};
|
40 |
+
|
41 |
+
// A private function for delaying the mouseOut function
|
42 |
+
var delay = function(ev,ob) {
|
43 |
+
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
|
44 |
+
ob.hoverIntent_s = 0;
|
45 |
+
return cfg.out.apply(ob,[ev]);
|
46 |
+
};
|
47 |
+
|
48 |
+
// A private function for handling mouse 'hovering'
|
49 |
+
var handleHover = function(e) {
|
50 |
+
// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
|
51 |
+
var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
|
52 |
+
while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
|
53 |
+
if ( p == this ) { return false; }
|
54 |
+
|
55 |
+
// copy objects to be passed into t (required for event object to be passed in IE)
|
56 |
+
var ev = jQuery.extend({},e);
|
57 |
+
var ob = this;
|
58 |
+
|
59 |
+
// cancel hoverIntent timer if it exists
|
60 |
+
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
|
61 |
+
|
62 |
+
// else e.type == "onmouseover"
|
63 |
+
if (e.type == "mouseover") {
|
64 |
+
// set "previous" X and Y position based on initial entry point
|
65 |
+
pX = ev.pageX; pY = ev.pageY;
|
66 |
+
// update "current" X and Y position based on mousemove
|
67 |
+
$(ob).bind("mousemove",track);
|
68 |
+
// start polling interval (self-calling timeout) to compare mouse coordinates over time
|
69 |
+
if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
|
70 |
+
|
71 |
+
// else e.type == "onmouseout"
|
72 |
+
} else {
|
73 |
+
// unbind expensive mousemove event
|
74 |
+
$(ob).unbind("mousemove",track);
|
75 |
+
// if hoverIntent state is true, then call the mouseOut function after the specified delay
|
76 |
+
if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
|
77 |
+
}
|
78 |
+
};
|
79 |
+
|
80 |
+
// bind the function to the two event listeners
|
81 |
+
return this.mouseover(handleHover).mouseout(handleHover);
|
82 |
+
};
|
83 |
+
|
84 |
+
})(jQuery);
|
js/include-test.js
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Dom Ready
|
2 |
+
jQuery(document).ready(function($) {
|
3 |
+
// Dropdown menu support for IE
|
4 |
+
$('.dropdown li').hover(function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover'); });
|
5 |
+
// Add child classes to lists
|
6 |
+
$('ul li:first-child').addClass('first-child'); $('ul li:last-child').addClass('last-child');
|
7 |
+
|
8 |
+
// $('ul.children').parent().find('a:first').removeAttr('href');
|
9 |
+
});
|
js/include.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
jQuery(document).ready(function($) {
|
3 |
// Dropdown menu support for IE
|
4 |
$('.dropdown li').hover(function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover'); });
|
|
|
5 |
// Add child classes to lists
|
6 |
$('ul li:first-child').addClass('first-child'); $('ul li:last-child').addClass('last-child');
|
7 |
});
|
2 |
jQuery(document).ready(function($) {
|
3 |
// Dropdown menu support for IE
|
4 |
$('.dropdown li').hover(function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover'); });
|
5 |
+
$(".dropdown li:has(ul)").addClass("parent");
|
6 |
// Add child classes to lists
|
7 |
$('ul li:first-child').addClass('first-child'); $('ul li:last-child').addClass('last-child');
|
8 |
});
|
js/jquery.bgiframe.min.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
|
2 |
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
3 |
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
4 |
+
*
|
5 |
+
* $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $
|
6 |
+
* $Rev: 2111 $
|
7 |
+
*
|
8 |
+
* Version 2.1
|
9 |
+
*/
|
10 |
+
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);
|
js/superfish.js
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
/*
|
3 |
+
* Superfish v1.4.8 - jQuery menu widget
|
4 |
+
* Copyright (c) 2008 Joel Birch
|
5 |
+
*
|
6 |
+
* Dual licensed under the MIT and GPL licenses:
|
7 |
+
* http://www.opensource.org/licenses/mit-license.php
|
8 |
+
* http://www.gnu.org/licenses/gpl.html
|
9 |
+
*
|
10 |
+
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
|
11 |
+
*/
|
12 |
+
|
13 |
+
;(function($){
|
14 |
+
$.fn.superfish = function(op){
|
15 |
+
|
16 |
+
var sf = $.fn.superfish,
|
17 |
+
c = sf.c,
|
18 |
+
$arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')),
|
19 |
+
over = function(){
|
20 |
+
var $$ = $(this), menu = getMenu($$);
|
21 |
+
clearTimeout(menu.sfTimer);
|
22 |
+
$$.showSuperfishUl().siblings().hideSuperfishUl();
|
23 |
+
},
|
24 |
+
out = function(){
|
25 |
+
var $$ = $(this), menu = getMenu($$), o = sf.op;
|
26 |
+
clearTimeout(menu.sfTimer);
|
27 |
+
menu.sfTimer=setTimeout(function(){
|
28 |
+
o.retainPath=($.inArray($$[0],o.$path)>-1);
|
29 |
+
$$.hideSuperfishUl();
|
30 |
+
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
|
31 |
+
},o.delay);
|
32 |
+
},
|
33 |
+
getMenu = function($menu){
|
34 |
+
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
|
35 |
+
sf.op = sf.o[menu.serial];
|
36 |
+
return menu;
|
37 |
+
},
|
38 |
+
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
|
39 |
+
|
40 |
+
return this.each(function() {
|
41 |
+
var s = this.serial = sf.o.length;
|
42 |
+
var o = $.extend({},sf.defaults,op);
|
43 |
+
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
|
44 |
+
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
|
45 |
+
.filter('li:has(ul)').removeClass(o.pathClass);
|
46 |
+
});
|
47 |
+
sf.o[s] = sf.op = o;
|
48 |
+
|
49 |
+
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
|
50 |
+
if (o.autoArrows) addArrow( $('>a:first-child',this) );
|
51 |
+
})
|
52 |
+
.not('.'+c.bcClass)
|
53 |
+
.hideSuperfishUl();
|
54 |
+
|
55 |
+
var $a = $('a',this);
|
56 |
+
$a.each(function(i){
|
57 |
+
var $li = $a.eq(i).parents('li');
|
58 |
+
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
|
59 |
+
});
|
60 |
+
o.onInit.call(this);
|
61 |
+
|
62 |
+
}).each(function() {
|
63 |
+
menuClasses = [c.menuClass];
|
64 |
+
if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
|
65 |
+
$(this).addClass(menuClasses.join(' '));
|
66 |
+
});
|
67 |
+
};
|
68 |
+
|
69 |
+
var sf = $.fn.superfish;
|
70 |
+
sf.o = [];
|
71 |
+
sf.op = {};
|
72 |
+
sf.IE7fix = function(){
|
73 |
+
var o = sf.op;
|
74 |
+
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
|
75 |
+
this.toggleClass(sf.c.shadowClass+'-off');
|
76 |
+
};
|
77 |
+
sf.c = {
|
78 |
+
bcClass : 'sf-breadcrumb',
|
79 |
+
menuClass : 'sf-js-enabled',
|
80 |
+
anchorClass : 'sf-with-ul',
|
81 |
+
arrowClass : 'sf-sub-indicator',
|
82 |
+
shadowClass : 'sf-shadow'
|
83 |
+
};
|
84 |
+
sf.defaults = {
|
85 |
+
hoverClass : 'sfHover',
|
86 |
+
pathClass : 'overideThisToUse',
|
87 |
+
pathLevels : 1,
|
88 |
+
delay : 800,
|
89 |
+
animation : {opacity:'show'},
|
90 |
+
speed : 'normal',
|
91 |
+
autoArrows : true,
|
92 |
+
dropShadows : true,
|
93 |
+
disableHI : false, // true disables hoverIntent detection
|
94 |
+
onInit : function(){}, // callback functions
|
95 |
+
onBeforeShow: function(){},
|
96 |
+
onShow : function(){},
|
97 |
+
onHide : function(){}
|
98 |
+
};
|
99 |
+
$.fn.extend({
|
100 |
+
hideSuperfishUl : function(){
|
101 |
+
var o = sf.op,
|
102 |
+
not = (o.retainPath===true) ? o.$path : '';
|
103 |
+
o.retainPath = false;
|
104 |
+
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
|
105 |
+
.find('>ul').hide().css('visibility','hidden');
|
106 |
+
o.onHide.call($ul);
|
107 |
+
return this;
|
108 |
+
},
|
109 |
+
showSuperfishUl : function(){
|
110 |
+
var o = sf.op,
|
111 |
+
sh = sf.c.shadowClass+'-off',
|
112 |
+
$ul = this.addClass(o.hoverClass)
|
113 |
+
.find('>ul:hidden').css('visibility','visible');
|
114 |
+
sf.IE7fix.call($ul);
|
115 |
+
o.onBeforeShow.call($ul);
|
116 |
+
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
|
117 |
+
return this;
|
118 |
+
}
|
119 |
+
});
|
120 |
+
|
121 |
+
})(jQuery);
|
js/supersubs.js
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
/*
|
3 |
+
* Supersubs v0.2b - jQuery plugin
|
4 |
+
* Copyright (c) 2008 Joel Birch
|
5 |
+
*
|
6 |
+
* Dual licensed under the MIT and GPL licenses:
|
7 |
+
* http://www.opensource.org/licenses/mit-license.php
|
8 |
+
* http://www.gnu.org/licenses/gpl.html
|
9 |
+
*
|
10 |
+
*
|
11 |
+
* This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
|
12 |
+
* their longest list item children. If you use this, please expect bugs and report them
|
13 |
+
* to the jQuery Google Group with the word 'Superfish' in the subject line.
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
|
17 |
+
;(function($){ // $ will refer to jQuery within this closure
|
18 |
+
|
19 |
+
$.fn.supersubs = function(options){
|
20 |
+
var opts = $.extend({}, $.fn.supersubs.defaults, options);
|
21 |
+
// return original object to support chaining
|
22 |
+
return this.each(function() {
|
23 |
+
// cache selections
|
24 |
+
var $$ = $(this);
|
25 |
+
// support metadata
|
26 |
+
var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
|
27 |
+
// get the font size of menu.
|
28 |
+
// .css('fontSize') returns various results cross-browser, so measure an em dash instead
|
29 |
+
var fontsize = $('<li id="menu-fontsize">—</li>').css({
|
30 |
+
'padding' : 0,
|
31 |
+
'position' : 'absolute',
|
32 |
+
'top' : '-999em',
|
33 |
+
'width' : 'auto'
|
34 |
+
}).appendTo($$).width(); //clientWidth is faster, but was incorrect here
|
35 |
+
// remove em dash
|
36 |
+
$('#menu-fontsize').remove();
|
37 |
+
// cache all ul elements
|
38 |
+
$ULs = $$.find('ul');
|
39 |
+
// loop through each ul in menu
|
40 |
+
$ULs.each(function(i) {
|
41 |
+
// cache this ul
|
42 |
+
var $ul = $ULs.eq(i);
|
43 |
+
// get all (li) children of this ul
|
44 |
+
var $LIs = $ul.children();
|
45 |
+
// get all anchor grand-children
|
46 |
+
var $As = $LIs.children('a');
|
47 |
+
// force content to one line and save current float property
|
48 |
+
var liFloat = $LIs.css('white-space','nowrap').css('float');
|
49 |
+
// remove width restrictions and floats so elements remain vertically stacked
|
50 |
+
var emWidth = $ul.add($LIs).add($As).css({
|
51 |
+
'float' : 'none',
|
52 |
+
'width' : 'auto'
|
53 |
+
})
|
54 |
+
// this ul will now be shrink-wrapped to longest li due to position:absolute
|
55 |
+
// so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
|
56 |
+
.end().end()[0].clientWidth / fontsize;
|
57 |
+
// add more width to ensure lines don't turn over at certain sizes in various browsers
|
58 |
+
emWidth += o.extraWidth;
|
59 |
+
// restrict to at least minWidth and at most maxWidth
|
60 |
+
if (emWidth > o.maxWidth) { emWidth = o.maxWidth; }
|
61 |
+
else if (emWidth < o.minWidth) { emWidth = o.minWidth; }
|
62 |
+
emWidth += 'em';
|
63 |
+
// set ul to width in ems
|
64 |
+
$ul.css('width',emWidth);
|
65 |
+
// restore li floats to avoid IE bugs
|
66 |
+
// set li width to full width of this ul
|
67 |
+
// revert white-space to normal
|
68 |
+
$LIs.css({
|
69 |
+
'float' : liFloat,
|
70 |
+
'width' : '100%',
|
71 |
+
'white-space' : 'normal'
|
72 |
+
})
|
73 |
+
// update offset position of descendant ul to reflect new width of parent
|
74 |
+
.each(function(){
|
75 |
+
var $childUl = $('>ul',this);
|
76 |
+
var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
|
77 |
+
$childUl.css(offsetDirection,emWidth);
|
78 |
+
});
|
79 |
+
});
|
80 |
+
|
81 |
+
});
|
82 |
+
};
|
83 |
+
// expose defaults
|
84 |
+
$.fn.supersubs.defaults = {
|
85 |
+
minWidth : 9, // requires em unit.
|
86 |
+
maxWidth : 25, // requires em unit.
|
87 |
+
extraWidth : 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
|
88 |
+
};
|
89 |
+
|
90 |
+
})(jQuery); // plugin code ends
|
js/widgets.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function() {
|
2 |
+
jQuery("div[id*='_dropdown-menu-']").addClass('shailan-dropdown');
|
3 |
+
jQuery("div[id*='_multi-dropdown-menu-']").addClass('shailan-dropdown');
|
4 |
+
});
|
options-page.php
CHANGED
@@ -53,6 +53,14 @@ case "title":
|
|
53 |
<p>To easily use the <?php echo $pluginname;?>, you can use the menu below.</p>
|
54 |
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
<?php break;
|
57 |
|
58 |
case 'picker':
|
@@ -136,8 +144,8 @@ $i++;
|
|
136 |
}
|
137 |
?>
|
138 |
|
139 |
-
</div
|
140 |
-
</div
|
141 |
|
142 |
<div class="widget-liquid-right">
|
143 |
<div id="widgets-right">
|
@@ -229,19 +237,7 @@ tweetmeme_url = 'http://shailan.com/wordpress/plugins/dropdown-menu/'; tweetmeme
|
|
229 |
</form>
|
230 |
|
231 |
<p class="aligncenter">
|
232 |
-
<a href="http://shailan.com/wordpress/plugins/dropdown-menu">Dropdown Menu <?php echo SHAILAN_DM_VERSION; ?></a> by <a href="http://shailan.com">shailan</a> ©
|
233 |
</p>
|
234 |
|
235 |
-
|
236 |
-
</div> <!-- wrap -->
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
53 |
<p>To easily use the <?php echo $pluginname;?>, you can use the menu below.</p>
|
54 |
|
55 |
|
56 |
+
<?php break;
|
57 |
+
|
58 |
+
case "paragraph":
|
59 |
+
?>
|
60 |
+
<div class="shailan_dm_input shailan_dm_paragraph">
|
61 |
+
<p><?php echo $value['desc']; ?></p>
|
62 |
+
</div>
|
63 |
+
|
64 |
<?php break;
|
65 |
|
66 |
case 'picker':
|
144 |
}
|
145 |
?>
|
146 |
|
147 |
+
</div><!-- Widget holder -->
|
148 |
+
</div><!-- Widgets left -->
|
149 |
|
150 |
<div class="widget-liquid-right">
|
151 |
<div id="widgets-right">
|
237 |
</form>
|
238 |
|
239 |
<p class="aligncenter">
|
240 |
+
<a href="http://shailan.com/wordpress/plugins/dropdown-menu">Dropdown Menu <?php echo SHAILAN_DM_VERSION; ?></a> by <a href="http://shailan.com">shailan</a> © 2011
|
241 |
</p>
|
242 |
|
243 |
+
</div> <!-- wrap -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Dropdown Menu Widget ===
|
2 |
Contributors: mattsay
|
3 |
Donate link: http://shailan.com/donate
|
4 |
-
Tags: css, dropdown, menu, widget, pages, categories, multi, jquery, navigation
|
5 |
Requires at least: 2.8
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
This widget adds a beatiful vertical/horizontal CSS only dropdown menu of Pages, Categories or Custom navigation menus of your blog.
|
10 |
|
@@ -47,6 +47,14 @@ You can submit errors and bugs using the [online form](http://shailan.com/contac
|
|
47 |
|
48 |
== Changelog ==
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
= 1.5.8 =
|
51 |
* Added dropdown_menu_defaults filter for changing default options like order, depth etc.
|
52 |
|
1 |
=== Dropdown Menu Widget ===
|
2 |
Contributors: mattsay
|
3 |
Donate link: http://shailan.com/donate
|
4 |
+
Tags: css, dropdown, menu, widget, pages, categories, multi, jquery, navigation, category list, themes, custom-styles, options-page, animations, effects
|
5 |
Requires at least: 2.8
|
6 |
+
Tested up to: 3.1
|
7 |
+
Stable tag: 1.6
|
8 |
|
9 |
This widget adds a beatiful vertical/horizontal CSS only dropdown menu of Pages, Categories or Custom navigation menus of your blog.
|
10 |
|
47 |
|
48 |
== Changelog ==
|
49 |
|
50 |
+
= 1.6 =
|
51 |
+
* Added option to show title on widget.
|
52 |
+
* Added capability to find dropdown.css on your theme folder.
|
53 |
+
* Added jQuery dropdown effects.
|
54 |
+
* Added remove title attributes option.
|
55 |
+
* Added remove links from top level option.
|
56 |
+
* Many more to come..
|
57 |
+
|
58 |
= 1.5.8 =
|
59 |
* Added dropdown_menu_defaults filter for changing default options like order, depth etc.
|
60 |
|
shailan-dropdown.css
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
/* RESET TABLES */
|
2 |
-
div.shailan-dropdown-menu table, div.shailan-dropdown-menu tbody, div.shailan-dropdown-menu tr, div.shailan-dropdown-menu td, div.shailan-dropdown-menu ul, div.shailan-dropdown-menu li { margin:0; padding:0; border:0; }
|
3 |
-
|
4 |
-
/* REMOVE LIST STYLING */
|
5 |
-
ul.dropdown, ul.dropdown li, ul.dropdown ul { list-style: none; margin: 0; padding: 0; }
|
6 |
-
ul.dropdown * { margin:0; padding:0 }
|
7 |
-
|
8 |
-
/* BASICS */
|
9 |
-
.dropdown-horizontal-container{ width:100%; }
|
10 |
-
ul.dropdown li { position:relative; z-index: 598; float: left; vertical-align: middle; }
|
11 |
-
* html ul.dropdown li { display:inline; zoom:1; } /* IE FIX */
|
12 |
-
ul.dropdown li a{ padding: .3em .8em; }
|
13 |
-
ul.dropdown ul { position: absolute; top: 100%; left: 0; }
|
14 |
-
* html ul.dropdown ul { margin-top:1px }
|
15 |
-
ul.current{ z-index:99999; }
|
16 |
-
ul.dropdown ul li { float: none; }
|
17 |
-
* html ul.dropdown ul li, * html ul.dropdown ul li li { display: list-item; }
|
18 |
-
ul.dropdown ul ul { top: 1px; left: 99%; }
|
19 |
-
|
20 |
-
ul.dropdown li:hover > ul, ul.dropdown li.hover ul{ display: block; }
|
21 |
-
ul.dropdown a:active, ul.dropdown a:focus { outline-style:none; }
|
22 |
-
|
23 |
-
* html ul.dropdown li { height: 1px; }
|
24 |
-
|
25 |
-
/* IE Submenu margin fix */
|
26 |
-
ul.dropdown ul li, ul.dropdown-vertical { margin-left: -16px; mar\gin-left: 0; }
|
27 |
-
|
28 |
-
/** Hide submenus */
|
29 |
-
ul.dropdown ul, ul.dropdown li.hover ul ul, ul.dropdown li.hover ul ul ul, ul.dropdown li.hover ul ul ul ul, ul.dropdown li.hover ul ul ul ul ul, ul.dropdown ul, ul.dropdown li:hover ul ul, ul.dropdown li:hover ul ul ul, ul.dropdown li:hover ul ul ul ul, ul.dropdown li:hover ul ul ul ul ul { display: none; }
|
30 |
-
|
31 |
-
/** Show current submenu */
|
32 |
-
ul.dropdown li.hover ul, ul.dropdown ul li.hover ul, ul.dropdown ul ul li.hover ul, ul.dropdown ul ul ul li.hover ul, ul.dropdown ul ul ul ul li.hover ul , ul.dropdown li:hover ul, ul.dropdown ul li:hover ul, ul.dropdown ul ul li:hover ul, ul.dropdown ul ul ul li:hover ul, ul.dropdown ul ul ul ul li:hover ul { display: block; }
|
33 |
-
|
34 |
-
ul.dropdown ul ul ul ul ul ul { display: none !important; }
|
35 |
-
|
36 |
-
/* Vertical menu support */
|
37 |
-
ul.dropdown-vertical { /*width: 200px;*/ }
|
38 |
-
ul.dropdown-vertical ul { top: 1px; left: 99%; }
|
39 |
-
ul.dropdown-vertical li { float: none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shailan.DropDownMenu.php
CHANGED
@@ -4,13 +4,13 @@ Plugin Name: 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, categories & navigation menus. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
|
6 |
Tags: dropdown, menu, css, css-dropdown, navigation, widget, dropdown-menu, customization, theme
|
7 |
-
Version: 1.
|
8 |
Author: Matt Say
|
9 |
Author URI: http://shailan.com
|
10 |
Text Domain: shailan-dropdown-menu
|
11 |
*/
|
12 |
|
13 |
-
define('SHAILAN_DM_VERSION','1.
|
14 |
define('SHAILAN_DM_TITLE', 'Dropdown Menu');
|
15 |
define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
|
16 |
|
@@ -30,29 +30,34 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
30 |
$this->shortname = "shailan_dm";
|
31 |
|
32 |
// Hook up styles
|
33 |
-
add_action( 'wp_head', array(&$this, '
|
34 |
add_action( 'wp_footer', array(&$this, 'footer'), 10, 1 );
|
35 |
|
36 |
if(!is_admin()){ wp_enqueue_script( 'dropdown-ie-support', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/js/include.js', array('jquery') ); }
|
37 |
-
|
38 |
// Define themes
|
39 |
$available_themes = array(
|
40 |
-
'None'=>'
|
41 |
-
'Custom CSS' => 'custom',
|
42 |
-
'Color Scheme' => 'color-scheme',
|
43 |
-
'Simple White'=>'simple',
|
44 |
-
'Wordpress Default'=>'wpdefault',
|
45 |
-
'Grayscale'=>'grayscale',
|
46 |
-
'Aqua'=>'aqua',
|
47 |
-
'Blue gradient'=>'simple-blue',
|
48 |
-
'Shiny Black'=> 'shiny-black',
|
49 |
-
'Flickr theme'=>'flickr.com/default.ultimate',
|
50 |
-
'Nvidia theme'=>'nvidia.com/default.advanced',
|
51 |
-
'Adobe theme'=>'adobe.com/default.advanced',
|
52 |
-
'MTV theme'=>'mtv.com/default.ultimate',
|
53 |
-
'Hulu theme'=>'hulu/hulu'
|
54 |
);
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
// Swap array for options page
|
57 |
$themes = array();
|
58 |
while(list($Key,$Val) = each($available_themes))
|
@@ -67,8 +72,9 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
67 |
);
|
68 |
|
69 |
$alignment = array('left'=>'left', 'center' => 'center', 'right'=> 'right');
|
70 |
-
|
71 |
$types = array('pages'=>'Pages', 'categories'=>'Categories');
|
|
|
|
|
72 |
|
73 |
if(function_exists('wp_nav_menu')){
|
74 |
// Get available menus
|
@@ -113,6 +119,38 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
113 |
"std" => __("Home"),
|
114 |
"type" => "text"),
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
array( "type" => "close" ),
|
117 |
|
118 |
array(
|
@@ -161,11 +199,47 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
161 |
|
162 |
array( "type" => "close" ),
|
163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
array(
|
165 |
"name" => "Template Tag Options",
|
166 |
"type" => "section"
|
167 |
),
|
168 |
|
|
|
|
|
|
|
|
|
|
|
169 |
array( "name" => "Menu Type",
|
170 |
"desc" => "Dropdown Menu Type",
|
171 |
"id" => "shailan_dm_type",
|
@@ -210,43 +284,7 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
210 |
"options" => $alignment,
|
211 |
"type" => "select"),
|
212 |
|
213 |
-
array( "type" => "close" )
|
214 |
-
|
215 |
-
array(
|
216 |
-
"name" => "Advanced Options",
|
217 |
-
"type" => "section"
|
218 |
-
),
|
219 |
-
|
220 |
-
array( "name" => "Wrap long menu items",
|
221 |
-
"desc" => "If checked long menu items will wrap",
|
222 |
-
"id" => "shailan_dm_allowmultiline",
|
223 |
-
"type" => "checkbox"),
|
224 |
-
|
225 |
-
array( "name" => "Dropdown Menu Font",
|
226 |
-
"desc" => "Font family for the menu<br />Please leave blank to use your wordpress theme font.",
|
227 |
-
"id" => "shailan_dm_font",
|
228 |
-
"std" => '',
|
229 |
-
"type" => "text"),
|
230 |
-
|
231 |
-
array( "name" => "Dropdown Menu Font Size",
|
232 |
-
"desc" => "Font size of the menu items (Eg: 12px OR 1em) <br />Please leave blank to use your wordpress theme font-size.",
|
233 |
-
"id" => "shailan_dm_fontsize",
|
234 |
-
"std" => '',
|
235 |
-
"type" => "text"),
|
236 |
-
|
237 |
-
array( "name" => "Custom css",
|
238 |
-
"desc" => "You can paste your own customization file here.",
|
239 |
-
"id" => "shailan_dm_custom_css",
|
240 |
-
"std" => '',
|
241 |
-
"type" => "textarea"),
|
242 |
-
|
243 |
-
array( "name" => "Show Empty Categories",
|
244 |
-
"desc" => "If checked categories with no posts will be shown.",
|
245 |
-
"id" => "shailan_dm_show_empty",
|
246 |
-
"std" => false,
|
247 |
-
"type" => "checkbox"),
|
248 |
-
|
249 |
-
array( "type" => "close" ),
|
250 |
|
251 |
);
|
252 |
|
@@ -258,7 +296,9 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
258 |
'login' => false,
|
259 |
'admin' => false,
|
260 |
'vertical' => false,
|
261 |
-
'align' => 'left'
|
|
|
|
|
262 |
);
|
263 |
|
264 |
$pluginname = $this->pluginname;
|
@@ -275,12 +315,18 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
275 |
global $pluginname, $pluginshortname, $pluginoptions;
|
276 |
|
277 |
if(is_admin()){
|
|
|
|
|
278 |
wp_admin_css( 'widgets' );
|
279 |
-
|
280 |
-
|
|
|
|
|
|
|
|
|
281 |
};
|
282 |
|
283 |
-
if (
|
284 |
|
285 |
wp_enqueue_style('farbtastic');
|
286 |
wp_enqueue_script('farbtastic');
|
@@ -303,13 +349,13 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
303 |
|
304 |
if (function_exists('add_options_page')) {
|
305 |
$page = add_options_page(__('Settings for Dropdown Menu', 'shailan-dropdown-menu') , __('Dropdown Menu', 'shailan-dropdown-menu'), 'edit_themes', 'dropdown-menu', array('shailan_DropdownWidget', 'getOptionsPage'));
|
306 |
-
add_action('admin_print_styles-' . $page, array('shailan_DropdownWidget', '
|
307 |
}
|
308 |
}
|
309 |
|
|
|
310 |
function getOptionsPage(){
|
311 |
global $pluginname, $pluginshortname, $pluginoptions;
|
312 |
-
|
313 |
$title = __('Dropdown Menu Options');
|
314 |
include_once('options-page.php');
|
315 |
}
|
@@ -320,23 +366,30 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
320 |
$widget_options = wp_parse_args( $instance, $this->defaults );
|
321 |
extract( $widget_options, EXTR_SKIP );
|
322 |
|
|
|
|
|
323 |
$orientation = ($vertical ? 'dropdown-vertical' : 'dropdown-horizontal');
|
324 |
-
$custom_walkers = false; //(bool) get_option('shailan_dm_customwalkers');
|
325 |
$show_empty = (bool) get_option('shailan_dm_show_empty');
|
326 |
|
327 |
echo $args['before_widget'];
|
328 |
|
329 |
-
|
330 |
-
|
|
|
|
|
|
|
|
|
|
|
331 |
|
332 |
-
$dropdown_wrapper_open = '<div id="shailan-dropdown-wrapper-' . $this->number . '" >';
|
333 |
|
334 |
-
$dropdown_open = '<div align="' . $align . '" class="'.$orientation.'-container dm-align-'.$align.'"><table cellpadding="0" cellspacing="0"><tr><td>';
|
335 |
-
$list_open = '<ul id="dropdown-'. $this->number .'" class="dropdown dropdown-'. $this->number .' '. $orientation . ' dropdown-align-'.$align.'">';
|
336 |
|
337 |
if($home && ($type == 'pages' || $type == 'categories')){
|
338 |
|
339 |
-
$home_item = '<li class="page_item cat-item blogtab '. (is_front_page() && !is_paged() ? 'current_page_item current-cat' : '' ) . '">
|
340 |
<a href="'.get_option('home').'">';
|
341 |
|
342 |
$home_tag = get_option('shailan_dm_home_tag');
|
@@ -462,13 +515,18 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
462 |
$widget_options = wp_parse_args( $instance, $this->defaults );
|
463 |
extract( $widget_options, EXTR_SKIP );
|
464 |
|
|
|
465 |
$home = (bool) $home;
|
466 |
$login = (bool) $login;
|
467 |
$admin = (bool) $admin;
|
468 |
$vertical = (bool) $vertical;
|
469 |
|
470 |
?>
|
471 |
-
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title
|
|
|
|
|
|
|
|
|
472 |
|
473 |
<p><label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Menu:'); ?>
|
474 |
<select name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>">
|
@@ -501,7 +559,7 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
501 |
<?php
|
502 |
}
|
503 |
|
504 |
-
function
|
505 |
global $pluginname, $pluginshortname, $pluginoptions;
|
506 |
if(!is_admin()){
|
507 |
$theme = get_option('shailan_dm_active_theme');
|
@@ -513,11 +571,17 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
513 |
$shailan_dm_color_link = get_option('shailan_dm_color_link');
|
514 |
$shailan_dm_color_hoverlink = get_option('shailan_dm_color_hoverlink');
|
515 |
|
516 |
-
|
517 |
-
echo "\n<link rel=\"stylesheet\" href=\"".WP_PLUGIN_URL."/".SHAILAN_DM_FOLDER."/shailan-dropdown.css\" type=\"text/css\" />";
|
518 |
|
519 |
-
|
520 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
}
|
522 |
|
523 |
echo "\n<style type=\"text/css\" media=\"all\">";
|
@@ -593,20 +657,83 @@ class shailan_DropdownWidget extends WP_Widget {
|
|
593 |
|
594 |
} // if($custom_colors)
|
595 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
596 |
// Insert Custom CSS last
|
597 |
$custom_css = stripslashes(get_option('shailan_dm_custom_css'));
|
598 |
if(!empty($custom_css)){ echo $custom_css; }
|
599 |
echo "\n</style>";
|
600 |
echo "\n<!-- /Dropdown Menu Widget Styles -->";
|
601 |
-
echo "\n ";
|
602 |
|
603 |
-
} else {
|
604 |
-
wp_enqueue_style('dropdownMenuStyles');
|
605 |
}
|
606 |
-
} //
|
607 |
|
|
|
608 |
function footer($instance){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
610 |
}
|
611 |
|
612 |
} // class shailan_DropdownWidget
|
4 |
Plugin URI: http://shailan.com/wordpress/plugins/dropdown-menu
|
5 |
Description: A multi widget to generate drop-down menus from your pages, categories & navigation menus. You can find more widgets, plugins and themes at <a href="http://shailan.com">shailan.com</a>.
|
6 |
Tags: dropdown, menu, css, css-dropdown, navigation, widget, dropdown-menu, customization, theme
|
7 |
+
Version: 1.6
|
8 |
Author: Matt Say
|
9 |
Author URI: http://shailan.com
|
10 |
Text Domain: shailan-dropdown-menu
|
11 |
*/
|
12 |
|
13 |
+
define('SHAILAN_DM_VERSION','1.6');
|
14 |
define('SHAILAN_DM_TITLE', 'Dropdown Menu');
|
15 |
define('SHAILAN_DM_FOLDER', 'dropdown-menu-widget');
|
16 |
|
30 |
$this->shortname = "shailan_dm";
|
31 |
|
32 |
// Hook up styles
|
33 |
+
add_action( 'wp_head', array(&$this, 'header') );
|
34 |
add_action( 'wp_footer', array(&$this, 'footer'), 10, 1 );
|
35 |
|
36 |
if(!is_admin()){ wp_enqueue_script( 'dropdown-ie-support', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/js/include.js', array('jquery') ); }
|
37 |
+
|
38 |
// Define themes
|
39 |
$available_themes = array(
|
40 |
+
'None' => '*none*',
|
41 |
+
'Custom CSS' => '*custom*',
|
42 |
+
'Color Scheme' => plugins_url('/themes/color-scheme.css', __FILE__),
|
43 |
+
'Simple White' => plugins_url('/themes/simple.css', __FILE__),
|
44 |
+
'Wordpress Default' => plugins_url('/themes/wpdefault.css', __FILE__),
|
45 |
+
'Grayscale' => plugins_url('/themes/grayscale.css', __FILE__),
|
46 |
+
'Aqua' => plugins_url('/themes/aqua.css', __FILE__),
|
47 |
+
'Blue gradient' => plugins_url('/themes/simple-blue.css', __FILE__),
|
48 |
+
'Shiny Black' => plugins_url('/themes/shiny-black.css', __FILE__),
|
49 |
+
'Flickr theme' => plugins_url('/themes/flickr.com/default.ultimate.css', __FILE__),
|
50 |
+
'Nvidia theme' => plugins_url('/themes/nvidia.com/default.advanced.css', __FILE__),
|
51 |
+
'Adobe theme' => plugins_url('/themes/adobe.com/default.advanced.css', __FILE__),
|
52 |
+
'MTV theme' => plugins_url('/themes/mtv.com/default.ultimate.css', __FILE__),
|
53 |
+
'Hulu theme' => plugins_url('/themes/hulu/hulu.css', __FILE__)
|
54 |
);
|
55 |
|
56 |
+
// Check for theme style file
|
57 |
+
if( file_exists( trailingslashit( get_template_directory() ) . 'dropdown.css') ){
|
58 |
+
$available_themes['Dropdown.css (theme)'] = get_template_directory_uri() . '/dropdown.css';
|
59 |
+
}
|
60 |
+
|
61 |
// Swap array for options page
|
62 |
$themes = array();
|
63 |
while(list($Key,$Val) = each($available_themes))
|
72 |
);
|
73 |
|
74 |
$alignment = array('left'=>'left', 'center' => 'center', 'right'=> 'right');
|
|
|
75 |
$types = array('pages'=>'Pages', 'categories'=>'Categories');
|
76 |
+
$effects = array('fade'=>'Fade In/Out', 'slide'=>'Slide Up/Down');
|
77 |
+
$speed = array('400'=>'Normal', 'fast'=>'Fast', 'slow'=>'Slow');
|
78 |
|
79 |
if(function_exists('wp_nav_menu')){
|
80 |
// Get available menus
|
119 |
"std" => __("Home"),
|
120 |
"type" => "text"),
|
121 |
|
122 |
+
array( "name" => "Enable dropdown effects",
|
123 |
+
"desc" => "If checked sub menus will use effects below",
|
124 |
+
"id" => "shailan_dm_effects",
|
125 |
+
"type" => "checkbox"),
|
126 |
+
|
127 |
+
array( "name" => "Effect",
|
128 |
+
"desc" => "Select effect you want to use",
|
129 |
+
"id" => "shailan_dm_effect",
|
130 |
+
"type" => "select",
|
131 |
+
"options" => $effects ),
|
132 |
+
|
133 |
+
array( "name" => "Effect Speed",
|
134 |
+
"desc" => "Select effect speed",
|
135 |
+
"id" => "shailan_dm_effect_speed",
|
136 |
+
"type" => "select",
|
137 |
+
"options" => $speed ),
|
138 |
+
|
139 |
+
array( "name" => "Wrap long menu items",
|
140 |
+
"desc" => "If checked long menu items will wrap",
|
141 |
+
"id" => "shailan_dm_allowmultiline",
|
142 |
+
"type" => "checkbox"),
|
143 |
+
|
144 |
+
array( "name" => "Remove title attributes from menu items",
|
145 |
+
"desc" => "This will remove 'View all posts under..' title attributes from menu links",
|
146 |
+
"id" => "shailan_dm_remove_title_attributes",
|
147 |
+
"type" => "checkbox"),
|
148 |
+
|
149 |
+
array( "name" => "Remove links from top levels",
|
150 |
+
"desc" => "This will remove links from top level pages/categories. So user can only click to sub-level menu.",
|
151 |
+
"id" => "shailan_dm_remove_top_level_links",
|
152 |
+
"type" => "checkbox"),
|
153 |
+
|
154 |
array( "type" => "close" ),
|
155 |
|
156 |
array(
|
199 |
|
200 |
array( "type" => "close" ),
|
201 |
|
202 |
+
array(
|
203 |
+
"name" => "Advanced Options",
|
204 |
+
"type" => "section"
|
205 |
+
),
|
206 |
+
|
207 |
+
array( "name" => "Dropdown Menu Font",
|
208 |
+
"desc" => "Font family for the menu<br />Please leave blank to use your wordpress theme font.",
|
209 |
+
"id" => "shailan_dm_font",
|
210 |
+
"std" => '',
|
211 |
+
"type" => "text"),
|
212 |
+
|
213 |
+
array( "name" => "Dropdown Menu Font Size",
|
214 |
+
"desc" => "Font size of the menu items (Eg: 12px OR 1em) <br />Please leave blank to use your wordpress theme font-size.",
|
215 |
+
"id" => "shailan_dm_fontsize",
|
216 |
+
"std" => '',
|
217 |
+
"type" => "text"),
|
218 |
+
|
219 |
+
array( "name" => "Custom css",
|
220 |
+
"desc" => "You can paste your own customization file here.",
|
221 |
+
"id" => "shailan_dm_custom_css",
|
222 |
+
"std" => '',
|
223 |
+
"type" => "textarea"),
|
224 |
+
|
225 |
+
array( "name" => "Show Empty Categories",
|
226 |
+
"desc" => "If checked categories with no posts will be shown.",
|
227 |
+
"id" => "shailan_dm_show_empty",
|
228 |
+
"std" => false,
|
229 |
+
"type" => "checkbox"),
|
230 |
+
|
231 |
+
array( "type" => "close" ),
|
232 |
+
|
233 |
array(
|
234 |
"name" => "Template Tag Options",
|
235 |
"type" => "section"
|
236 |
),
|
237 |
|
238 |
+
array(
|
239 |
+
"desc" => "Settings here only effect menus inserted with template tag : <code><?php shailan_dropdown_menu(); ?></code>. Widget settings are NOT affected by these settings. ",
|
240 |
+
"type" => "paragraph"
|
241 |
+
),
|
242 |
+
|
243 |
array( "name" => "Menu Type",
|
244 |
"desc" => "Dropdown Menu Type",
|
245 |
"id" => "shailan_dm_type",
|
284 |
"options" => $alignment,
|
285 |
"type" => "select"),
|
286 |
|
287 |
+
array( "type" => "close" )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
|
289 |
);
|
290 |
|
296 |
'login' => false,
|
297 |
'admin' => false,
|
298 |
'vertical' => false,
|
299 |
+
'align' => 'left',
|
300 |
+
'theme' => 'none',
|
301 |
+
'show_title' => false
|
302 |
);
|
303 |
|
304 |
$pluginname = $this->pluginname;
|
315 |
global $pluginname, $pluginshortname, $pluginoptions;
|
316 |
|
317 |
if(is_admin()){
|
318 |
+
|
319 |
+
// Styles
|
320 |
wp_admin_css( 'widgets' );
|
321 |
+
wp_enqueue_style( 'dropdownMenuStyles', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/css/admin.css' );
|
322 |
+
|
323 |
+
// Scripts
|
324 |
+
wp_enqueue_script( 'admin-widgets' );
|
325 |
+
wp_enqueue_script( 'dropdown-widgets', WP_PLUGIN_URL . '/' . SHAILAN_DM_FOLDER . '/js/widgets.js', array('jquery') );
|
326 |
+
|
327 |
};
|
328 |
|
329 |
+
if ( isset($_GET['page']) && $_GET['page'] == 'dropdown-menu' ) {
|
330 |
|
331 |
wp_enqueue_style('farbtastic');
|
332 |
wp_enqueue_script('farbtastic');
|
349 |
|
350 |
if (function_exists('add_options_page')) {
|
351 |
$page = add_options_page(__('Settings for Dropdown Menu', 'shailan-dropdown-menu') , __('Dropdown Menu', 'shailan-dropdown-menu'), 'edit_themes', 'dropdown-menu', array('shailan_DropdownWidget', 'getOptionsPage'));
|
352 |
+
add_action('admin_print_styles-' . $page, array('shailan_DropdownWidget', 'header'));
|
353 |
}
|
354 |
}
|
355 |
|
356 |
+
// Render options page
|
357 |
function getOptionsPage(){
|
358 |
global $pluginname, $pluginshortname, $pluginoptions;
|
|
|
359 |
$title = __('Dropdown Menu Options');
|
360 |
include_once('options-page.php');
|
361 |
}
|
366 |
$widget_options = wp_parse_args( $instance, $this->defaults );
|
367 |
extract( $widget_options, EXTR_SKIP );
|
368 |
|
369 |
+
// On and off
|
370 |
+
$show_title = (bool) $show_title;
|
371 |
$orientation = ($vertical ? 'dropdown-vertical' : 'dropdown-horizontal');
|
372 |
+
$custom_walkers = false; // (bool) get_option('shailan_dm_customwalkers'); disabled
|
373 |
$show_empty = (bool) get_option('shailan_dm_show_empty');
|
374 |
|
375 |
echo $args['before_widget'];
|
376 |
|
377 |
+
// Show title if option checked
|
378 |
+
if ( $title && $show_title ){ echo $before_title . $title . $after_title; }
|
379 |
+
|
380 |
+
$nl = "\n"; $indent = "\n\t"; $indent2 = "\n\t\t";
|
381 |
+
|
382 |
+
echo $nl . "<!-- Dropdown Menu Widget by shailan (http://shailan.com) v".SHAILAN_DM_VERSION." on wp".get_bloginfo( 'version' )." -->";
|
383 |
+
echo $nl . "<!-- Menu Type : " . $type . " -->";
|
384 |
|
385 |
+
$dropdown_wrapper_open = $nl . '<div id="shailan-dropdown-wrapper-' . $this->number . '" >';
|
386 |
|
387 |
+
$dropdown_open = $indent . '<div align="' . $align . '" class="'.$orientation.'-container dm-align-'.$align.'"><table cellpadding="0" cellspacing="0"><tr><td>';
|
388 |
+
$list_open = $indent2 . '<ul id="dropdown-'. $this->number .'" class="dropdown dropdown-'. $this->number .' '. $orientation . ' dropdown-align-'.$align.'">' . $nl . "<!-- Menu elements start -->\n";
|
389 |
|
390 |
if($home && ($type == 'pages' || $type == 'categories')){
|
391 |
|
392 |
+
$home_item = $nl . '<li class="page_item cat-item blogtab '. (is_front_page() && !is_paged() ? 'current_page_item current-cat' : '' ) . '">
|
393 |
<a href="'.get_option('home').'">';
|
394 |
|
395 |
$home_tag = get_option('shailan_dm_home_tag');
|
515 |
$widget_options = wp_parse_args( $instance, $this->defaults );
|
516 |
extract( $widget_options, EXTR_SKIP );
|
517 |
|
518 |
+
$show_title = (bool) $show_title;
|
519 |
$home = (bool) $home;
|
520 |
$login = (bool) $login;
|
521 |
$admin = (bool) $admin;
|
522 |
$vertical = (bool) $vertical;
|
523 |
|
524 |
?>
|
525 |
+
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title :', 'shailan-dropdown-menu'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
|
526 |
+
|
527 |
+
<p>
|
528 |
+
<input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_title'); ?>" name="<?php echo $this->get_field_name('show_title'); ?>"<?php checked( $show_title ); ?> />
|
529 |
+
<label for="<?php echo $this->get_field_id('show_title'); ?>"><?php _e( 'Show widget title' , 'shailan-dropdown-menu' ); ?></label><br />
|
530 |
|
531 |
<p><label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Menu:'); ?>
|
532 |
<select name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>">
|
559 |
<?php
|
560 |
}
|
561 |
|
562 |
+
function header($instance){
|
563 |
global $pluginname, $pluginshortname, $pluginoptions;
|
564 |
if(!is_admin()){
|
565 |
$theme = get_option('shailan_dm_active_theme');
|
571 |
$shailan_dm_color_link = get_option('shailan_dm_color_link');
|
572 |
$shailan_dm_color_hoverlink = get_option('shailan_dm_color_hoverlink');
|
573 |
|
574 |
+
$is_fx_active = (bool) get_option('shailan_dm_effects');
|
|
|
575 |
|
576 |
+
echo "\n\n<!-- Dropdown Menu Widget Styles by shailan (http://shailan.com) v".SHAILAN_DM_VERSION." on wp".get_bloginfo( 'version' )." -->"; // For debug
|
577 |
+
echo "\n<link rel=\"stylesheet\" href=\"".WP_PLUGIN_URL."/".SHAILAN_DM_FOLDER."/css/shailan-dropdown.css\" type=\"text/css\" />";
|
578 |
+
|
579 |
+
if( $theme!='NONE' && $theme != 'custom' ){
|
580 |
+
if( false === strpos($theme, 'http') ){
|
581 |
+
echo "\n<link rel=\"stylesheet\" href=\"". plugins_url( '/themes/' . $theme . '.css', __FILE__)."\" type=\"text/css\" />";
|
582 |
+
} else {
|
583 |
+
echo "\n<link rel=\"stylesheet\" href=\"".$theme."\" type=\"text/css\" />";
|
584 |
+
}
|
585 |
}
|
586 |
|
587 |
echo "\n<style type=\"text/css\" media=\"all\">";
|
657 |
|
658 |
} // if($custom_colors)
|
659 |
|
660 |
+
// If effects not active, embed CSS display:
|
661 |
+
if(! $is_fx_active){ ?>
|
662 |
+
|
663 |
+
/** Show submenus */
|
664 |
+
ul.dropdown li:hover > ul, ul.dropdown li.hover ul{ display: block; }
|
665 |
+
|
666 |
+
/** Show current submenu */
|
667 |
+
ul.dropdown li.hover ul, ul.dropdown ul li.hover ul, ul.dropdown ul ul li.hover ul, ul.dropdown ul ul ul li.hover ul, ul.dropdown ul ul ul ul li.hover ul , ul.dropdown li:hover ul, ul.dropdown ul li:hover ul, ul.dropdown ul ul li:hover ul, ul.dropdown ul ul ul li:hover ul, ul.dropdown ul ul ul ul li:hover ul { display: block; }
|
668 |
+
|
669 |
+
<?php }
|
670 |
+
|
671 |
// Insert Custom CSS last
|
672 |
$custom_css = stripslashes(get_option('shailan_dm_custom_css'));
|
673 |
if(!empty($custom_css)){ echo $custom_css; }
|
674 |
echo "\n</style>";
|
675 |
echo "\n<!-- /Dropdown Menu Widget Styles -->";
|
676 |
+
echo "\n\n ";
|
677 |
|
|
|
|
|
678 |
}
|
679 |
+
} // -- End Header
|
680 |
|
681 |
+
// Footer scripts
|
682 |
function footer($instance){
|
683 |
+
$indent = "\n\t";
|
684 |
+
|
685 |
+
$remove_title_attributes = (bool) get_option('shailan_dm_remove_title_attributes');
|
686 |
+
$remove_top_level_links = (bool) get_option('shailan_dm_remove_top_level_links');
|
687 |
+
$is_fx_active = (bool) get_option('shailan_dm_effects');
|
688 |
+
$speed = get_option('shailan_dm_effect_speed', '400');
|
689 |
+
$effect = get_option('shailan_dm_effect', 'fade');
|
690 |
+
|
691 |
+
if( $is_fx_active || $remove_title_attributes || $remove_top_level_links ){
|
692 |
+
|
693 |
+
echo "\n\n<!-- Dropdown Menu Widget Effects by shailan (http://shailan.com) v".SHAILAN_DM_VERSION." on wp".get_bloginfo( 'version' )." -->"; // For debug
|
694 |
+
echo "\n<script type=\"text/javascript\">/* <![CDATA[ */";
|
695 |
+
echo "\njQuery(document).ready(function(){ \n";
|
696 |
+
|
697 |
+
// Remove title attributes from categories
|
698 |
|
699 |
+
if($remove_title_attributes){
|
700 |
+
?>
|
701 |
+
jQuery('ul.dropdown li a').removeAttr('title');
|
702 |
+
<?php
|
703 |
+
}
|
704 |
+
|
705 |
+
// Remove links from top-level menus
|
706 |
+
|
707 |
+
if($remove_top_level_links){
|
708 |
+
?>
|
709 |
+
jQuery('ul.children').parent().find('a:first').removeAttr('href');
|
710 |
+
<?php
|
711 |
+
}
|
712 |
+
|
713 |
+
// Enable effects
|
714 |
+
|
715 |
+
if( 'fade' == $effect ){
|
716 |
+
?>
|
717 |
+
jQuery(".dropdown li").hover(function(){
|
718 |
+
jQuery(this).find("ul:first").fadeIn('<?php echo $speed; ?>');
|
719 |
+
},
|
720 |
+
function(){
|
721 |
+
jQuery(this).find("ul:first").fadeOut('<?php echo $speed; ?>');
|
722 |
+
});
|
723 |
+
<?php
|
724 |
+
} elseif( 'slide' == $effect ) { ?>
|
725 |
+
jQuery(".dropdown li").hover(function(){
|
726 |
+
jQuery(this).find("ul:first").slideDown('<?php echo $speed; ?>');
|
727 |
+
},
|
728 |
+
function(){
|
729 |
+
jQuery(this).find("ul:first").slideUp('<?php echo $speed; ?>');
|
730 |
+
});
|
731 |
+
<?php }
|
732 |
+
echo "\n});";
|
733 |
+
echo "\n/* ]]> */</script>";
|
734 |
+
echo "\n<!-- /Dropdown Menu Widget Styles -->";
|
735 |
+
echo "\n\n ";
|
736 |
+
}
|
737 |
}
|
738 |
|
739 |
} // class shailan_DropdownWidget
|