All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webclient.js-ext.accordion-min.js Maven / Gradle / Ivy

/*
Copyright (c) 2008, Bubbling Library Team. All rights reserved.
Portions Copyright (c) 2008, Yahoo!, Inc. All rights reserved.
Code licensed under the BSD License:
http://www.bubbling-library.com/eng/licence
version: 2.1
*/
(function(){var C=YAHOO.Bubbling,D=YAHOO.lang,A=YAHOO.util.Event,B=YAHOO.util.Dom;YAHOO.widget.AccordionManager=function(){var H={},G="selected",I="sliding",P={};C.on("navigate",function(R,Q){var S=C.getOwnerByClassName(Q[1].target,"trigger");if(!Q[1].flagged&&S){if(H.toggle(Q[1].target)){Q[1].stop=true;Q[1].flagged=true}}});C.addDefaultAction("accordionToggleItem",function(R,Q){if(!Q[1].flagged){return H.toggle(Q[1].target)}});C.addDefaultAction("accordionRemoveItem",function(R,Q){if(!Q[1].flagged){return H.remove(Q[1].target)}});C.on("accordionOpenItem",function(T,S){var Q=/.*#/;if(B.hasClass(S[1].slide,"ajax")&&D.isObject(YAHOO.plugin.Dispatcher)){var R=B.getElementsByClassName("accordionToggleItem","*",S[1].el);R=(R.length>0?R[0]:null);if(R&&(R=R.getAttribute("href",2))){YAHOO.plugin.Dispatcher.fetch(S[1].slide,R.replace(Q,""),{onLoad:function(U){B.setStyle(U,"height",U.scrollHeight+"px");if(!B.hasClass(U,"nocache")){B.removeClass(U,"ajax")}}})}}});C.on("key",function(S,R){var V=R[1],U=null,Q=false,T;if(!V.flagged&&(V.type=="keyup")&&(T=C.getOwnerByClassName(V.target,"trigger"))){if(((V.keyCode===39)&&H.open(T))||((V.keyCode===37)&&H.close(T))){V.flagged=true;V.stop=true}}});C.on("rollover",function(R,Q){var U,T,S;if(T=E(Q[1].target)){if((U=N(T))&&U.rollover){if(!U.selected){B.addClass(U.el,G);S=function(W){var V=N({el:A.getTarget(W)});if(V&&!C.virtualTarget(W,V.el)&&!V.persistent){M(V,{force:true})}};if(!U.persistent){A.removeListener(U.el,"mouseout",S);A.addListener(U.el,"mouseout",S,H,true)}}if(!T.selected){K(T,U)}}}});C.addLayer(["accordionOpenItem","accordionCloseItem","accordionRemoveItem"],H);function J(R){var Q=R.getAttribute("rel")||null;if(Q){Q=YAHOO.util.Easing[Q]||null}return Q}function O(R){var Q=(B.hasClass(R,"fast")?0.1:null)||(B.hasClass(R,"slow")?0.6:null)||0.4;return Q}function E(V){if(V&&(D.isObject(V)||(V=B.get(V)))){var U,T=C.getOwnerByClassName(V,"yui-cms-item");if(D.isObject(T)){U={el:T,triger:V,selected:B.hasClass(T,G),sliding:B.hasClass(T,I),size:{width:0,Height:0}};var Q=B.getElementsByClassName("bd","*",T);Q=(Q.length>0?Q[0]:B.getNextSiblingBy(T,function(W){return B.hasClass(W,"bd")}));if(U.slide=Q){var S=parseInt(B.getStyle(Q,"height"),10);var R=parseInt(B.getStyle(Q,"width"),10);if(!D.isNumber(S)){B.setStyle(Q,"height",Q.scrollHeight+"px")}if(!D.isNumber(R)){B.setStyle(Q,"width",Q.scrollWidth+"px")}U.size.height=Q.scrollHeight;U.size.width=Q.scrollWidth}else{return false}}return U}}function N(R){var S=null,Q=R.el;if(Q&&(D.isObject(Q)||(Q=B.get(Q)))){if(Q=C.getOwnerByClassName(Q,"yui-cms-accordion")){S={el:Q,effect:J(Q),orientation:(B.hasClass(Q,"vertical")?"width":"height"),selected:B.hasClass(Q,G),fade:B.hasClass(Q,"fade"),manually:B.hasClass(Q,"manually"),fixIE:(A.isIE&&B.hasClass(Q,"fixIE")),multiple:B.hasClass(Q,"multiple"),rollover:B.hasClass(Q,"rollover"),persistent:B.hasClass(Q,"persistent"),dispatcher:B.hasClass(Q,"dispatcher"),wizard:B.hasClass(Q,"wizard"),timer:O(Q),items:[]};B.batch(B.getElementsByClassName("bd","*",Q),function(T){S.items.push(E(T))})}return S}}function M(U,V){V=V||{};var Q=[],R,T=V.force||false,S=V.item||null;if(U){if(!U.multiple||T){for(R=0;R=R[V.orientation].to;i--){B.setStyle(T.slide,V.orientation,i+"px")}onFinish()}P[A.generateId(T.slide)]=U;return true}return false}function F(Q,R){if(Q&&(R||(R=N(Q)))){L(Q,R);A.purgeElement(Q.el,true);window.setTimeout(function(){Q.el.parentNode.removeChild(Q.el);C.fire("accordionRemoveItem",Q)},R.timer+0.1);return true}return false}H.expand=function(Q){var R;if(R=N({el:Q})){return M(R,{force:true,expand:true})}};H.collapse=function(Q){var R;if(R=N({el:Q})){return M(R,{force:true})}};H.open=function(Q){var R;if(R=E(Q)){return K(R)}};H.close=function(Q){var R,S;if(R=E(Q)){if(S=N(R)){return((R.selected&&(S.multiple||!S.persistent))?L(R,S):false)}}};H.toggle=function(Q){var R,S;if(R=E(Q)){if(S=N(R)){return((R.selected&&(S.multiple||!S.persistent))?L(R,S):K(R,S))}}};H.remove=function(Q){var R,S;if(R=E(Q)){if(S=N(R)){return F(R,S)}}};return H}()})();YAHOO.register("accordion",YAHOO.widget.AccordionManager,{version:"2.1",build:"211"});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy