| Linux hosting5.siteguarding.com 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64 Path : /home/devsafetybis/verd.dev.safetybis.com/catalogue/js/varien/ |
| Current File : /home/devsafetybis/verd.dev.safetybis.com/catalogue/js/varien/menu.js |
/**
* OpenMage
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magento.com so we can send you a copy immediately.
*
* @category Varien
* @package js
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
/**
* @classDescription simple Navigation with replacing old handlers
* @param {String} id id of ul element with navigation lists
* @param {Object} settings object with settings
*/
var mainNav = function() {
var main = {
obj_nav : $(arguments[0]) || $("nav"),
settings : {
show_delay : 0,
hide_delay : 0,
_ie6 : /MSIE 6.+Win/.test(navigator.userAgent),
_ie7 : /MSIE 7.+Win/.test(navigator.userAgent)
},
init : function(obj, level) {
obj.lists = obj.childElements();
obj.lists.each(function(el,ind){
main.handlNavElement(el);
if((main.settings._ie6 || main.settings._ie7) && level){
main.ieFixZIndex(el, ind, obj.lists.size());
}
});
if(main.settings._ie6 && !level){
document.execCommand("BackgroundImageCache", false, true);
}
},
handlNavElement : function(list) {
if(list !== undefined){
list.onmouseover = function(){
main.fireNavEvent(this,true);
};
list.onmouseout = function(){
main.fireNavEvent(this,false);
};
if(list.down("ul")){
main.init(list.down("ul"), true);
}
}
},
ieFixZIndex : function(el, i, l) {
if(el.tagName.toString().toLowerCase().indexOf("iframe") == -1){
el.style.zIndex = l - i;
} else {
el.onmouseover = "null";
el.onmouseout = "null";
}
},
fireNavEvent : function(elm,ev) {
if(ev){
elm.addClassName("over");
elm.down("a").addClassName("over");
if (elm.childElements()[1]) {
main.show(elm.childElements()[1]);
}
} else {
elm.removeClassName("over");
elm.down("a").removeClassName("over");
if (elm.childElements()[1]) {
main.hide(elm.childElements()[1]);
}
}
},
show : function (sub_elm) {
if (sub_elm.hide_time_id) {
clearTimeout(sub_elm.hide_time_id);
}
sub_elm.show_time_id = setTimeout(function() {
if (!sub_elm.hasClassName("shown-sub")) {
sub_elm.addClassName("shown-sub");
}
}, main.settings.show_delay);
},
hide : function (sub_elm) {
if (sub_elm.show_time_id) {
clearTimeout(sub_elm.show_time_id);
}
sub_elm.hide_time_id = setTimeout(function(){
if (sub_elm.hasClassName("shown-sub")) {
sub_elm.removeClassName("shown-sub");
}
}, main.settings.hide_delay);
}
};
if (arguments[1]) {
main.settings = Object.extend(main.settings, arguments[1]);
}
if (main.obj_nav) {
main.init(main.obj_nav, false);
}
};
document.observe("dom:loaded", function() {
//run navigation without delays and with default id="#nav"
//mainNav();
//run navigation with delays
mainNav("nav", {"show_delay":"100","hide_delay":"100"});
});