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.magentocommerce.com for more information. 19 * 20 * @category Varien 21 * @package js 22 * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.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 handlNavElement : function(list) { 57 if(list !== undefined){ 58 list.onmouseover = function(){ 59 main.fireNavEvent(this,true); 60 }; 61 list.onmouseout = function(){ 62 main.fireNavEvent(this,false); 63 }; 64 if(list.down("ul")){ 65 main.init(list.down("ul"), true); 66 } 67 } 68 }, 69 70 ieFixZIndex : function(el, i, l) { 71 if(el.tagName.toString().toLowerCase().indexOf("iframe") == -1){ 72 el.style.zIndex = l - i; 73 } else { 74 el.onmouseover = "null"; 75 el.onmouseout = "null"; 76 } 77 }, 78 79 fireNavEvent : function(elm,ev) { 80 if(ev){ 81 elm.addClassName("over"); 82 elm.down("a").addClassName("over"); 83 if (elm.childElements()[1]) { 84 main.show(elm.childElements()[1]); 85 } 86 } else { 87 elm.removeClassName("over"); 88 elm.down("a").removeClassName("over"); 89 if (elm.childElements()[1]) { 90 main.hide(elm.childElements()[1]); 91 } 92 } 93 }, 94 95 show : function (sub_elm) { 96 if (sub_elm.hide_time_id) { 97 clearTimeout(sub_elm.hide_time_id); 98 } 99 sub_elm.show_time_id = setTimeout(function() { 100 if (!sub_elm.hasClassName("shown-sub")) { 101 sub_elm.addClassName("shown-sub"); 102 } 103 }, main.settings.show_delay); 104 }, 105 106 hide : function (sub_elm) { 107 if (sub_elm.show_time_id) { 108 clearTimeout(sub_elm.show_time_id); 109 } 110 sub_elm.hide_time_id = setTimeout(function(){ 111 if (sub_elm.hasClassName("shown-sub")) { 112 sub_elm.removeClassName("shown-sub"); 113 } 114 }, main.settings.hide_delay); 115 } 116 117 }; 118 if (arguments[1]) { 119 main.settings = Object.extend(main.settings, arguments[1]); 120 } 121 if (main.obj_nav) { 122 main.init(main.obj_nav, false); 123 } 124}; 125 126document.observe("dom:loaded", function() { 127 //run navigation without delays and with default id="#nav" 128 //mainNav(); 129 130 //run navigation with delays 131 mainNav("nav", {"show_delay":"100","hide_delay":"100"}); 132});
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.