///////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) and others / // / // All rights reserved. This program and the accompanying materials / // are made available under the terms of the Apache License, Version 2.0 / // which accompanies this distribution, and is available at / // http://www.apache.org/licenses/LICENSE-2.0 / ///////////////////////////////////////////////////////////////////////////////////////// /** * jquery.multilevelpushmenu.js v2.1.4 * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2013-2014, Make IT d.o.o. * http://multi-level-push-menu.make.rs * https://github.com/adgsm/multi-level-push-menu */ (function ( $ ) { $.fn.multilevelpushmenu = function( options ) { "use strict"; var args = arguments, returnValue = null; this.each(function(){ var instance = this, $this = $( this ), $container = ( $this.context != undefined ) ? $this : $( 'body' ), menu = ( options && options.menu != undefined ) ? options.menu : $this.find( 'nav' ), clickEventType, dragEventType; // Settings var settings = $.extend({ container: $container, containersToPush: null, menuID: ( ( $container.prop( 'id' ) != undefined && $container.prop( 'id' ) != '' ) ? $container.prop( 'id' ) : this.nodeName.toLowerCase() ) + "_multilevelpushmenu", wrapperClass: 'multilevelpushmenu_wrapper', menuInactiveClass: 'multilevelpushmenu_inactive', menu: menu, menuWidth: 0, menuHeight: 0, collapsed: false, fullCollapse: false, direction: 'ltr', backText: 'Back', backItemClass: 'backItemClass', backItemIcon: 'fa fa-angle-right', groupIcon: 'fa fa-angle-left', mode: 'overlap', overlapWidth: 40, preventItemClick: true, preventGroupItemClick: true, swipe: 'both', durationSlideOut: 400, durationSlideDown: 500, durationTransition: 400, onCollapseMenuStart: function() {}, onCollapseMenuEnd: function() {}, onExpandMenuStart: function() {}, onExpandMenuEnd: function() {}, onGroupItemClick: function() {}, onItemClick: function() {}, onTitleItemClick: function() {}, onBackItemClick: function() {}, onMenuReady: function() {}, onMenuSwipe: function() {} }, options ); // Store a settings reference withint the element's data if (!$.data(instance, 'plugin_multilevelpushmenu')) { $.data(instance, 'plugin_multilevelpushmenu', settings); instance.settings = $.data(instance, 'plugin_multilevelpushmenu'); } // Exposed methods var methods = { // Initialize menu init: function () { return initialize.apply(this, Array.prototype.slice.call(arguments)); }, // Collapse menu collapse: function () { return collapseMenu.apply(this, Array.prototype.slice.call(arguments)); }, // Expand menu expand: function () { return expandMenu.apply(this, Array.prototype.slice.call(arguments)); }, // Menu expanded menuexpanded: function () { return menuExpanded.apply(this, Array.prototype.slice.call(arguments)); }, // Active menu activemenu: function () { return activeMenu.apply(this, Array.prototype.slice.call(arguments)); }, // Find menu(s) by title findmenusbytitle: function () { return findMenusByTitle.apply(this, Array.prototype.slice.call(arguments)); }, // Find item(s) by name finditemsbyname: function () { return findItemsByName.apply(this, Array.prototype.slice.call(arguments)); }, // Find path to root menu collection pathtoroot: function () { return pathToRoot.apply(this, Array.prototype.slice.call(arguments)); }, // Find shared path to root of two menus comparepaths: function () { return comparePaths.apply(this, Array.prototype.slice.call(arguments)); }, // Get/Set settings options option: function () { return manageOptions.apply(this, Array.prototype.slice.call(arguments)); }, // Add item(s) additems: function () { return addItems.apply(this, Array.prototype.slice.call(arguments)); }, // Remove item(s) removeitems: function () { return removeItems.apply(this, Array.prototype.slice.call(arguments)); }, // Size DOM elements redraw: function () { return sizeDOMelements.apply(this, Array.prototype.slice.call(arguments)); }, // Returns visible level holders visiblemenus: function () { return visibleLevelHolders.apply(this, Array.prototype.slice.call(arguments)); }, // Returns visible level holders hiddenmenus: function () { return hiddenLevelHolders.apply(this, Array.prototype.slice.call(arguments)); }, // Propagate event to underneath layer propagateevent: function () { return propagateEvent.apply(this, Array.prototype.slice.call(arguments)); } }; // IE 8 and modern browsers, prevent event propagation function stopEventPropagation( e ){ if ( e.stopPropagation && e.preventDefault ) { e.stopPropagation(); e.preventDefault(); } else { e.cancelBubble = true; e.returnValue = false; } } // propagate event to underneath layer // http://jsfiddle.net/E9zTs/2/ function propagateEvent( $element , event ) { if( $element == undefined || event == undefined ) return false; $element.on( event , function ( e , ee ) { $element.hide(); try { if(!e.pageX || !e.pageY) return false; ee = ee || { pageX: e.pageX, pageY: e.pageY }; var next = document.elementFromPoint( ee.pageX , ee.pageY ); next = ( next.nodeType == 3 ) ? next.parentNode : next //Opera $( next ).trigger( event , ee ); } catch ( err ) { $.error( 'Error while propagating event: ' + err.message ); } finally { $element.show(); } }); } // Create DOM structure if it does not already exist within the container (input: array) function createDOMStructure() { var $mainWrapper = $( "