132 lines
26 KiB
JavaScript
132 lines
26 KiB
JavaScript
/*
|
|
* @version $Id: fusion.js 14422 2013-10-10 18:10:04Z djamil $
|
|
* @author RocketTheme http://www.rockettheme.com
|
|
* @copyright Copyright (C) 2007 - 2013 RocketTheme, LLC
|
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
|
|
*/
|
|
((function(){var b=navigator.userAgent.match(/iPad/i)!=null;
|
|
var a=new Class({Implements:[Options],version:"1.9.8",options:{centered:false,tweakInitial:{x:0,y:0},tweakSubsequent:{x:0,y:0},tweakSizes:{width:0,height:0},pill:true,direction:{x:"right",y:"down"},effect:"slide and fade",orientation:"horizontal",opacity:1,hideDelay:50000,menuFx:{duration:500,transition:"quad:out"},pillFx:{duration:400,transition:"back:out"}},initialize:function(j,q){this.element=$$(j)[0];
|
|
this.id=$$(".fusion")[0];if(this.id){this.id=this.id.id;}else{this.id="";}this.setOptions(q);var n=this.element.getElements(".item"),e=this.options,l=Browser.Platform.ios?"mouseover":"mouseenter",k=Browser.Platform.ios?"mouseout":"mouseleave";
|
|
this.rtl=document.id(document.body).getStyle("direction")=="rtl";this.options.tweakSubsequent.x-=this.options.tweakSizes.width/2;this.options.tweakSubsequent.y-=this.options.tweakSizes.height/2;
|
|
if(this.rtl){this.options.direction.x="left";this.options.tweakInitial.x*=-1;this.options.tweakSubsequent.x*=-1;}if(this.options.pill){var h=new Element("div",{"class":"fusion-pill-l"}).inject(this.element,"after").setStyle("display","none"),p=this;
|
|
new Element("div",{"class":"fusion-pill-r"}).inject(h);this.pillsRoots=this.element.getElements(".root");var g=this.element.getElement(".active");this.pillsMargins=h.getStyle("margin-left").toInt()+h.getStyle("margin-right").toInt();
|
|
this.pillsTopMargins=h.getStyle("margin-top").toInt()+h.getStyle("margin-bottom").toInt();if(!g){this.options.pill=false;}else{h.setStyle("display","block");
|
|
this.pillsDefaults={left:g.offsetLeft,width:g.offsetWidth-this.pillsMargins,top:g.offsetTop};this.pillFx=new Fx.Morph(h,{duration:e.pillFx.duration,transition:e.pillFx.transition,link:"cancel"}).set(this.pillsDefaults);
|
|
var f=this.pillsRoots.filter(function(r){return !r.hasClass("parent");});$$(f).addEvent(l,function(){p.ghostRequest=true;p.pillFx.start({left:this.offsetLeft,width:this.offsetWidth-p.pillsMargins,top:this.offsetTop});
|
|
}).addEvent(k,function(){p.ghostRequest=false;p.pillFx.start(p.pillsDefaults);});}}this.parentLinks={};this.parentSubMenus={};this.childMenu={};this.menuType={};
|
|
this.subMenus=[];this.hideAllMenusTimeout=null;this.subMenuZindex=1;n.each(function(u,s){u.getCustomID();this.parentLinks[u.id]=u.getParent().getParents("li").getElement(".item");
|
|
this.childMenu[u.id]=u.getNext(".fusion-submenu-wrapper")||u.getNext("ul")||u.getNext("ol");if(this.childMenu[u.id]){u.fusionSize=this.childMenu[u.id].getCoordinates();
|
|
}if(this.childMenu[u.id]&&Browser.ie){var r=this.childMenu[u.id].getElement("ul");if(r){var v=r.getStyle("padding-bottom").toInt()||0;u.fusionSize.height+=v;
|
|
}}var t="subseq";if(document.id(u.getParent(".fusion-submenu-wrapper")||u.getParent("ul")||u.getParent("ol"))===this.element){t="init";}this.menuType[u.id]=t;
|
|
},this);this.jsContainer=new Element("div",{"class":"fusion-js-container menutop"}).inject(document.body);this.jsContainer.addEvent(l,function(){window.RTFUSION=true;
|
|
}).addEvent(k,function(){window.RTFUSION=false;});var o=this.element.className.replace("menutop","");if(this.id.length){this.jsContainer.id=this.id;}if(o.length){var m="fusion-js-container "+o+" menutop";
|
|
this.jsContainer.className=m.clean();}var i=this.element.getElements(".fusion-submenu-wrapper");if(!i.length){i=this.element.getElements("ul");}i.each(function(s,r){var t=s.getElements(".item")[r];
|
|
if(t&&this.parentLinks[t.id].length==1){t=this.parentLinks[t.id].getLast().getParents("li")[0];}var u=new Element("div",{"class":"fusion-js-subs"}).inject(this.jsContainer).adopt(s);
|
|
if(t&&t.hasClass("active")){s.getParent().addClass("active");}},this);this.jsContainer.getElements(".item").setProperty("tabindex","-1");n.each(function(u,s){if(!this.childMenu[u.id]){return;
|
|
}this.childMenu[u.id]=this.childMenu[u.id].getParent("div");this.subMenus.include(this.childMenu[u.id]);var r=[];this.parentLinks[u.id].each(function(w,v){r.push(this.childMenu[w.id]);
|
|
},this);this.parentSubMenus[u.id]=r;var t=new c(this.options,this,u);},this);}});var c=new Class({Implements:[Options],options:{onSubMenuInit_begin:(function(e){}),onSubMenuInit_complete:(function(e){}),onMatchWidth_begin:(function(e){}),onMatchWidth_complete:(function(e){}),onHideSubMenu_begin:(function(e){}),onHideSubMenu_complete:(function(e){}),onHideOtherSubMenus_begin:(function(e){}),onHideOtherSubMenus_complete:(function(e){}),onHideAllSubMenus_begin:(function(e){}),onHideAllSubMenus_complete:(function(e){}),onPositionSubMenu_begin:(function(e){}),onPositionSubMenu_complete:(function(e){}),onShowSubMenu_begin:(function(e){}),onShowSubMenu_complete:(function(e){})},root:null,btn:null,hidden:true,myEffect:null,initialize:function(g,f,h){this.setOptions(g);
|
|
this.root=f;this.btn=document.id(h);this.childMenu=document.id(f.childMenu[h.id]);this.subMenuType=f.menuType[h.id];this.parentSubMenus=$$(f.parentSubMenus[h.id]);
|
|
this.parentLinks=$$(f.parentLinks[h.id]);this.parentSubMenu=document.id(this.parentSubMenus[0]);this.otherSubMenus={};this.fxMorph={};this.rtl=f.rtl;this.options.tweakInitial=this.root.options.tweakInitial;
|
|
this.options.tweakSubsequent=this.root.options.tweakSubsequent;this.options.centered=this.root.options.centered;this.childMenu.fusionStatus="closed";this.options.onSubMenuInit_begin(this);
|
|
this.childMenu.addEvent("hide",this.hideSubMenu.bind(this));this.childMenu.addEvent("show",this.showSubMenu.bind(this));var k=this.childMenu,e=Browser.Platform.ios?"mouseover":"mouseenter",i=Browser.Platform.ios?"mouseout":"mouseleave";
|
|
if(this.options.effect){this.myEffect=new Fx.Morph(this.childMenu.getFirst(),{duration:this.options.menuFx.duration,transition:this.options.menuFx.transition,link:"cancel",onStart:function(){this.element.setStyle("display","block");
|
|
},onComplete:function(){if(k.fusionStatus=="closed"){if(!Browser.ie){k.setStyle("display","none");}else{this.element.setStyle("display","none");}}}});}if(this.options.effect=="slide"||this.options.effect=="slide and fade"){if(this.subMenuType=="init"&&this.options.orientation=="horizontal"){this.myEffect.set({"margin-top":"0"});
|
|
}else{if(!this.rtl){this.myEffect.set({"margin-left":"0"});}else{this.myEffect.set({"margin-right":"0"});}}}else{if(this.options.effect=="fade"||this.options.effect=="slide and fade"){this.myEffect.set({opacity:0});
|
|
}}if(this.options.effect!="fade"&&this.options.effect!="slide and fade"){this.myEffect.set({opacity:this.options.opacity});}var j=document.id(this.childMenu).getElements(".item").filter(function(m,l){return !f.childMenu[m.id];
|
|
});j.each(function(o,l){document.id(o).getParent().addClass("f-submenu-item");var n=o.getParent();var m=o.getParents("li").length;if(m<2&&!n.hasClass("fusion-grouped")){n.addEvent(e,function(p){this.childMenu.fireEvent("show");
|
|
if(!b){this.cancellHideAllSubMenus();this.hideOtherSubMenus();}}.bind(this));n.addEvent(i,function(p){this.cancellHideAllSubMenus();this.hideAllSubMenus();
|
|
}.bind(this));n.addEvents({focus:function(p){this.childMenu.fireEvent("show");this.cancellHideAllSubMenus();this.hideOtherSubMenus();}.bind(this),blur:function(p){this.cancellHideAllSubMenus();
|
|
this.hideAllSubMenus();}.bind(this)});}else{n.addEvent(e,function(p){this.childMenu.fireEvent("show");this.cancellHideAllSubMenus();if(!n.hasClass("fusion-grouped")){this.hideOtherSubMenus();
|
|
}}.bind(this)).addEvent(i,function(p){}.bind(this));}},this);this.btn.removeClass("fusion-submenu-item");if(this.subMenuType=="init"){this.btn.getParent().addClass("f-main-parent");
|
|
}else{this.btn.getParent().addClass("f-parent-item");}this.btn.getParent().addEvent(e,function(l){this.cancellHideAllSubMenus();this.hideOtherSubMenus();
|
|
this.showSubMenu();if(this.subMenuType=="init"&&this.options.mmbClassName&&this.options.mmbFocusedClassName){if(!this.fxMorph[this.btn.id]){this.fxMorph[this.btn.id]={};
|
|
}if(!this.fxMorph[this.btn.id]["btnMorph"]){this.fxMorph[this.btn.id]["btnMorph"]=new Fx.Morph(this.btn,{duration:this.options.menuFx.duration,transition:this.options.menuFx.transition,link:"cancel"});
|
|
}this.fxMorph[this.btn.id]["btnMorph"].start(this.options.mmbFocusedClassName);}}.bind(this)).addEvent(i,function(l){this.cancellHideAllSubMenus();this.hideAllSubMenus(this.btn,this.btn.getParent().getParent().get("tag")=="ol");
|
|
}.bind(this)).addEvents({focus:function(l){this.cancellHideAllSubMenus();this.hideOtherSubMenus();this.showSubMenu();if(this.subMenuType=="init"&&this.options.mmbClassName&&this.options.mmbFocusedClassName){if(!this.fxMorph[this.btn.id]){this.fxMorph[this.btn.id]={};
|
|
}if(!this.fxMorph[this.btn.id]["btnMorph"]){this.fxMorph[this.btn.id]["btnMorph"]=new Fx.Morph(this.btn,{duration:this.options.menuFx.duration,transition:this.options.menuFx.transition,link:"cancel"});
|
|
}this.fxMorph[this.btn.id]["btnMorph"].start(this.options.mmbFocusedClassName);}}.bind(this),blur:function(l){this.cancellHideAllSubMenus();this.hideAllSubMenus();
|
|
}.bind(this)});this.options.onSubMenuInit_complete(this);},matchWidth:function(){if(this.widthMatched||this.subMenuType==="subseq"){return;}this.options.onMatchWidth_begin(this);
|
|
var e=this.btn.getCoordinates().width;this.childMenu.getElements(".item").each(function(i,h){var g=parseFloat(this.childMenu.getFirst().getStyle("border-left-width"))+parseFloat(this.childMenu.getFirst().getStyle("border-right-width"));
|
|
var f=parseFloat(i.getStyle("padding-left"))+parseFloat(i.getStyle("padding-right"));var j=g+f;if(e>i.getCoordinates().width){i.setStyle("width",e-j);i.setStyle("margin-right",-g);
|
|
}}.bind(this));this.width=this.btn.fusionSize.width;this.widthMatched=true;this.options.onMatchWidth_complete(this);},hideSubMenu:function(){if(this.childMenu.fusionStatus==="closed"){return;
|
|
}this.options.onHideSubMenu_begin(this);if(this.subMenuType=="init"){if(this.options.mmbClassName&&this.options.mmbFocusedClassName){if(!this.fxMorph[this.btn.id]){this.fxMorph[this.btn.id]={};
|
|
}if(!this.fxMorph[this.btn.id]["btnMorph"]){this.fxMorph[this.btn.id]["btnMorph"]=new Fx.Morph(this.btn,{duration:this.options.menuFx.duration,transition:this.options.menuFx.transition,link:"cancel"});
|
|
}this.fxMorph[this.btn.id]["btnMorph"].start(this.options.mmbClassName).chain(function(){this.btn.getParent().removeClass("f-mainparent-itemfocus");this.btn.getParent().addClass("f-mainparent-item");
|
|
}.bind(this));}else{this.btn.getParent().removeClass("f-mainparent-itemfocus");this.btn.getParent().addClass("f-mainparent-item");}}else{this.btn.getParent().removeClass("f-menuparent-itemfocus");
|
|
this.btn.getParent().addClass("f-menuparent-item");}this.childMenu.setStyle("z-index",1);if(this.options.effect&&this.options.effect.toLowerCase()==="slide"){if(this.subMenuType=="init"&&this.options.orientation=="horizontal"&&this.options.direction.y=="down"){this.myEffect.start({"margin-top":-this.height}).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}else{if(this.subMenuType=="init"&&this.options.orientation=="horizontal"&&this.options.direction.y=="up"){this.myEffect.start({"margin-top":this.height}).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}else{if(this.options.direction.x=="right"){if(!this.rtl){tmp={"margin-left":-this.width};
|
|
}else{tmp={"margin-right":this.width};}this.myEffect.start(tmp).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}else{if(this.options.direction.x=="left"){if(!this.rtl){tmp={"margin-left":this.width};
|
|
}else{tmp={"margin-right":-this.width};}this.myEffect.start(tmp).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}}}}}else{if(this.options.effect=="fade"){this.myEffect.start({opacity:0}).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}else{if(this.options.effect=="slide and fade"){if(this.subMenuType=="init"&&this.options.orientation=="horizontal"&&this.options.direction.y=="down"){this.myEffect.start({"margin-top":-this.height,opacity:0}).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}else{if(this.subMenuType=="init"&&this.options.orientation=="horizontal"&&this.options.direction.y=="up"){this.myEffect.start({"margin-top":this.height,opacity:0}).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}else{if(this.options.direction.x=="right"){if(!this.rtl){tmp={"margin-left":-this.width,opacity:0};
|
|
}else{tmp={"margin-right":this.width,opacity:0};}this.myEffect.start(tmp).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}else{if(this.options.direction.x=="left"){if(!this.rtl){tmp={"margin-left":this.width,opacity:0};
|
|
}else{tmp={"margin-right":-this.width,opacity:0};}this.myEffect.start(tmp).chain(function(){if(this.childMenu.fusionStatus=="closed"){if(!Browser.ie){this.myEffect.set({display:"none"});
|
|
}else{this.myEffect.element.setStyle("display","none");}}}.bind(this));}}}}}else{if(!Browser.ie){this.myEffect.set({display:"none"});}else{this.myEffect.element.setStyle("display","none");
|
|
}}}}this.childMenu.fusionStatus="closed";this.options.onHideSubMenu_complete(this);},hideOtherSubMenus:function(){this.options.onHideOtherSubMenus_begin(this);
|
|
if(!this.otherSubMenus[this.btn.id]){this.otherSubMenus[this.btn.id]=$$(this.root.subMenus.filter(function(e){return !this.root.parentSubMenus[this.btn.id].contains(e)&&e!=this.childMenu;
|
|
}.bind(this)));}this.parentSubMenus.fireEvent("show");this.otherSubMenus[this.btn.id].fireEvent("hide");this.options.onHideOtherSubMenus_complete(this);
|
|
},hideAllSubMenus:function(e,f){this.options.onHideAllSubMenus_begin(this);clearTimeout(this.root.hideAllMenusTimeout);this.root.hideAllMenusTimeout=(function(){if(!window.RTFUSION){clearTimeout(this.hideAllMenusTimeout);
|
|
this.myEffect.cancel();if(this.root.options.pill&&!this.root.ghostRequest){this.root.pillFx.start(this.root.pillsDefaults);}if(f){var g=$$(this.root.subMenus).filter(function(h){return !h.hasChild(e);
|
|
});$$(g).fireEvent("hide");}else{$$(this.root.subMenus).fireEvent("hide");}}}).bind(this).delay(this.options.hideDelay);this.options.onHideAllSubMenus_complete(this);
|
|
},cancellHideAllSubMenus:function(){clearTimeout(this.root.hideAllMenusTimeout);},showSubMenu:function(e){if(this.root.options.pill&&this.subMenuType=="init"){this.root.ghostRequest=false;
|
|
this.root.pillFx.start({left:this.btn.getParent().offsetLeft,width:this.btn.getParent().offsetWidth-this.root.pillsMargins,top:this.btn.getParent().offsetTop});
|
|
}if(this.childMenu.fusionStatus==="open"){return;}this.options.onShowSubMenu_begin(this);if(this.subMenuType=="init"){this.btn.getParent().removeClass("f-mainparent-item");
|
|
this.btn.getParent().addClass("f-mainparent-itemfocus");}else{this.btn.getParent().removeClass("f-menuparent-item");this.btn.getParent().addClass("f-menuparent-itemfocus");
|
|
}this.root.subMenuZindex++;this.childMenu.setStyles({display:"block",visibility:"hidden","z-index":this.root.subMenuZindex});if(!this.width||!this.height){this.width=this.btn.fusionSize.width;
|
|
this.height=this.btn.fusionSize.height;this.childMenu.getFirst().setStyle("height",this.height,"border");if(this.options.effect=="slide"||this.options.effect=="slide and fade"){if(this.subMenuType=="init"&&this.options.orientation=="horizontal"){this.childMenu.getFirst().setStyle("margin-top","0");
|
|
if(this.options.direction.y=="down"){this.myEffect.set({"margin-top":-this.height});}else{if(this.options.direction.y=="up"){this.myEffect.set({"margin-top":this.height});
|
|
}}}else{if(this.options.direction.x=="left"){if(!this.rtl){tmp={"margin-left":this.width};}else{tmp={"margin-right":-this.width};}this.myEffect.set(tmp);
|
|
}else{if(!this.rtl){tmp={"margin-left":-this.width};}else{tmp={"margin-right":this.width};}this.myEffect.set(tmp);}}}}this.matchWidth();this.positionSubMenu();
|
|
this.fixedHeader=document.body.hasClass("fixedheader-1");if(this.fixedHeader&&!this.scrollingEvent){this.scrollingEvent=true;window.addEvent("scroll",function(){this.positionSubMenu();
|
|
}.bind(this));this.positionSubMenu();}if(this.options.effect=="slide"){this.childMenu.setStyles({display:"block",visibility:"visible"});if(this.subMenuType==="init"&&this.options.orientation==="horizontal"){if(e){this.myEffect.set({"margin-top":0}).chain(function(){this.showSubMenuComplete();
|
|
}.bind(this));}else{this.myEffect.start({"margin-top":0}).chain(function(){this.showSubMenuComplete();}.bind(this));}}else{if(!this.rtl){tmp={"margin-left":0};
|
|
}else{tmp={"margin-right":0};}if(e){this.myEffect.set(tmp).chain(function(){this.showSubMenuComplete();}.bind(this));}else{this.myEffect.start(tmp).chain(function(){this.showSubMenuComplete();
|
|
}.bind(this));}}}else{if(this.options.effect=="fade"){if(e){this.myEffect.set({opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete();
|
|
}.bind(this));}else{this.myEffect.start({opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete();}.bind(this));}}else{if(this.options.effect=="slide and fade"){this.childMenu.setStyles({display:"block",visibility:"visible"});
|
|
this.childMenu.getFirst().setStyles({left:0});if(this.subMenuType=="init"&&this.options.orientation=="horizontal"){if(e){this.myEffect.set({"margin-top":0,opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete();
|
|
}.bind(this));}else{this.myEffect.start({"margin-top":0,opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete();}.bind(this));}}else{if(!this.rtl){tmp={"margin-left":0,opacity:this.options.opacity};
|
|
}else{tmp={"margin-right":0,opacity:this.options.opacity};}if(e){if(this.options.direction.x=="right"){this.myEffect.set(tmp).chain(function(){this.showSubMenuComplete();
|
|
}.bind(this));}else{if(this.options.direction.x=="left"){this.myEffect.set(tmp).chain(function(){this.showSubMenuComplete();}.bind(this));}}}else{if(this.options.direction.x=="right"){this.myEffect.set({"margin-left":-this.width,opacity:this.options.opacity});
|
|
this.myEffect.start(tmp).chain(function(){this.showSubMenuComplete();}.bind(this));}else{if(this.options.direction.x=="left"){this.myEffect.set({"margin-left":this.width,opacity:this.options.opacity});
|
|
this.myEffect.start(tmp).chain(function(){this.showSubMenuComplete();}.bind(this));}}}}}else{this.childMenu.setStyles({display:"block",visibility:"visible"});
|
|
this.showSubMenuComplete(this);}}}this.childMenu.fusionStatus="open";},showSubMenuComplete:function(){this.options.onShowSubMenu_complete(this);},positionSubMenu:function(){this.options.onPositionSubMenu_begin(this);
|
|
var q=this.childMenu.getStyle("padding-bottom").toInt()+this.options.tweakSizes.height;var e=this.options.tweakSizes.width;if(!Browser.opera||!Browser.firefox||!Browser.safari){e=0;
|
|
q=0;}if(!this.rtl){this.childMenu.setStyles({width:this.width+this.options.tweakSizes.width,"padding-bottom":this.options.tweakSizes.height,"padding-top":this.options.tweakSizes.height/2,"padding-left":this.options.tweakSizes.width/2});
|
|
}else{this.childMenu.setStyles({width:this.width+this.options.tweakSizes.width,"padding-bottom":this.options.tweakSizes.height,"padding-top":this.options.tweakSizes.height/2,"padding-right":this.options.tweakSizes.width/2});
|
|
}this.childMenu.getFirst().setStyle("width",this.width);if(this.subMenuType=="subseq"){this.options.direction.x="right";this.options.direction.xInverse="left";
|
|
this.options.direction.y="down";this.options.direction.yInverse="up";if(this.rtl){this.options.direction.x="left";this.options.direction.xInverse="right";
|
|
}}var l;var n;if(this.subMenuType=="init"){if(this.options.direction.y=="up"){if(this.options.orientation=="vertical"){l=this.btn.getCoordinates().bottom-this.height+this.options.tweakInitial.y;
|
|
}else{l=this.btn.getCoordinates().top-this.height+this.options.tweakInitial.y;}this.childMenu.style.top=l+"px";}else{if(this.options.orientation=="horizontal"){this.childMenu.style.top=this.btn.getCoordinates().bottom+this.options.tweakInitial.y+"px";
|
|
}else{if(this.options.orientation=="vertical"){l=this.btn.getPosition().y+this.options.tweakInitial.y;if((l+this.childMenu.getSize2().y)>=document.body.getScrollSize2().y){n=(l+this.childMenu.getSize2().y)-document.body.getScrollSize2().y;
|
|
l=l-n-20;}this.childMenu.style.top=l+"px";}}}if(this.options.orientation=="horizontal"){var h=this.btn.getPosition().x+this.options.tweakInitial.x,f=0;
|
|
if(this.rtl){var o=0;if(this.btn.getStyle("margin-left").toInt()<0&&!this.options.centered){o=this.btn.getParent().getPosition().x+this.options.tweakInitial.x;
|
|
}else{if(this.btn.getStyle("margin-left").toInt()<0&&this.options.centered){o=this.btn.getPosition().x-this.options.tweakInitial.x;}else{o=this.btn.getPosition().x;
|
|
}}h=o+this.btn.getSize2().x-this.childMenu.getSize2().x;}if(this.options.centered){f=0;var p=this.btn.getSize2().x;if(this.btn.getStyle("margin-left").toInt()<0&&!this.rtl){f=Math.abs(this.btn.getStyle("margin-left").toInt())-Math.abs(this.btn.getFirst().getStyle("padding-left").toInt());
|
|
}else{f=Math.abs(this.btn.getStyle("margin-right").toInt())-Math.abs(this.btn.getFirst().getStyle("padding-right").toInt());}var m=this.childMenu.getSize2().x;
|
|
p+=f;var k=Math.max(p,m),g=Math.min(p,m);size=(k-g)/2;if(!this.rtl){h-=size;}else{h+=size;}}this.childMenu.style.left=h+"px";}else{if(this.options.direction.x=="left"){this.childMenu.style.left=this.btn.getPosition().x-this.childMenu.getCoordinates().width+this.options.tweakInitial.x+"px";
|
|
}else{if(this.options.direction.x=="right"){this.childMenu.style.left=this.btn.getCoordinates().right+this.options.tweakInitial.x+"px";}}}}else{if(this.subMenuType=="subseq"){if(this.options.direction.y==="down"){if((this.btn.getCoordinates().top+this.options.tweakSubsequent.y+this.childMenu.getSize2().y)>=document.body.getScrollSize2().y){n=(this.btn.getCoordinates().top+this.options.tweakSubsequent.y+this.childMenu.getSize2().y)-document.body.getScrollSize2().y;
|
|
this.childMenu.style.top=(this.btn.getCoordinates().top+this.options.tweakSubsequent.y)-n-20+"px";}else{this.childMenu.style.top=this.btn.getCoordinates().top+this.options.tweakSubsequent.y+"px";
|
|
}}else{if(this.options.direction.y==="up"){if((this.btn.getCoordinates().bottom-this.height+this.options.tweakSubsequent.y)<1){this.options.direction.y="down";
|
|
this.options.direction.yInverse="up";this.childMenu.style.top=this.btn.getCoordinates().top+this.options.tweakSubsequent.y+"px";}else{this.childMenu.style.top=this.btn.getCoordinates().bottom-this.height+this.options.tweakSubsequent.y+"px";
|
|
}}}if(this.options.direction.x=="left"){this.childMenu.style.left=this.btn.getCoordinates().left-this.childMenu.getCoordinates().width+this.options.tweakSubsequent.x+"px";
|
|
if(this.childMenu.getPosition().x<0){this.options.direction.x="right";this.options.direction.xInverse="left";this.childMenu.style.left=this.btn.getPosition().x+this.btn.getCoordinates().width+this.options.tweakSubsequent.x+"px";
|
|
if(this.options.effect==="slide"||this.options.effect==="slide and fade"){if(!this.rtl){tmp={"margin-left":-this.width,opacity:this.options.opacity};}else{tmp={"margin-right":this.width,opacity:this.options.opacity};
|
|
}this.myEffect.set(tmp);}}}else{if(this.options.direction.x=="right"){this.childMenu.style.left=this.btn.getCoordinates().right+this.options.tweakSubsequent.x+"px";
|
|
var i=this.childMenu.getCoordinates().right;var j=document.body.getSize2().x+window.getScroll2().x;if(i>j){this.options.direction.x="left";this.options.direction.xInverse="right";
|
|
this.childMenu.style.left=this.btn.getCoordinates().left-this.childMenu.getCoordinates().width-this.options.tweakSubsequent.x+"px";if(this.options.effect=="slide"||this.options.effect=="slide and fade"){if(!this.rtl){tmp={"margin-left":this.width,opacity:this.options.opacity};
|
|
}else{tmp={"margin-right":-this.width,opacity:this.options.opacity};}this.myEffect.set(tmp);}}}}}}this.options.onPositionSubMenu_complete(this);}});Element.implement({getCustomID:function(){if(!this.id){var e=this.get("tag")+"-"+Date.now()+Number.random(0,1000);
|
|
this.id=e;}return this.id;}});Element.implement({getSize2:function(){if((/^(?:body|html)$/i).test(this.tagName)){return this.getWindow().getSize();}return{x:this.offsetWidth,y:this.offsetHeight};
|
|
},getScrollSize2:function(){if((/^(?:body|html)$/i).test(this.tagName)){return this.getWindow().getScrollSize();}return{x:this.scrollWidth,y:this.scrollHeight};
|
|
},getScroll2:function(){if((/^(?:body|html)$/i).test(this.tagName)){return this.getWindow().getScroll();}return{x:this.scrollLeft,y:this.scrollTop};}});
|
|
[Document,Window].each(function(e){e.implement({getSize2:function(){return this.getSize();},getScroll2:function(){return this.getScroll();},getScrollSize2:function(){return this.getScrollSize();
|
|
}});});if(!Browser.Engine){if(Browser.Platform.ios){Browser.Platform.ios=true;}Browser.Engine={};var d=function(f,e){Browser.Engine.name=f;Browser.Engine[f+e]=true;
|
|
Browser.Engine.version=e;};if(Browser.ie){Browser.ie=true;switch(Browser.version){case 6:d("trident",4);break;case 7:d("trident",5);break;case 8:d("trident",6);
|
|
}}if(Browser.firefox){Browser.firefox=true;if(Browser.version>=3){d("gecko",19);}else{d("gecko",18);}}if(Browser.safari||Browser.chrome){Browser.safari=true;
|
|
switch(Browser.version){case 2:d("webkit",419);break;case 3:d("webkit",420);break;case 4:d("webkit",525);}}if(Browser.opera){Browser.opera=true;if(Browser.version>=9.6){d("presto",960);
|
|
}else{if(Browser.version>=9.5){d("presto",950);}else{d("presto",925);}}}if(Browser.name=="unknown"){switch((ua.match(/(?:webkit|khtml|gecko)/)||[])[0]){case"webkit":case"khtml":Browser.safari=true;
|
|
break;case"gecko":Browser.firefox=true;}}}window.Fusion=a;})()); |