Template:Amsterdam/skel-layers.min.js

/* skel-layers.js v1.0.0 | (c) n33 | getskel.com | MIT licensed */

skel.registerPlugin("layers",function(e){function dn(e,r,i){var o,u;this.id=e,this.index=i,this[n]={breakpoints:T,states:T,position:T,side:T,animation:bt,orientation:bt,width:0,height:0,zIndex:this.index,html:"",hidden:P,exclusive:Ot,resetScroll:Ot,resetForms:Ot,swipeToHide:Ot,clickToHide:P},t._.extend(this[n],r),this[W]=t._.newDiv(this[n][qt]),this[W].id=e,this[W]._layer=this,this[s]=T,this[St]=T,this[xt]=T,this[U]=P,u=t._.newElement(this.id,this[W],ht,1),u.onAttach=function(){var e=this[Kt]._layer;e[rt]()||e.init(),e.resume()},u.onDetach=function(){var e=this[Kt]._layer;e.suspend()},this[n].states&&this[n].states!=t._.sd?(t._.cacheElement(u),o=t._[an](this[n].states),t._[_t](o,function(e){t._.addCachedElementToState(o[e],u)})):this[n].breakpoints?(t._.cacheElement(u),o=t._[an](this[n].breakpoints),t._[_t](o,function(e){t._.addCachedElementToBreakpoint(o[e],u)})):t._.attachElement(u)}var t,n="config",r="_skel_layers_translateOrigin",i="cache",s="$element",o="_skel_layers_translate",u="_skel_layers_resetForms",f="visibleWrapper",l="_skel_layers_resume",c="_skel_layers_promote",h="exclusiveLayer",p="_skel_layers_demote",d="moveToVisibleWrapper",v="moveToHiddenWrapper",m="setTimeout",g="right",y="bottom",b="position",w="useActive",E="width",S="css",x="scrollTop",T=null,N="center",C="_skel_layers_suspend",k="prototype",L="left",A="wrapper",O="skel-layers-layer-z-index",M="_skel_layers_init",_="children",D="skel-layers-moved",P=!1,H=".skel-layers-fixed:not(.skel-layers-moved)",B="transform",j="length",F="height",I="top",q="deviceType",R="touchstart.lock click.lock scroll.lock",U="visible",z="hiddenWrapper",W="element",X='
1){for(t=0;t<this[j];t++)e(this[t])[p]();return e(this)}return n=e(this),n[S](at,n.data(O)).data(O,""),n},e.fn[Nt]=function(){var t=e(this),n=t.parent(),r=12;n[_]().each(function(){var t=e(this),n=t[kt]("class");n&&n.match(/(\s+|^)([0-9]+)u(\s+|$)/)&&(r-=parseInt(RegExp.$2))}),r>0&&(t[dt](),t[S](E,(t.data(Vt)+r)/12*100+"%"))},e.fn[Lt]=function(){return e(this).parents()[j]>0},e.fn[dt]=function(){var t=e(this);t[kt]("class").match(/(\s+|^)([0-9]+)u(\s+|$)/)&&t.data(Vt,parseInt(RegExp.$2))},e.fn[c]=function(r){var i,s,o;if(this[j]>1){for(i=0;i<this[j];i++)e(this[i])[c](r);return e(this)}return s=e(this),isNaN(o=parseInt(s.data(ut)))&&(o=0),s.data(O,s[S](at))[S](at,t[n].baseZIndex+o+(r?r:1)),s},e.fn[u]=function(){var t=e(this);return e(this)[Et]("form").each(function(){this.reset()}),t},e.fn[Rt]=function(t,n){return e(this)[S](t,n)[S](Ct+t,Ct+n)[S](G+t,G+n)[S](Ut+t,Ut+n)[S](Bt+t,Bt+n)},e.fn._skel_layers_xcssProperty=function(t,n){return e(this)[S](t,n)[S](Ct+t,n)[S](G+t,n)[S](Ut+t,n)[S](Bt+t,n)},e.fn._skel_layers_xcssValue=function(t,n){return e(this)[S](t,n)[S](t,Ct+n)[S](t,G+n)[S](t,Ut+n)[S](t,Bt+n)},dn[k][lt]={none:{show:function(e){var t=e[n],r=e[s];r[x](0)[c](t.zIndex)[tn](),t[$]&&r[u](),e[d]()},hide:function(e){var t=e[n],r=e[s];r[Ft]()[p](),e[v]()}},overlayX:{show:function(e){var r=e[n],i=e[s];i[x](0)[c](r.zIndex)[S](r[sn],Zt+t[Y](t._[w](r[E]))+Gt)[tn](),r[$]&&i[u](),t[Ht]("x"),e[d](),window[m](function(){i[o]((r[sn]==g?Zt:"")+t[Y](t._[w](r[E])),0)},50)},hide:function(e){var i=e[n],o=e[s];o[Et](pn).blur(),o[r](),window[m](function(){t[ct]("x"),e[v](),o[p]()[Ft]()},t[n][wt]+50)}},overlayY:{show:function(e){var r=e[n],i=e[s];i[x](0)[c](r.zIndex)[S](r[sn],Zt+t[Y](t._[w](r[F]))+Gt)[tn](),r[$]&&i[u](),t[Ht]("y"),e[d](),window[m](function(){i[o](0,(r[sn]==y?Zt:"")+t[Y](t._[w](r[F])))},50)},hide:function(e){var i=e[n],o=e[s];o[Et](pn).blur(),o[r](),window[m](function(){t[ct]("y"),e[v](),o[p]()[Ft]()},t[n][wt]+50)}},pushX:{show:function(e){var r=e[n],a=e[s],l=t[i][A].add(t[i][f][_]());a[x](0)[S](r[sn],Zt+t[Y](t._[w](r[E]))+Gt)[tn](),r[$]&&a[u](),l[c](),t[Ht]("x"),e[d](),window[m](function(){a.add(l)[o]((r[sn]==g?Zt:"")+t[Y](t._[w](r[E])),0)},50)},hide:function(e){var o=e[n],u=e[s],a=t[i][A].add(t[i][f][_]());u[Et](pn).blur(),u.add(a)[r](),window[m](function(){t[ct]("x"),u[Ft](),e[v](),a[p]()},t[n][wt]+50)}},pushY:{show:function(e){var r=e[n],a=e[s],l=t[i][A].add(t[i][f][_]());a[x](0)[S](r[sn],Zt+t[on](t._[w](r[F]))+Gt)[tn](),r[$]&&a[u](),t[Ht]("y"),e[d](),window[m](function(){a.add(l)[o](0,(r[sn]==y?Zt:"")+t[on](t._[w](r[F])))},50)},hide:function(e){var o=e[n],u=e[s],a=t[i][A].add(t[i][f][_]());u[Et](pn).blur(),u.add(a)[r](),window[m](function(){t[ct]("y"),u[Ft](),e[v]()},t[n][wt]+50)}},revealX:{show:function(e){var r=e[n],a=e[s],l=t[i][A].add(t[i][f][_]());a[x](0)[tn](),r[$]&&a[u](),l[c](),t[Ht]("x"),e[d](),window[m](function(){l[o]((r[sn]==g?Zt:"")+t[Y](t._[w](r[E])),0)},50)},hide:function(e){var o=e[n],u=e[s],a=t[i][A].add(t[i][f][_]());u[Et](pn).blur(),a[r](),window[m](function(){t[ct]("x"),u[Ft](),a[p](),e[v]()},t[n][wt]+50)}}},dn[k][Tt]={"top-left":{v:I,h:L,side:L},"top-right":{v:I,h:g,side:g},top:{v:I,h:N,side:I},"top-center":{v:I,h:N,side:I},"bottom-left":{v:y,h:L,side:L},"bottom-right":{v:y,h:g,side:g},bottom:{v:y,h:N,side:y},"bottom-center":{v:y,h:N,side:y},left:{v:N,h:L,side:L},"center-left":{v:N,h:L,side:L},right:{v:N,h:g,side:g},"center-right":{v:N,h:g,side:g}},dn[k][tn]=function(){var e,r,o,u;if(this[U]){t[i][f][At](this[W]);return}e=this[n],r=t._[w](e[st]),o=this[s],o[S](E,t._[w](e[E]))[S](F,t._[w](e[F])),t._[$t][q]=="ios"&&e[F]=="100%"&&!e[tt]&&o[S](F,"-webkit-calc("+t._[w](e[F])+" + 70px)"),u=this[Tt][e[b]],o[Mt]("skel-layer-"+e[b]).data(ot,e[b]);switch(u.v){case I:o[S](I,0);break;case y:o[S](y,0);break;case N:o[S](I,"50%")[S]("margin-top",Zt+t.getHalf(e[F]))}switch(u.h){case L:o[S](L,0);break;case g:o[S](g,0);break;case N:o[S](L,"50%")[S]("margin-left",Zt+t.getHalf(e[E]))}this[lt][r][tn](this),e[tt]&&e.exclusive&&(t[i][Qt][Mt](Z),t[i][h]=this),this[U]=Ot},dn[k][Ft]=function(){var e,r;if(!this[U]){t[i][z][At](this[W]);return}e=this[n],r=t._[w](e[st]),r in this[lt]||(r=bt),this[lt][r][Ft](this),e[tt]&&e.exclusive&&t[i][h]===this&&(t[i][Qt][Xt](Z),t[i][h]=T),this[U]=P},dn[k].init=function(){var r=this[n],o=e(this[W]),u=this;o[M](),o[Et](pn).each(function(){t.parseInit(e(this))}),o[Mt]("skel-layer").data(ut,this.index)[S](at,t[n].baseZIndex)[S](b,"fixed")[S]("-ms-overflow-style","-ms-autohiding-scrollbar")[S]("-webkit-overflow-scrolling","touch")[Ft]();switch(r.orientation){case"vertical":o[S]("overflow-y",jt);break;case"horizontal":o[S](J,jt);break;case bt:default:}if(!r[b]||!(r[b]in this[Tt]))r[b]="top-left";r[sn]||(r[sn]=this[Tt][r[b]][sn]);if(!r[st]||typeof r[st]!==Kt&&!(r[st]in this[lt]))r[st]=bt;r.clickToHide&&o[Et]("a")[S](nt,Wt).on("click.skel-layers",function(r){var i,s,o=e(this);if(o.hasClass("skel-layers-ignore"))return;r[K](),r[V](),u[Ft]();if(o.hasClass("skel-layers-ignoreHref"))return;i=o[kt]("href"),s=o[kt]("target"),typeof i!==gt&&i!=""&&window[m](function(){s=="_blank"&&t._[$t][q]!="wp"?window.open(i):window.location.href=i},t[n][wt]+10)}),t._[$t][q]=="ios"&&o[Et]("input,select,textarea").on("focus",function(n){var r=e(this);n[K](),n[V](),window[m](function(){var e=t[i][Q][It],n=t[i][Q][x]()-e;t[i][Q][x](e),o[x](o[x]()+n),r[Ft](),window[m](function(){r[tn]()},0)},100)}),t._[$t][Dt]&&o.on("touchstart",function(e){u[St]=e[it][nn][0].pageX,u[xt]=e[it][nn][0].pageY}).on("touchmove",function(e){var t,n,i,s,a,f,l;if(u[St]===T||u[xt]===T)return;t=u[St]-e[it][nn][0].pageX,n=u[xt]-e[it][nn][0].pageY,i=o.outerHeight(),s=o.get(0).scrollHeight-o[x]();if(r[tt]&&r.swipeToHide){a=P,f=20,l=50;switch(r[sn]){case L:a=n<f&&n>-1*f&&t>l;break;case g:a=n<f&&n>-1*f&&t<-1*l;break;case I:a=t<f&&t>-1*f&&n>l;break;case y:a=t<f&&t>-1*f&&n<-1*l}if(a)return u[St]=T,u[xt]=T,u[Ft](),P}if(o[x]()==0&&n<0||s>i-2&&s<i+2&&n>0)return P}),this[s]=o},dn[k][rt]=function(){return this[s]!==T},dn[k][rn]=function(){return this[s].is(":visible")},dn[k][d]=function(){t[i][f][At](this[s])},dn[k][v]=function(){if(!this[s][Lt]())return;t[i][z][At](this[s])},dn[k].resume=function(r){if(!this[rt]())return;this[s][Et](pn).each(function(){t.parseResume(e(this))}),this[n][tt]||this[tn](r)},dn[k].suspend=function(){if(!this[rt]())return;this[s][r](),this[s][Et](pn).each(function(){t.parseSuspend(e(this))}),this[U]&&this[Ft]()},t={cache:{visibleWrapper:T,body:T,exclusiveLayer:T,html:T,htmlbody:T,hiddenWrapper:T,layers:{},window:T,wrapper:T},config:{baseZIndex:1e4,layers:{},speed:250,transform:Ot,transformBreakpoints:T,transformTest:T},eventType:Yt,show:function(e){t._[Pt](function(){t[i][pt][e][tn]()})},hide:function(e){t._[Pt](function(){t[i][pt][e][Ft]()})},toggle:function(e){t._[Pt](function(){var n=t[i][pt][e];n[rn]()?n[Ft]():n[tn]()})},getBaseFontSize:function(){return t._[$t].IEVersion<9?16.5:parseFloat(getComputedStyle(t[i][Qt].get(0)).fontSize)},getHalf:function(e){var t=parseInt(e);return typeof e=="string"&&e.charAt(e[j]-1)=="%"?Math.floor(t/2)+"%":Math.floor(t/2)+Gt},lockView:function(e){t[i][Q][It]=t[i][Q][x](),t._[$t][Dt]&&t[i][cn][S](en+e,tt),t[i][A].on(R,function(e){e[K](),e[V](),t[i][h]&&t[i][h][Ft]()}),t[i][Q].on(yt,function(e){t[i][h]&&t[i][h][Ft]()}),t._[$t][Dt]||t[i][Q].on(vt,function(e){t[i][h]&&t[i][h][Ft]()})},parseInit:function(n){var r,s,o=n.get(0),u=n[kt]("data-action"),a=n[kt]("data-args"),f,c;u&&a&&(a=a.split(","));switch(u){case"toggleLayer":case"layerToggle":n[S](nt,Wt)[S]("cursor","pointer"),r=function(n){n[K](),n[V]();if(t[i][h])return t[i][h][Ft](),P;var r=e(this),s=t[i][pt][a[0]];s[rn]()?s[Ft]():s[tn]()},t._[$t][q]==fn||t._[$t][q]=="wp"?n.on(Yt,r):n.on(t.eventType,r);break;case"navList":f=e(hn+a[0]),r=f[Et]("a"),s=[],r.each(function(){var t=e(this),n,r;n=Math.max(0,t.parents("li")[j]-1),r=t[kt]("href"),s.push('<a class="link depth-'+n+'"'+(typeof r!==gt&&r!=""?' href="'+r+'"':"")+'>'+t.text()+"</a>")}),s[j]>0&&n[qt]("<nav>"+s.join("")+"</nav>");break;case"copyText":f=e(hn+a[0]),n[qt](f.text());break;case"copyHTML":f=e(hn+a[0]),n[qt](f[qt]());break;case"moveElementContents":f=e(hn+a[0]),o[l]=function(){f[_]().each(function(){var t=e(this);n[At](t),t[Mt](D)})},o[C]=function(){n[_]().each(function(){var n=e(this);f[At](n),n[Xt](D),t.refresh(n)})},o[l]();break;case"moveElement":f=e(hn+a[0]),o[l]=function(){e(X+f[kt]("id")+'" />').insertBefore(f),n[At](f),f[Mt](D)},o[C]=function(){e(ft+f[kt]("id")).replaceWith(f),f[Xt](D),t.refresh(f)},o[l]();break;case"moveCell":f=e(hn+a[0]),c=e(hn+a[1]),o[l]=function(){e(X+f[kt]("id")+'" />').insertBefore(f),n[At](f),f[S](E,jt),c&&c[Nt]()},o[C]=function(){e(ft+f[kt]("id")).replaceWith(f),f[S](E,""),c&&c[S](E,"")},o[l]();break;default:}},parseResume:function(e){var t=e.get(0);t[l]&&t[l]()},parseSuspend:function(e){var t=e.get(0);t[C]&&t[C]()},recalc:function(e,n){var r=t._.parseMeasurement(e),i;switch(r[1]){case"%":i=Math.floor(n*(r[0]/100));break;case"em":i=t.getBaseFontSize()*r[0];break;default:case Gt:i=r[0]}return i},recalcH:function(n){return t.recalc(n,e(window)[F]())},recalcW:function(n){return t.recalc(n,e(window)[E]())},refresh:function(r){var s;t[n][B]&&(r?s=r.filter(H):s=e(H),s[M]()[Jt](t[i][f]))},unlockView:function(e){t._[$t][Dt]&&t[i][cn][S](en+e,U),t[i][A].off(R),t[i][Q].off(yt),t._[$t][Dt]||t[i][Q].off(vt)},init:function(){n in t[n]&&(t._.extend(t[n],t[n][n]),delete t[n][n]),t._[_t](t[n],function(e){t[n][e]&&typeof t[n][e]==Kt&&b in t[n][e]&&(t[n][pt][e]=t[n][e],delete t[n][e])}),t[n][ln]&&(t[n][B]=t[n][ln]());if(t[n][B]){if(t._[$t][q]==fn&&t._[$t].deviceVersion<4||t._[$t][q]=="wp")t[n][B]=P;t._[$t].IEVersion<10&&(t[n][B]=P),t[n][zt]&&!t._.hasActive(t._[an](t[n][zt]))&&(t[n][B]=P)}t.eventType=t._[$t][Dt]?"touchend":Yt,t.initObjects(),t.initTransforms(),t._[Pt](function(){t.initLayers(),t.initIncludes(),t._.updateState(),t.refresh()})},initIncludes:function(){e(".skel-layers-include").each(function(){t.parseInit(e(this))})},initLayers:function(){var r,s,o,u=1;t._[_t](t[n][pt],function(r){var s;if(!(b in t[n][pt][r]))return;if(!t[n][pt][r][qt]&&(s=e(hn+r))[j]==0)return;o=new dn(r,t[n][pt][r],u++),t[i][pt][r]=o,s&&(s[_]()[Jt](o[W]),s.remove())})},initObjects:function(){t[i][Q]=e(window),t._[Pt](function(){t[i][qt]=e(qt),t[i][Qt]=e(Qt),t[i][cn]=e("html,body"),t[i][Qt].wrapInner('<div id="skel-layers-wrapper" />'),t[i][A]=e("#skel-layers-wrapper"),t[i][A][S](b,un)[S](L,"0")[S](g,"0")[S](I,"0")[M](),t[i][z]=e('<div id="skel-layers-hiddenWrapper" />')[Jt](t[i][Qt]),t[i][z][S](F,"100%"),t[i][f]=e('<div id="skel-layers-visibleWrapper" />')[Jt](t[i][Qt]),t[i][f][S](b,un),t._[mt](ht,t[i][z][0]),t._[mt]("skel_layers_visibleWrapper",t[i][f][0]),t._[mt]("skel_layers_wrapper",t[i][A][0]),e("[autofocus]").focus()})},initTransforms:function(){if(t[n][B])e.fn[r]=function(){return e(this)[o](0,0)},e.fn[o]=function(t,n){return e(this)[S](B,"translate("+t+"px, "+n+"px)")},e.fn[M]=function(){return e(this)[S]("backface-visibility",tt)[S]("perspective","500")[Rt]("transition","transform "+t[n][wt]/1e3+"s ease-in-out")};else{var s,u=[];t[i][Q].resize(function(){if(t[n][wt]!=0){var e=t[n][wt];t[n][wt]=0,window[m](function(){t[n][wt]=e,u=[]},e)}}),e.fn[r]=function(){for(var r=0;r<this[j];r++){var s=this[r],o=e(s);u[s.id]&&o.animate(u[s.id],t[n][wt],"swing",function(){t._[_t](u[s.id],function(e){o[S](e,u[s.id][e])}),t[i][Qt][S](J,U),t[i][A][S](E,jt)[S](et,0)})}return e(this)},e.fn[o]=function(r,s){var o,f,l,c;r=parseInt(r),s=parseInt(s),r!=0?(t[i][Qt][S](J,tt),t[i][A][S](E,t[i][Q][E]())):l=function(){t[i][Qt][S](J,U),t[i][A][S](E,jt)},s<0?t[i][A][S](et,Math.abs(s)):c=function(){t[i][A][S](et,0)};for(o=0;o<this[j];o++){var h=this[o],p=e(h),d;if(!u[h.id])if(d=dn[k][Tt][p.data(ot)]){u[h.id]={};switch(d.v){case N:case I:u[h.id][I]=parseInt(p[S](I));break;case y:u[h.id][y]=parseInt(p[S](y))}switch(d.h){case N:case L:u[h.id][L]=parseInt(p[S](L));break;case g:u[h.id][g]=parseInt(p[S](g))}}else d=p[b](),u[h.id]={top:d[I],left:d[L]};a={},t._[_t](u[h.id],function(e){var n;switch(e){case I:n=t[on](u[h.id][e])+s;break;case y:n=t[on](u[h.id][e])-s;break;case L:n=t[Y](u[h.id][e])+r;break;case g:n=t[Y](u[h.id][e])-r}a[e]=n}),p.animate(a,t[n][wt],"swing",function(){l&&l(),c&&c()})}return e(this)},e.fn[M]=function(){return e(this)[S](b,"absolute")}}}},t)}(jQuery));