1/** 2 * Magento 3 * 4 * NOTICE OF LICENSE 5 * 6 * This source file is subject to the Academic Free License (AFL 3.0) 7 * that is bundled with this package in the file LICENSE_AFL.txt. 8 * It is also available through the world-wide-web at this URL: 9 * http://opensource.org/licenses/afl-3.0.php 10 * If you did not receive a copy of the license and are unable to 11 * obtain it through the world-wide-web, please send an email 12 * to [email protected] so we can send you a copy immediately. 13 * 14 * DISCLAIMER 15 * 16 * Do not edit or add to this file if you wish to upgrade Magento to newer 17 * versions in the future. If you wish to customize Magento for your 18 * needs please refer to http://www.magento.com for more information. 19 * 20 * @category Varien 21 * @package js 22 * @copyright Copyright (c) 2006-2019 Magento, Inc. (http://www.magento.com) 23 * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 24 */ 25 26/** 27 * @classDescription simple Navigation with replacing old handlers 28 * @param {String} id id of ul element with navigation lists 29 * @param {Object} settings object with settings 30 */ 31var mainNav = function() { 32 33 var main = { 34 obj_nav : $(arguments[0]) || $("nav"), 35 36 settings : { 37 show_delay : 0, 38 hide_delay : 0, 39 _ie6 : /MSIE 6.+Win/.test(navigator.userAgent), 40 _ie7 : /MSIE 7.+Win/.test(navigator.userAgent) 41 }, 42 43 init : function(obj, level) { 44 obj.lists = obj.childElements(); 45 obj.lists.each(function(el,ind){ 46 main.handlNavElement(el); 47 if((main.settings._ie6 || main.settings._ie7) && level){ 48 main.ieFixZIndex(el, ind, obj.lists.size()); 49 } 50 }); 51 if(main.settings._ie6 && !level){ 52 document.execCommand("BackgroundImageCache", false, true); 53 } 54 }, 55 56 // Anpassung: "onmouseenter" statt "onmouseover", "onmouseleave" statt "onmouseout" 57 // Hilft bei IE 8 gegen Blitzer ind er Navigation beim Hovern 58 handlNavElement : function(list) { 59 if(list !== undefined){ 60 list.onmouseenter = function(){ 61 main.fireNavEvent(this,true); 62 }; 63 list.onmouseleave = function(){ 64 main.fireNavEvent(this,false); 65 }; 66 if(list.down("ul")){ 67 main.init(list.down("ul"), true); 68 } 69 } 70 }, 71 72 ieFixZIndex : function(el, i, l) { 73 if(el.tagName.toString().toLowerCase().indexOf("iframe") == -1){ 74 el.style.zIndex = l - i; 75 } else { 76 el.onmouseover = "null"; 77 el.onmouseout = "null"; 78 } 79 }, 80 81 fireNavEvent : function(elm,ev) { 82 if(ev){ 83 elm.addClassName("over"); 84 elm.down("a").addClassName("over"); 85 if (elm.childElements()[1]) { 86 main.show(elm.childElements()[1]); 87 } 88 } else { 89 elm.removeClassName("over"); 90 elm.down("a").removeClassName("over"); 91 if (elm.childElements()[1]) { 92 main.hide(elm.childElements()[1]); 93 } 94 } 95 }, 96 97 show : function (sub_elm) { 98 if (sub_elm.hide_time_id) { 99 clearTimeout(sub_elm.hide_time_id); 100 } 101 sub_elm.show_time_id = setTimeout(function() { 102 if (!sub_elm.hasClassName("shown-sub")) { 103 sub_elm.addClassName("shown-sub"); 104 } 105 }, main.settings.show_delay); 106 }, 107 108 hide : function (sub_elm) { 109 if (sub_elm.show_time_id) { 110 clearTimeout(sub_elm.show_time_id); 111 } 112 sub_elm.hide_time_id = setTimeout(function(){ 113 if (sub_elm.hasClassName("shown-sub")) { 114 sub_elm.removeClassName("shown-sub"); 115 } 116 }, main.settings.hide_delay); 117 } 118 119 }; 120 if (arguments[1]) { 121 main.settings = Object.extend(main.settings, arguments[1]); 122 } 123 if (main.obj_nav) { 124 main.init(main.obj_nav, false); 125 } 126}; 127 128document.observe("dom:loaded", function() { 129 //run navigation without delays and with default id="#nav" 130 //mainNav(); 131 132 //run navigation with delays 133 mainNav("nav", {"show_delay":"100","hide_delay":"100"}); 134});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.