misp-website/_site/assets/js/skel-layers.min.js

2 lines
15 KiB
JavaScript
Executable File

/* skel-layers.js v1.0 | (c) n33 | n33.co | 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:Mt,resetScroll:Mt,resetForms:Mt,swipeToHide:Mt,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._.cacheElement(this.id,this[W],ct,1),u.onAttach=function(){var e=this[Vt]._layer;e[rt]()||e.init(),e.resume()},u.onDetach=function(){var e=this[Vt]._layer;e.suspend()},this[n].states&&this[n].states!=t._.sd?(o=t._[hn](this[n].states),t._[Ot](o,function(e){t._.addCachedElementToState(o[e],u)})):(this[n].breakpoints?o=t._[hn](this[n].breakpoints):o=t._.breakpointList,t._[Ot](o,function(e){t._.addCachedElementToBreakpoint(o[e],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='<div id="skel-layers-placeholder-',V="stopPropagation",$="resetForms",J="overflow-x",K="preventDefault",Q="window",G="-webkit-",Y="recalcW",Z="skel-layers-exclusiveVisible",et="padding-bottom",tt="hidden",nt="-webkit-tap-highlight-color",rt="isInitialized",it="animation",st="originalEvent",ot="skel-layers-layer-position",ut="skel-layers-layer-index",at="z-index",ft="unlockView",lt="animations",ct="skel_layers_hiddenWrapper",ht="#skel-layers-placeholder-",pt="layers",dt="_skel_layers_initializeCell",vt="resize.lock scroll.lock",mt="registerLocation",gt="undefined",yt="orientationchange.lock",bt="none",wt="find",Et="speed",St="touchPosX",xt="touchPosY",Tt="positions",Nt="_skel_layers_expandCell",Ct="-moz-",kt="attr",Lt="_skel_layers_hasParent",At="append",Ot="iterate",Mt=!0,_t="lockView",Dt="-ms-",Pt="DOMReady",Ht="isTouch",Bt="addClass",jt="hide",Ft="auto",It="_skel_layers_scrollPos",qt="html",Rt="_skel_layers_xcss",Ut="-o-",zt="transformBreakpoints",Wt="rgba(0,0,0,0)",Xt="removeClass",Vt="object",$t="appendTo",Jt="vars",Kt="cell-size",Qt="body",Gt="-",Yt="click",Zt="px",en="show",tn="side",nn="recalcH",rn="touches",sn="isVisible",on="overflow-",un="relative",an="android",fn="*",ln="htmlbody",cn="transformTest",hn="getArray",pn="#";return typeof e==gt?P:(e.fn[p]=function(){var t,n;if(this[j]>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(Kt)+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(Kt,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)[wt]("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](Dt+t,Dt+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](Dt+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,Dt+n)},dn[k][lt]={none:{show:function(e){var t=e[n],r=e[s];r[x](0)[c](t.zIndex)[en](),t[$]&&r[u](),e[d]()},hide:function(e){var t=e[n],r=e[s];r[jt]()[p](),e[v]()}},overlayX:{show:function(e){var r=e[n],i=e[s];i[x](0)[c](r.zIndex)[S](r[tn],Gt+t[Y](t._[w](r[E]))+Zt)[en](),r[$]&&i[u](),t[_t]("x"),e[d](),window[m](function(){i[o]((r[tn]==g?Gt:"")+t[Y](t._[w](r[E])),0)},50)},hide:function(e){var i=e[n],o=e[s];o[wt](fn).blur(),o[r](),window[m](function(){t[ft]("x"),e[v](),o[p]()[jt]()},t[n][Et]+50)}},overlayY:{show:function(e){var r=e[n],i=e[s];i[x](0)[c](r.zIndex)[S](r[tn],Gt+t[Y](t._[w](r[F]))+Zt)[en](),r[$]&&i[u](),t[_t]("y"),e[d](),window[m](function(){i[o](0,(r[tn]==y?Gt:"")+t[Y](t._[w](r[F])))},50)},hide:function(e){var i=e[n],o=e[s];o[wt](fn).blur(),o[r](),window[m](function(){t[ft]("y"),e[v](),o[p]()[jt]()},t[n][Et]+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[tn],Gt+t[Y](t._[w](r[E]))+Zt)[en](),r[$]&&a[u](),l[c](),t[_t]("x"),e[d](),window[m](function(){a.add(l)[o]((r[tn]==g?Gt:"")+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[wt](fn).blur(),u.add(a)[r](),window[m](function(){t[ft]("x"),u[jt](),e[v](),a[p]()},t[n][Et]+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[tn],Gt+t[nn](t._[w](r[F]))+Zt)[en](),r[$]&&a[u](),t[_t]("y"),e[d](),window[m](function(){a.add(l)[o](0,(r[tn]==y?Gt:"")+t[nn](t._[w](r[F])))},50)},hide:function(e){var o=e[n],u=e[s],a=t[i][A].add(t[i][f][_]());u[wt](fn).blur(),u.add(a)[r](),window[m](function(){t[ft]("y"),u[jt](),e[v]()},t[n][Et]+50)}},revealX:{show:function(e){var r=e[n],a=e[s],l=t[i][A].add(t[i][f][_]());a[x](0)[en](),r[$]&&a[u](),l[c](),t[_t]("x"),e[d](),window[m](function(){l[o]((r[tn]==g?Gt:"")+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[wt](fn).blur(),a[r](),window[m](function(){t[ft]("x"),u[jt](),a[p](),e[v]()},t[n][Et]+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][en]=function(){var e,r,o,u;if(this[U]){t[i][f][At](this[W]);return}e=this[n],r=t._[w](e[it]),o=this[s],o[S](E,t._[w](e[E]))[S](F,t._[w](e[F])),t._[Jt][q]=="ios"&&e[F]=="100%"&&!e[tt]&&o[S](F,"-webkit-calc("+t._[w](e[F])+" + 70px)"),u=this[Tt][e[b]],o[Bt]("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",Gt+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",Gt+t.getHalf(e[E]))}this[lt][r][en](this),e[tt]&&e.exclusive&&(t[i][Qt][Bt](Z),t[i][h]=this),this[U]=Mt},dn[k][jt]=function(){var e,r;if(!this[U]){t[i][z][At](this[W]);return}e=this[n],r=t._[w](e[it]),r in this[lt]||(r=bt),this[lt][r][jt](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[wt](fn).each(function(){t.parseInit(e(this))}),o[Bt]("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")[jt]();switch(r.orientation){case"vertical":o[S]("overflow-y",Ft);break;case"horizontal":o[S](J,Ft);break;case bt:default:}if(!r[b]||!(r[b]in this[Tt]))r[b]="top-left";r[tn]||(r[tn]=this[Tt][r[b]][tn]);if(!r[it]||typeof r[it]!==Vt&&!(r[it]in this[lt]))r[it]=bt;r.clickToHide&&o[wt]("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[jt]();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._[Jt][q]!="wp"?window.open(i):window.location.href=i},t[n][Et]+10)}),t._[Jt][q]=="ios"&&o[wt]("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[jt](),window[m](function(){r[en]()},0)},100)}),t._[Jt][Ht]&&o.on("touchstart",function(e){u[St]=e[st][rn][0].pageX,u[xt]=e[st][rn][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[st][rn][0].pageX,n=u[xt]-e[st][rn][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[tn]){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[jt](),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][sn]=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][wt](fn).each(function(){t.parseResume(e(this))}),this[n][tt]||this[en](r)},dn[k].suspend=function(){if(!this[rt]())return;this[s][r](),this[s][wt](fn).each(function(){t.parseSuspend(e(this))}),this[U]&&this[jt]()},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:Mt,transformBreakpoints:T,transformTest:T},eventType:Yt,show:function(e){t._[Pt](function(){t[i][pt][e][en]()})},hide:function(e){t._[Pt](function(){t[i][pt][e][jt]()})},toggle:function(e){t._[Pt](function(){var n=t[i][pt][e];n[sn]()?n[jt]():n[en]()})},getBaseFontSize:function(){return t._[Jt].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)+Zt},lockView:function(e){t[i][Q][It]=t[i][Q][x](),t._[Jt][Ht]&&t[i][ln][S](on+e,tt),t[i][A].on(R,function(e){e[K](),e[V](),t[i][h]&&t[i][h][jt]()}),t[i][Q].on(yt,function(e){t[i][h]&&t[i][h][jt]()}),t._[Jt][Ht]||t[i][Q].on(vt,function(e){t[i][h]&&t[i][h][jt]()})},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][jt](),P;var r=e(this),s=t[i][pt][a[0]];s[sn]()?s[jt]():s[en]()},t._[Jt][q]==an||t._[Jt][q]=="wp"?n.on(Yt,r):n.on(t.eventType,r);break;case"navList":f=e(pn+a[0]),r=f[wt]("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+'"':"")+'><span class="indent-'+n+'"></span>'+t.text()+"</a>")}),s[j]>0&&n[qt]("<nav>"+s.join("")+"</nav>");break;case"copyText":f=e(pn+a[0]),n[qt](f.text());break;case"copyHTML":f=e(pn+a[0]),n[qt](f[qt]());break;case"moveElementContents":f=e(pn+a[0]),o[l]=function(){f[_]().each(function(){var t=e(this);n[At](t),t[Bt](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(pn+a[0]),o[l]=function(){e(X+f[kt]("id")+'" />').insertBefore(f),n[At](f),f[Bt](D)},o[C]=function(){e(ht+f[kt]("id")).replaceWith(f),f[Xt](D),t.refresh(f)},o[l]();break;case"moveCell":f=e(pn+a[0]),c=e(pn+a[1]),o[l]=function(){e(X+f[kt]("id")+'" />').insertBefore(f),n[At](f),f[S](E,Ft),c&&c[Nt]()},o[C]=function(){e(ht+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 Zt: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]()[$t](t[i][f]))},unlockView:function(e){t._[Jt][Ht]&&t[i][ln][S](on+e,U),t[i][A].off(R),t[i][Q].off(yt),t._[Jt][Ht]||t[i][Q].off(vt)},init:function(){n in t[n]&&(t._.extend(t[n],t[n][n]),delete t[n][n]),t._[Ot](t[n],function(e){t[n][e]&&typeof t[n][e]==Vt&&b in t[n][e]&&(t[n][pt][e]=t[n][e],delete t[n][e])}),t[n][cn]&&(t[n][B]=t[n][cn]());if(t[n][B]){if(t._[Jt][q]==an&&t._[Jt].deviceVersion<4||t._[Jt][q]=="wp")t[n][B]=P;t._[Jt].IEVersion<10&&(t[n][B]=P),t[n][zt]&&!t._.hasActive(t._[hn](t[n][zt]))&&(t[n][B]=P)}t.eventType=t._[Jt][Ht]?"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._[Ot](t[n][pt],function(r){var s;if(!(b in t[n][pt][r]))return;if(!t[n][pt][r][qt]&&(s=e(pn+r))[j]==0)return;o=new dn(r,t[n][pt][r],u++),t[i][pt][r]=o,s&&(s[_]()[$t](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][ln]=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" />')[$t](t[i][Qt]),t[i][z][S](F,"100%"),t[i][f]=e('<div id="skel-layers-visibleWrapper" />')[$t](t[i][Qt]),t[i][f][S](b,un),t._[mt](ct,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][Et]/1e3+"s ease-in-out")};else{var s,u=[];t[i][Q].resize(function(){if(t[n][Et]!=0){var e=t[n][Et];t[n][Et]=0,window[m](function(){t[n][Et]=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][Et],"swing",function(){t._[Ot](u[s.id],function(e){o[S](e,u[s.id][e])}),t[i][Qt][S](J,U),t[i][A][S](E,Ft)[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,Ft)},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._[Ot](u[h.id],function(e){var n;switch(e){case I:n=t[nn](u[h.id][e])+s;break;case y:n=t[nn](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][Et],"swing",function(){l&&l(),c&&c()})}return e(this)},e.fn[M]=function(){return e(this)[S](b,"absolute")}}}},t)}(jQuery));