-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcajas.min.js
1 lines (1 loc) · 3.17 KB
/
cajas.min.js
1
!function(a,b,c,d){"use strict";var e=function(a){var b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if("undefined"!=typeof a.style[c])return b[c];return!1};Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e});for(var f,g,h,i,j=[],k=[],l=[],m=b.getElementsByTagName("*"),n=function(b,c,d){b.addEventListener?b.addEventListener(c,d,!1):b.attachEvent("on"+c,function(){return d.call(b,a.event)})},o=0,p=function(){this.group},q=0,r=m.length;r>q;q++)if(f=m[q],null!==f.getAttribute("cajas")){var s=0,t=0,u=f.getAttribute("cajas-duration");null===u&&(u=5e3),g=f.getElementsByTagName("*");for(var v=0,w=g.length;w>v;v++)h=g[v],null!==h.getAttribute("cajas-slide")&&("undefined"==typeof l[o]&&(l[o]={index:null,transitionCount:0,transitionMax:0}),"undefined"==typeof j[o]&&(j[o]=[]),null!==h.getAttribute("cajas-in")&&(l[o].index=s),i=j[o][s]={index:s,element:h,group:o,transitionEvent:e(h),duration:h.getAttribute("cajas-duration")},null===i.duration&&(i.duration=u),i.transitionEvent&&n(h,i.transitionEvent,p.bind(i)),s++),null!==h.getAttribute("cajas-control")&&("undefined"==typeof k[o]&&(k[o]=[]),k[o][t]={index:t++,element:h,group:o});o++}if(j)for(var x,y=function(a,b){for(var c,d=j[a].length,e=l[a].index,f=0;d>f;f++)c=j[a][f].element,f===e&&e!=b?(c.removeAttribute("cajas-active"),c.removeAttribute("cajas-in"),c.setAttribute("cajas-inactive",!0),c.setAttribute("cajas-out",!0),"undefined"!=typeof k[a][f]&&(c=k[a][f].element,c.removeAttribute("cajas-active"),c.removeAttribute("cajas-in"),c.setAttribute("cajas-inactive",!0),c.setAttribute("cajas-out",!0))):f===b?(c.removeAttribute("cajas-inactive"),c.removeAttribute("cajas-out"),c.setAttribute("cajas-active",!0),c.setAttribute("cajas-in",!0),"undefined"!=typeof k[a][f]&&(c=k[a][f].element,c.removeAttribute("cajas-inactive"),c.removeAttribute("cajas-out"),c.setAttribute("cajas-active",!0),c.setAttribute("cajas-in",!0))):(c.removeAttribute("cajas-in"),c.removeAttribute("cajas-out"),c.removeAttribute("cajas-active"),c.setAttribute("cajas-inactive",!0),"undefined"!=typeof k[a][f]&&(c=k[a][f].element,c.removeAttribute("cajas-in"),c.removeAttribute("cajas-out"),c.removeAttribute("cajas-active"),c.setAttribute("cajas-inactive",!0)))},z=null,A=function(){clearTimeout(z),z=null},B=function(a){var b=this.group,a="undefined"==typeof a?!0:a;if((null===z||l[b].index!==this.index)&&(A(),y(b,this.index),l[b].index=this.index,a)){var c;c=this.index+1>=j[b].length?j[b][0]:j[b][this.index+1],z=setTimeout(B.bind(c),this.duration)}},C=j.length,q=0,r=C;r>q;q++){var D=j[q].length,E=l[q].index;null===E&&(E=0);for(var v=0,w=D;w>v;v++)j[q][v].index===E&&(x=B.bind(j[q][v]))(),"undefined"!=typeof k[q]&&"undefined"!=typeof k[q][v]&&n(k[q][v].element,"click",B.bind(j[q][v],D>1))}}(window,document,window.Zepto||window.jQuery);