// SpryMenu.js - version 0.19 - Spry Pre-Release 1.7 // // Copyright (c) 2010. Adobe Systems Incorporated. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // * Neither the name of Adobe Systems Incorporated nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. (function() { // BeginSpryComponent if (typeof Spry == "undefined" || !Spry.Widget || !Spry.Widget.Base) { alert("SpryMenu.js requires SpryWidget.js!"); return; } var defaultConfig = { plugIns: [], mainMenuShowDelay: 200, // msecs mainMenuHideDelay: 0, // msecs subMenuShowDelay: 200, // msecs subMenuHideDelay: 300, // msecs enableHoverNavigation: true, insertMenuBarBreak: false, insertSubMenuBreak: false, widgetID: null, widgetClass: "MenuBar", // Sliceable menuBarViewClass: "MenuBarView", menuBarBreakClass: "MenuBarBreak", subMenuClass: "SubMenu", // Sliceable subMenuViewClass: "SubMenuView", subMenuBreakClass: "SubMenuBreak", subMenuVisibleClass: "SubMenuVisible", menuItemContainerClass: "MenuItemContainer", // Sliceable menuItemContainerHoverClass: "MenuItemContainerHover", menuItemClass: "MenuItem", // Sliceable menuItemHoverClass: "MenuItemHover", menuItemSelectedClass: "MenuItemSelected", menuItemLabelClass: "MenuItemLabel", // Sliceable menuItemWithSubMenuClass: "MenuItemWithSubMenu", menuItemFirstClass: "MenuItemFirst", menuItemLastClass: "MenuItemLast", menuLevelClassPrefix: "MenuLevel", sliceMap: {} }; Spry.Widget.MenuBar2 = function(ele, opts) { Spry.Widget.Base.call(this); this.element = Spry.$$(ele)[0]; // Initialize the accordion object with the global defaults. this.setOptions(this, Spry.Widget.MenuBar2.config); // Override the defaults with any options passed into the constructor. this.setOptions(this, opts); this.showMenuTimer = 0; this.menuToShow = null; this.hideMenuTimer = 0; this.menuToHide = null; this.currentMenuItem = null; this.currentSubMenu = null; this.initializePlugIns(Spry.Widget.MenuBar2.config.plugIns, opts); var evt = new Spry.Widget.Event(this); this.notifyObservers("onPreInitialize", evt); if (!evt.performDefaultAction) return; this.transformMarkup(); this.attachBehaviors(); this.notifyObservers("onPostInitialize", evt); }; Spry.Widget.MenuBar2.prototype = new Spry.Widget.Base(); Spry.Widget.MenuBar2.prototype.constructor = Spry.Widget.MenuBar2; Spry.Widget.MenuBar2.config = defaultConfig; Spry.Widget.MenuBar2.prototype.transformMarkup = function() { var evt = new Spry.Widget.Event(this); this.notifyObservers("onPreTransformMarkup", evt); if (!evt.performDefaultAction) return; // Find the elements and convert them to MenuItems. var eles = Spry.$$("a", this.element); for (var i = 0; i < eles.length; i++) { var a = eles[i]; var ca = this.extractChildNodes(a); this.createOptionalSlicedStructure(a, "span", this.menuItemClass); var label = this.createOptionalSlicedStructure(null, "span", this.menuItemLabelClass); this.appendChildNodes(label.contentContainer, ca); a.contentContainer.appendChild(label); } // Add MenuItemContainer class to all
  • elements. var eles = Spry.$$("li", this.element); for (var i = 0; i < eles.length; i++) this.addClassName(eles[i], this.menuItemContainerClass); // Find all