diff options
Diffstat (limited to 'pyload/webui/themes/Flat/lib/MooTools/MooDropMenu')
-rw-r--r-- | pyload/webui/themes/Flat/lib/MooTools/MooDropMenu/MooDropMenu.js | 86 | ||||
-rw-r--r-- | pyload/webui/themes/Flat/lib/MooTools/MooDropMenu/css/MooDropMenu.css | 66 |
2 files changed, 152 insertions, 0 deletions
diff --git a/pyload/webui/themes/Flat/lib/MooTools/MooDropMenu/MooDropMenu.js b/pyload/webui/themes/Flat/lib/MooTools/MooDropMenu/MooDropMenu.js new file mode 100644 index 000000000..ac0fa1874 --- /dev/null +++ b/pyload/webui/themes/Flat/lib/MooTools/MooDropMenu/MooDropMenu.js @@ -0,0 +1,86 @@ +/* +--- +description: This provides a simple Drop Down menu with infinit levels + +license: MIT-style + +authors: +- Arian Stolwijk + +requires: + - Core/Class.Extras + - Core/Element.Event + - Core/Selectors + +provides: [MooDropMenu, Element.MooDropMenu] + +... +*/ + +var MooDropMenu = new Class({ + + Implements: [Options, Events], + + options: { + onOpen: function(el){ + el.removeClass('close').addClass('open'); + }, + onClose: function(el){ + el.removeClass('open').addClass('close'); + }, + onInitialize: function(el){ + el.removeClass('open').addClass('close'); + }, + mouseoutDelay: 200, + mouseoverDelay: 0, + listSelector: 'ul', + itemSelector: 'li', + openEvent: 'mouseenter', + closeEvent: 'mouseleave' + }, + + initialize: function(menu, options, level){ + this.setOptions(options); + options = this.options; + + var menu = this.menu = document.id(menu); + + menu.getElements(options.itemSelector + ' > ' + options.listSelector).each(function(el){ + + this.fireEvent('initialize', el); + + var parent = el.getParent(options.itemSelector), + timer; + + parent.addEvent(options.openEvent, function(){ + parent.store('DropDownOpen', true); + + clearTimeout(timer); + if (options.mouseoverDelay) timer = this.fireEvent.delay(options.mouseoverDelay, this, ['open', el]); + else this.fireEvent('open', el); + + }.bind(this)).addEvent(options.closeEvent, function(){ + parent.store('DropDownOpen', false); + + clearTimeout(timer); + timer = (function(){ + if (!parent.retrieve('DropDownOpen')) this.fireEvent('close', el); + }).delay(options.mouseoutDelay, this); + + }.bind(this)); + + }, this); + }, + + toElement: function(){ + return this.menu + } + +}); + +/* So you can do like this $('nav').MooDropMenu(); or even $('nav').MooDropMenu().setStyle('border',1); */ +Element.implement({ + MooDropMenu: function(options){ + return this.store('MooDropMenu', new MooDropMenu(this, options)); + } +}); diff --git a/pyload/webui/themes/Flat/lib/MooTools/MooDropMenu/css/MooDropMenu.css b/pyload/webui/themes/Flat/lib/MooTools/MooDropMenu/css/MooDropMenu.css new file mode 100644 index 000000000..e08c2f9fa --- /dev/null +++ b/pyload/webui/themes/Flat/lib/MooTools/MooDropMenu/css/MooDropMenu.css @@ -0,0 +1,66 @@ +#nav { + margin: 0; + padding: 0; + list-style: none; +} + +#nav > li { + background: #F5F5F5; + border-bottom: 1px solid #aaa; +} + +#nav li { + position: relative; + float: left; + padding: 5px; +} + + +#nav ul { + position: absolute; + top: 26px; + left: 10px; + margin: 0; + padding: 0; + list-style: none; + width: 136px; + border: 1px solid #AAA; + background: #f1f1f1; + -webkit-box-shadow: 1px 1px 5px #AAA; + -moz-box-shadow: 1px 1px 5px #AAA; + box-shadow: 1px 1px 5px #AAA; +} + + +#nav .open { + display: block; +} + +#nav .close { + display: none; +} + +#nav ul li { + float: none; + padding: 0; +} + +#nav ul li a { + width: 130px; + _width: 127px; + background: #f1f1f1; + padding: 3px; + display: block; + _float: left; + font-weight: normal; +} + +#nav ul li a:hover { + background: #CDCDCD; +} + +#nav ul ul { + left: 137px; + _left: 0; + top: 0; +} |