New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

oridomi

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oridomi - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

68

oriDomi.js

@@ -5,6 +5,8 @@ // Generated by CoffeeScript 1.3.3

var $, OriDomi, css, defaults, devMode, extendObj, key, oriDomiSupport, prefixList, root, testEl, testProp, value;
var $, OriDomi, css, defaults, devMode, extendObj, instances, key, oriDomiSupport, prefixList, root, testEl, testProp, value;
root = window;
instances = [];
$ = root.$ || false;

@@ -128,16 +130,21 @@

var anchor, bleed, bottomShader, content, contentHolder, elStyle, hMask, hPanel, i, leftShader, panel, rightShader, shader, stage, topShader, vMask, vPanel, xOffset, yOffset, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _n, _o, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
this.el = el;
devMode && console.time('oridomiConstruction');
if (!oriDomiSupport) {
return this.el;
return el;
}
if (!(this instanceof OriDomi)) {
return new oriDomi(this.el, this.settings);
return new oriDomi(el, this.settings);
}
this.settings = extendObj(options, defaults);
if (!((this.el != null) || this.el.nodeType !== 1)) {
if (!el || el.nodeType !== 1) {
return devMode && console.warn('oriDomi: First argument must be a DOM element');
}
this.el = el.cloneNode(true);
this.cleanEl = el;
_ref = this.settings, this.shading = _ref.shading, this.shadingIntensity = _ref.shadingIntensity, this.vPanels = _ref.vPanels, this.hPanels = _ref.hPanels;
elStyle = root.getComputedStyle(this.el);
elStyle = root.getComputedStyle(this.cleanEl);
this.displayStyle = elStyle.display;
if (this.displayStyle === 'none') {
this.displayStyle = 'block';
}
this.width = parseInt(elStyle.width, 10) + parseInt(elStyle.paddingLeft, 10) + parseInt(elStyle.paddingRight, 10) + parseInt(elStyle.borderLeftWidth, 10) + parseInt(elStyle.borderRightWidth, 10);

@@ -149,2 +156,3 @@ this.height = parseInt(elStyle.height, 10) + parseInt(elStyle.paddingTop, 10) + parseInt(elStyle.paddingBottom, 10) + parseInt(elStyle.borderTopWidth, 10) + parseInt(elStyle.borderBottomWidth, 10);

this.isFoldedUp = false;
this.isFrozen = false;
this.anchors = ['left', 'right', 'top', 'bottom'];

@@ -337,5 +345,8 @@ this.lastAnchor = this.anchors[0];

}
this.cleanEl.style.display = 'none';
this.cleanEl.parentNode.insertBefore(this.el, this.cleanEl);
if ($) {
this.$el = $(this.el);
}
instances.push(this);
this._callback(this.settings);

@@ -400,2 +411,5 @@ devMode && console.timeEnd('oridomiConstruction');

_this = this;
if (this.isFrozen) {
this.unfreeze();
}
angle = this._normalizeAngle(args[0]);

@@ -542,2 +556,42 @@ anchor = this._getLonghandAnchor(args[1]);

OriDomi.prototype.freeze = function(callback) {
var _this = this;
if (this.isFrozen) {
if (typeof callback === 'function') {
return callback();
}
} else {
return this.reset(function() {
_this.isFrozen = true;
_this.el.style.display = 'none';
_this.cleanEl.style.display = _this.displayStyle;
if (typeof callback === 'function') {
return callback();
}
});
}
};
OriDomi.prototype.unfreeze = function() {
if (this.isFrozen) {
this.isFrozen = false;
this.cleanEl.style.display = 'none';
return this.el.style.display = this.displayStyle;
}
};
OriDomi.prototype.destroy = function(callback) {
var _this = this;
return this.freeze(function() {
if ($) {
$.data(_this.cleanEl, 'oriDomi', null);
}
_this.el.parentNode.removeChild(_this.el);
instances[instances.indexOf(_this)] = null;
if (typeof callback === 'function') {
return callback();
}
});
};
OriDomi.prototype.accordion = function(angle, anchor, options) {

@@ -745,3 +799,3 @@ var deg, i, normalized, panel, _i, _len, _ref;

OriDomi.VERSION = '0.1.2';
OriDomi.VERSION = '0.1.3';

@@ -748,0 +802,0 @@ OriDomi.devMode = function() {

2

oriDomi.min.js
// Generated by CoffeeScript 1.3.3
(function(){"use strict";var e,t,n,r,i,s,o,u,a,f,l,c,h;f=window,e=f.$||!1,i=!1,u=!0,l=document.createElement("div"),a=["Webkit","Moz","O","ms","Khtml"],n={transform:"transform",origin:"transformOrigin",transformStyle:"transformStyle",transitionProp:"transitionProperty",transitionDuration:"transitionDuration",transitionEasing:"transitionTimingFunction",perspective:"perspective",backface:"backfaceVisibility"},c=function(e){var t,n,r,i;if(l.style[e]!=null)return e;t=e.charAt(0).toUpperCase()+e.slice(1);for(r=0,i=a.length;r<i;r++){n=a[r];if(l.style[n+t]!=null)return n+t}return!1};for(o in n){h=n[o],n[o]=c(h);if(!n[o]){i&&console.warn("oriDomi: Browser does not support oriDomi"),u=!1;break}}n.gradientProp=function(){var e,t,n,r;for(n=0,r=a.length;n<r;n++){t=a[n],e="-"+t.toLowerCase()+"-linear-gradient",l.style.backgroundImage=""+e+"(left, #000, #fff)";if(l.style.backgroundImage.indexOf("gradient")!==-1)return e}return"linear-gradient"}(),n.transformProp=function(){var e;return e=n.transform.match(/(\w+)Transform/i),e?"-"+e[1].toLowerCase()+"-transform":"transform"}(),n.transitionEnd=function(){switch(n.transitionProp){case"transitionProperty":return"transitionEnd";case"WebkitTransitionProperty":return"webkitTransitionEnd";case"MozTransitionProperty":return"transitionend";case"OTransitionProperty":return"oTransitionEnd";case"MSTransitionProperty":return"msTransitionEnd"}}(),s=function(e,t){var n;if(t!==Object(t))return i&&console.warn("oriDomi: Must pass an object to extend with"),e;e!==Object(e)&&(e={});for(n in t)e[n]==null&&(e[n]=t[n]);return e},r={vPanels:3,hPanels:3,perspective:1e3,shading:"hard",speed:700,oriDomiClass:"oridomi",shadingIntensity:1,easingMethod:"",showOnStart:!1,forceAntialiasing:!1},t=function(){function t(o,a){var l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,J,K;this.el=o,i&&console.time("oridomiConstruction");if(!u)return this.el;if(!(this instanceof t))return new oriDomi(this.el,this.settings);this.settings=s(a,r);if(this.el==null&&this.el.nodeType===1)return i&&console.warn("oriDomi: First argument must be a DOM element");R=this.settings,this.shading=R.shading,this.shadingIntensity=R.shadingIntensity,this.vPanels=R.vPanels,this.hPanels=R.hPanels,v=f.getComputedStyle(this.el),this.width=parseInt(v.width,10)+parseInt(v.paddingLeft,10)+parseInt(v.paddingRight,10)+parseInt(v.borderLeftWidth,10)+parseInt(v.borderRightWidth,10),this.height=parseInt(v.height,10)+parseInt(v.paddingTop,10)+parseInt(v.paddingBottom,10)+parseInt(v.borderTopWidth,10)+parseInt(v.borderBottomWidth,10),this.panelWidth=this.width/this.vPanels,this.panelHeight=this.height/this.hPanels,this.lastAngle=0,this.isFoldedUp=!1,this.anchors=["left","right","top","bottom"],this.lastAnchor=this.anchors[0],this.panels={},this.stages={},x=document.createElement("div"),x.style.width=this.width+"px",x.style.height=this.height+"px",x.style.display="none",x.style.position="absolute",x.style.padding="0",x.style.margin="0",x.style[n.perspective]=this.settings.perspective+"px",U=this.anchors;for(A=0,D=U.length;A<D;A++)l=U[A],this.panels[l]=[],this.stages[l]=x.cloneNode(!1),this.stages[l].className="oridomi-stage-"+l;if(this.shading){this.shaders={},z=this.anchors;for(O=0,P=z.length;O<P;O++)l=z[O],this.shaders[l]={},l==="left"||l==="right"?(this.shaders[l].left=[],this.shaders[l].right=[]):(this.shaders[l].top=[],this.shaders[l].bottom=[]);S=document.createElement("div"),S.style[n.transitionProp]="opacity",S.style[n.transitionDuration]=this.settings.speed+"ms",S.style[n.transitionEasing]=this.settings.easingMethod,S.style.position="absolute",S.style.width="100%",S.style.height="100%",S.style.opacity="0",S.style.top="0",S.style.left="0"}d=this.el.cloneNode(!0),d.classList.add("oridomi-content"),d.style.margin="0",d.style.position="relative",d.style.float="none",m=document.createElement("div"),m.className="oridomi-mask-h",m.style.position="absolute",m.style.overflow="hidden",m.style.width="100%",m.style.height="100%",m.style[n.transform]="translate3d(0, 0, 0)",m.appendChild(d),this.shading&&(T=S.cloneNode(!1),T.className="oridomi-shader-top",T.style.background=this._getShaderGradient("top"),h=S.cloneNode(!1),h.className="oridomi-shader-bottom",h.style.background=this._getShaderGradient("bottom"),m.appendChild(T),m.appendChild(h)),c=2,g=document.createElement("div"),g.className="oridomi-panel-h",g.style.width="100%",g.style.height=this.panelHeight+c+"px",g.style.padding="0",g.style.position="relative",g.style[n.transitionProp]=n.transformProp,g.style[n.transitionDuration]=this.settings.speed+"ms",g.style[n.transitionEasing]=this.settings.easingMethod,g.style[n.origin]="top",g.style[n.transformStyle]="preserve-3d",g.style[n.backface]="hidden",this.settings.forceAntialiasing&&(g.style.outline="1px solid transparent"),g.appendChild(m),W=["top","bottom"];for(M=0,H=W.length;M<H;M++){l=W[M];for(y=_=0,X=this.hPanels;0<=X?_<X:_>X;y=0<=X?++_:--_)w=g.cloneNode(!0),p=w.getElementsByClassName("oridomi-content")[0],l==="top"?(L=-(y*this.panelHeight),y===0?w.style.top="0":w.style.top=this.panelHeight+"px"):(w.style[n.origin]="bottom",L=-(this.hPanels*this.panelHeight-this.panelHeight*(y+1)),y===0?w.style.top=this.panelHeight*(this.vPanels-1)-c+"px":w.style.top=-this.panelHeight+"px"),p.style.top=L+"px",this.shading&&(this.shaders[l].top[y]=w.getElementsByClassName("oridomi-shader-top")[0],this.shaders[l].bottom[y]=w.getElementsByClassName("oridomi-shader-bottom")[0]),this.panels[l][y]=w,y!==0&&this.panels[l][y-1].appendChild(w);this.stages[l].appendChild(this.panels[l][0])}N=m.cloneNode(!0),N.className="oridomi-mask-v",this.shading&&(b=N.getElementsByClassName("oridomi-shader-top")[0],b.className="oridomi-shader-left",b.style.background=this._getShaderGradient("left"),E=N.getElementsByClassName("oridomi-shader-bottom")[0],E.className="oridomi-shader-right",E.style.background=this._getShaderGradient("right")),C=g.cloneNode(!1),C.className="oridomi-panel-v",C.style.width=this.panelWidth+c+"px",C.style.height="100%",C.style[n.origin]="left",C.appendChild(N),V=["left","right"];for(F=0,B=V.length;F<B;F++){l=V[F];for(y=I=0,J=this.vPanels;0<=J?I<J:I>J;y=0<=J?++I:--I)w=C.cloneNode(!0),p=w.getElementsByClassName("oridomi-content")[0],l==="left"?(k=-(y*this.panelWidth),y===0?w.style.left="0":w.style.left=this.panelWidth+"px"):(w.style[n.origin]="right",k=-(this.vPanels*this.panelWidth-this.panelWidth*(y+1)),y===0?w.style.left=this.panelWidth*(this.vPanels-1)-1+"px":w.style.left=-this.panelWidth+"px"),p.style.left=k+"px",this.shading&&(this.shaders[l].left[y]=w.getElementsByClassName("oridomi-shader-left")[0],this.shaders[l].right[y]=w.getElementsByClassName("oridomi-shader-right")[0]),this.panels[l][y]=w,y!==0&&this.panels[l][y-1].appendChild(w);this.stages[l].appendChild(this.panels[l][0])}this.el.classList.add(this.settings.oriDomiClass),this.el.style.padding="0",this.el.style.width=this.width+"px",this.el.style.height=this.height+"px",this.el.style.backgroundColor="transparent",this.el.style.backgroundImage="none",this.el.style.border="none",this.el.style.outline="none",this.stages.left.style.display="block",this.el.innerHTML="",K=this.anchors;for(q=0,j=K.length;q<j;q++)l=K[q],this.el.appendChild(this.stages[l]);this.settings.showOnStart&&(this.el.style.display="block",this.el.style.visibility="visible"),e&&(this.$el=e(this.el)),this._callback(this.settings),i&&console.timeEnd("oridomiConstruction")}return t.prototype._callback=function(e){var t,r=this;if(typeof e.callback=="function")return t=function(r){return r.currentTarget.removeEventListener(n.transitionEnd,t,!1),e.callback()},this.lastAngle===0?e.callback():this.panels[this.lastAnchor][0].addEventListener(n.transitionEnd,t,!1)},t.prototype._transform=function(e,t){var n,r;switch(this.lastAnchor){case"left":n=[0,1,0,e];break;case"right":n=[0,1,0,-e];break;case"top":n=[1,0,0,-e];break;case"bottom":n=[1,0,0,e]}return t&&(r=[1,1,1],n[0]=r[0],n[1]=r[1],n[2]=r[2]),"rotate3d("+n[0]+", "+n[1]+", "+n[2]+", "+n[3]+"deg)"},t.prototype._normalizeAngle=function(e){return e=parseFloat(e,10),isNaN(e)?0:e>89?(i&&console.warn("oriDomi: Maximum value is 89"),89):e<-89?(i&&console.warn("oriDomi: Minimum value is -89"),-89):e},t.prototype._normalizeArgs=function(e,t){var n,r,i,o=this;return r=this._normalizeAngle(t[0]),n=this._getLonghandAnchor(t[1]),i=s(t[2],this._methodDefaults[e]),n!==this.lastAnchor||e==="foldUp"&&this.lastAngle!==0||this.isFoldedUp?(this.reset(function(){return o._showStage(n),setTimeout(function(){return e==="foldUp"&&t.shift(),o[e].apply(o,t)},0)}),!1):(this.lastAngle=r,[r,n,i])},t.prototype._setShader=function(e,t,n){var r,i,s,o;i=Math.abs(n),o=i/90*this.shadingIntensity,this.shading==="hard"?(o*=.15,this.lastAngle<0?n=i:n=-i):o*=.4;switch(t){case"left":case"top":n<0?(r=o,s=0):(r=0,s=o);break;case"right":case"bottom":n<0?(r=0,s=o):(r=o,s=0)}return t==="left"||t==="right"?(this.shaders[t].left[e].style.opacity=r,this.shaders[t].right[e].style.opacity=s):(this.shaders[t].top[e].style.opacity=r,this.shaders[t].bottom[e].style.opacity=s)},t.prototype._getShaderGradient=function(e){return""+n.gradientProp+"("+e+", rgba(0, 0, 0, .5) 0%, rgba(255, 255, 255, .35) 100%)"},t.prototype._showStage=function(e){return this.stages[e].style.display="block",this.stages[this.lastAnchor].style.display="none",this.lastAnchor=e},t.prototype._getPanelType=function(e){return e==="left"||e==="right"?this.vPanels:this.hPanels},t.prototype._getLonghandAnchor=function(e){switch(e){case"left":case"l":case"4":case 4:return"left";case"right":case"r":case"2":case 2:return"right";case"top":case"t":case"1":case 1:return"top";case"bottom":case"b":case"3":case 3:return"bottom";default:return"left"}},t.prototype._methodDefaults={accordion:{sticky:!1,stairs:!1,fracture:!1,twist:!1},curl:{twist:!1},ramp:{},foldUp:{}},t.prototype.reset=function(e){var t,r,i,s,o;if(this.isFoldedUp)return this.unfold(e);o=this.panels[this.lastAnchor];for(t=i=0,s=o.length;i<s;t=++i)r=o[t],r.style[n.transform]=this._transform(0),this.shading&&this._setShader(t,this.lastAnchor,0);return this._callback({callback:e})},t.prototype.accordion=function(e,t,r){var i,s,o,u,a,f,l;o=this._normalizeArgs("accordion",arguments);if(!o)return;e=o[0],t=o[1],r=o[2],l=this.panels[t];for(s=a=0,f=l.length;a<f;s=++a){u=l[s],s%2!==0&&!r.twist?i=-e:i=e;if(r.sticky){if(s===0)i=0;else if(s>1||r.stairs)i*=2}else s!==0&&(i*=2);r.stairs&&(i=-i),u.style[n.transform]=this._transform(i,r.fracture),this.shading&&(s!==0||!r.sticky)&&Math.abs(i)!==180&&this._setShader(s,t,i)}return this._callback(r)},t.prototype.curl=function(e,t,r){var i,s,o,u,a,f;s=this._normalizeArgs("curl",arguments);if(!s)return;e=s[0],t=s[1],r=s[2],e/=this._getPanelType(t),f=this.panels[t];for(i=u=0,a=f.length;u<a;i=++u)o=f[i],o.style[n.transform]=this._transform(e),this.shading&&this._setShader(i,t,0);return this._callback(r)},t.prototype.ramp=function(e,t,r){var i,s,o,u,a,f;s=this._normalizeArgs("ramp",arguments);if(!s)return;e=s[0],t=s[1],r=s[2],this.panels[t][1].style[n.transform]=this._transform(e),f=this.panels[t];for(i=u=0,a=f.length;u<a;i=++u)o=f[i],i>1&&(this.panels[t][i].style[n.transform]=this._transform(0)),this.shading&&this._setShader(i,t,0);return this._callback(r)},t.prototype.foldUp=function(e,t){var r,i,s,o,u,a=this;e?typeof e=="function"&&(t=e):e="left",o=this._normalizeArgs("foldUp",[0,e,{}]);if(!o)return;return e=o[1],this.isFoldedUp=!0,i=this.panels[e].length-1,r=100,s=function(){a.panels[e][i].addEventListener(n.transitionEnd,u,!1),a.panels[e][i].style[n.transform]=a._transform(r);if(a.shading)return a._setShader(i,e,r)},u=function(r){a.panels[e][i].removeEventListener(n.transitionEnd,u,!1),a.panels[e][i].style.display="none";if(--i!==0)return setTimeout(s,0);if(typeof t=="function")return t()},s()},t.prototype.unfold=function(e){var t,r,i,s,o=this;return this.isFoldedUp||typeof e=="function"&&e(),this.isFoldedUp=!1,r=1,t=0,i=function(){return o.panels[o.lastAnchor][r].style.display="block",setTimeout(function(){o.panels[o.lastAnchor][r].addEventListener(n.transitionEnd,s,!1),o.panels[o.lastAnchor][r].style[n.transform]=o._transform(t);if(o.shading)return o._setShader(r,o.lastAnchor,t)},0)},s=function(t){o.panels[o.lastAnchor][r].removeEventListener(n.transitionEnd,s,!1);if(++r!==o.panels[o.lastAnchor].length)return setTimeout(i,0);if(typeof e=="function")return e()},i()},t.prototype.collapse=function(e,t){return t==null&&(t={}),t.sticky=!1,this.accordion(-89,e,t)},t.prototype.collapseAlt=function(e,t){return t==null&&(t={}),t.sticky=!1,this.accordion(89,e,t)},t.prototype.reveal=function(e,t,n){return n==null&&(n={}),n.sticky=!0,this.accordion(e,t,n)},t.prototype.stairs=function(e,t,n){return n==null&&(n={}),n.stairs=!0,n.sticky=!0,this.accordion(e,t,n)},t.prototype.fracture=function(e,t,n){return n==null&&(n={}),n.fracture=!0,this.accordion(e,t,n)},t.prototype.twist=function(e,t,n){return n==null&&(n={}),n.fracture=!0,n.twist=!0,this.accordion(e/10,t,n)},t}(),t.VERSION="0.1.2",t.devMode=function(){return i=!0},f.OriDomi=t,e&&(e.fn.oriDomi=function(n){var r,s,o,a,f,l,c;if(!u)return this;if(typeof n=="string"){if(typeof t.prototype[n]!="function")return i&&console.warn("oriDomi: No such method '"+n+"'");for(a=0,l=this.length;a<l;a++){s=this[a],o=e.data(s,"oriDomi");if(o==null)return i&&console.warn("oriDomi: Can't call "+n+", oriDomi hasn't been initialized on this element");r=Array.prototype.slice.call(arguments),r.shift(),o[n].apply(o,r)}return this}for(f=0,c=this.length;f<c;f++){s=this[f],o=e.data(s,"oriDomi");if(o)return o;e.data(s,"oriDomi",new t(s,n))}return this})}).call(this);
(function(){"use strict";var e,t,n,r,i,s,o,u,a,f,l,c,h,p;l=window,o=[],e=l.$||!1,i=!1,a=!0,c=document.createElement("div"),f=["Webkit","Moz","O","ms","Khtml"],n={transform:"transform",origin:"transformOrigin",transformStyle:"transformStyle",transitionProp:"transitionProperty",transitionDuration:"transitionDuration",transitionEasing:"transitionTimingFunction",perspective:"perspective",backface:"backfaceVisibility"},h=function(e){var t,n,r,i;if(c.style[e]!=null)return e;t=e.charAt(0).toUpperCase()+e.slice(1);for(r=0,i=f.length;r<i;r++){n=f[r];if(c.style[n+t]!=null)return n+t}return!1};for(u in n){p=n[u],n[u]=h(p);if(!n[u]){i&&console.warn("oriDomi: Browser does not support oriDomi"),a=!1;break}}n.gradientProp=function(){var e,t,n,r;for(n=0,r=f.length;n<r;n++){t=f[n],e="-"+t.toLowerCase()+"-linear-gradient",c.style.backgroundImage=""+e+"(left, #000, #fff)";if(c.style.backgroundImage.indexOf("gradient")!==-1)return e}return"linear-gradient"}(),n.transformProp=function(){var e;return e=n.transform.match(/(\w+)Transform/i),e?"-"+e[1].toLowerCase()+"-transform":"transform"}(),n.transitionEnd=function(){switch(n.transitionProp){case"transitionProperty":return"transitionEnd";case"WebkitTransitionProperty":return"webkitTransitionEnd";case"MozTransitionProperty":return"transitionend";case"OTransitionProperty":return"oTransitionEnd";case"MSTransitionProperty":return"msTransitionEnd"}}(),s=function(e,t){var n;if(t!==Object(t))return i&&console.warn("oriDomi: Must pass an object to extend with"),e;e!==Object(e)&&(e={});for(n in t)e[n]==null&&(e[n]=t[n]);return e},r={vPanels:3,hPanels:3,perspective:1e3,shading:"hard",speed:700,oriDomiClass:"oridomi",shadingIntensity:1,easingMethod:"",showOnStart:!1,forceAntialiasing:!1},t=function(){function t(u,f){var c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,J,K,Q;i&&console.time("oridomiConstruction");if(!a)return u;if(!(this instanceof t))return new oriDomi(u,this.settings);this.settings=s(f,r);if(!u||u.nodeType!==1)return i&&console.warn("oriDomi: First argument must be a DOM element");this.el=u.cloneNode(!0),this.cleanEl=u,U=this.settings,this.shading=U.shading,this.shadingIntensity=U.shadingIntensity,this.vPanels=U.vPanels,this.hPanels=U.hPanels,m=l.getComputedStyle(this.cleanEl),this.displayStyle=m.display,this.displayStyle==="none"&&(this.displayStyle="block"),this.width=parseInt(m.width,10)+parseInt(m.paddingLeft,10)+parseInt(m.paddingRight,10)+parseInt(m.borderLeftWidth,10)+parseInt(m.borderRightWidth,10),this.height=parseInt(m.height,10)+parseInt(m.paddingTop,10)+parseInt(m.paddingBottom,10)+parseInt(m.borderTopWidth,10)+parseInt(m.borderBottomWidth,10),this.panelWidth=this.width/this.vPanels,this.panelHeight=this.height/this.hPanels,this.lastAngle=0,this.isFoldedUp=!1,this.isFrozen=!1,this.anchors=["left","right","top","bottom"],this.lastAnchor=this.anchors[0],this.panels={},this.stages={},T=document.createElement("div"),T.style.width=this.width+"px",T.style.height=this.height+"px",T.style.display="none",T.style.position="absolute",T.style.padding="0",T.style.margin="0",T.style[n.perspective]=this.settings.perspective+"px",z=this.anchors;for(O=0,P=z.length;O<P;O++)c=z[O],this.panels[c]=[],this.stages[c]=T.cloneNode(!1),this.stages[c].className="oridomi-stage-"+c;if(this.shading){this.shaders={},W=this.anchors;for(M=0,H=W.length;M<H;M++)c=W[M],this.shaders[c]={},c==="left"||c==="right"?(this.shaders[c].left=[],this.shaders[c].right=[]):(this.shaders[c].top=[],this.shaders[c].bottom=[]);x=document.createElement("div"),x.style[n.transitionProp]="opacity",x.style[n.transitionDuration]=this.settings.speed+"ms",x.style[n.transitionEasing]=this.settings.easingMethod,x.style.position="absolute",x.style.width="100%",x.style.height="100%",x.style.opacity="0",x.style.top="0",x.style.left="0"}v=this.el.cloneNode(!0),v.classList.add("oridomi-content"),v.style.margin="0",v.style.position="relative",v.style.float="none",g=document.createElement("div"),g.className="oridomi-mask-h",g.style.position="absolute",g.style.overflow="hidden",g.style.width="100%",g.style.height="100%",g.style[n.transform]="translate3d(0, 0, 0)",g.appendChild(v),this.shading&&(N=x.cloneNode(!1),N.className="oridomi-shader-top",N.style.background=this._getShaderGradient("top"),p=x.cloneNode(!1),p.className="oridomi-shader-bottom",p.style.background=this._getShaderGradient("bottom"),g.appendChild(N),g.appendChild(p)),h=2,y=document.createElement("div"),y.className="oridomi-panel-h",y.style.width="100%",y.style.height=this.panelHeight+h+"px",y.style.padding="0",y.style.position="relative",y.style[n.transitionProp]=n.transformProp,y.style[n.transitionDuration]=this.settings.speed+"ms",y.style[n.transitionEasing]=this.settings.easingMethod,y.style[n.origin]="top",y.style[n.transformStyle]="preserve-3d",y.style[n.backface]="hidden",this.settings.forceAntialiasing&&(y.style.outline="1px solid transparent"),y.appendChild(g),X=["top","bottom"];for(_=0,B=X.length;_<B;_++){c=X[_];for(b=D=0,V=this.hPanels;0<=V?D<V:D>V;b=0<=V?++D:--D)E=y.cloneNode(!0),d=E.getElementsByClassName("oridomi-content")[0],c==="top"?(A=-(b*this.panelHeight),b===0?E.style.top="0":E.style.top=this.panelHeight+"px"):(E.style[n.origin]="bottom",A=-(this.hPanels*this.panelHeight-this.panelHeight*(b+1)),b===0?E.style.top=this.panelHeight*(this.vPanels-1)-h+"px":E.style.top=-this.panelHeight+"px"),d.style.top=A+"px",this.shading&&(this.shaders[c].top[b]=E.getElementsByClassName("oridomi-shader-top")[0],this.shaders[c].bottom[b]=E.getElementsByClassName("oridomi-shader-bottom")[0]),this.panels[c][b]=E,b!==0&&this.panels[c][b-1].appendChild(E);this.stages[c].appendChild(this.panels[c][0])}C=g.cloneNode(!0),C.className="oridomi-mask-v",this.shading&&(w=C.getElementsByClassName("oridomi-shader-top")[0],w.className="oridomi-shader-left",w.style.background=this._getShaderGradient("left"),S=C.getElementsByClassName("oridomi-shader-bottom")[0],S.className="oridomi-shader-right",S.style.background=this._getShaderGradient("right")),k=y.cloneNode(!1),k.className="oridomi-panel-v",k.style.width=this.panelWidth+h+"px",k.style.height="100%",k.style[n.origin]="left",k.appendChild(C),J=["left","right"];for(I=0,j=J.length;I<j;I++){c=J[I];for(b=q=0,K=this.vPanels;0<=K?q<K:q>K;b=0<=K?++q:--q)E=k.cloneNode(!0),d=E.getElementsByClassName("oridomi-content")[0],c==="left"?(L=-(b*this.panelWidth),b===0?E.style.left="0":E.style.left=this.panelWidth+"px"):(E.style[n.origin]="right",L=-(this.vPanels*this.panelWidth-this.panelWidth*(b+1)),b===0?E.style.left=this.panelWidth*(this.vPanels-1)-1+"px":E.style.left=-this.panelWidth+"px"),d.style.left=L+"px",this.shading&&(this.shaders[c].left[b]=E.getElementsByClassName("oridomi-shader-left")[0],this.shaders[c].right[b]=E.getElementsByClassName("oridomi-shader-right")[0]),this.panels[c][b]=E,b!==0&&this.panels[c][b-1].appendChild(E);this.stages[c].appendChild(this.panels[c][0])}this.el.classList.add(this.settings.oriDomiClass),this.el.style.padding="0",this.el.style.width=this.width+"px",this.el.style.height=this.height+"px",this.el.style.backgroundColor="transparent",this.el.style.backgroundImage="none",this.el.style.border="none",this.el.style.outline="none",this.stages.left.style.display="block",this.el.innerHTML="",Q=this.anchors;for(R=0,F=Q.length;R<F;R++)c=Q[R],this.el.appendChild(this.stages[c]);this.settings.showOnStart&&(this.el.style.display="block",this.el.style.visibility="visible"),this.cleanEl.style.display="none",this.cleanEl.parentNode.insertBefore(this.el,this.cleanEl),e&&(this.$el=e(this.el)),o.push(this),this._callback(this.settings),i&&console.timeEnd("oridomiConstruction")}return t.prototype._callback=function(e){var t,r=this;if(typeof e.callback=="function")return t=function(r){return r.currentTarget.removeEventListener(n.transitionEnd,t,!1),e.callback()},this.lastAngle===0?e.callback():this.panels[this.lastAnchor][0].addEventListener(n.transitionEnd,t,!1)},t.prototype._transform=function(e,t){var n,r;switch(this.lastAnchor){case"left":n=[0,1,0,e];break;case"right":n=[0,1,0,-e];break;case"top":n=[1,0,0,-e];break;case"bottom":n=[1,0,0,e]}return t&&(r=[1,1,1],n[0]=r[0],n[1]=r[1],n[2]=r[2]),"rotate3d("+n[0]+", "+n[1]+", "+n[2]+", "+n[3]+"deg)"},t.prototype._normalizeAngle=function(e){return e=parseFloat(e,10),isNaN(e)?0:e>89?(i&&console.warn("oriDomi: Maximum value is 89"),89):e<-89?(i&&console.warn("oriDomi: Minimum value is -89"),-89):e},t.prototype._normalizeArgs=function(e,t){var n,r,i,o=this;return this.isFrozen&&this.unfreeze(),r=this._normalizeAngle(t[0]),n=this._getLonghandAnchor(t[1]),i=s(t[2],this._methodDefaults[e]),n!==this.lastAnchor||e==="foldUp"&&this.lastAngle!==0||this.isFoldedUp?(this.reset(function(){return o._showStage(n),setTimeout(function(){return e==="foldUp"&&t.shift(),o[e].apply(o,t)},0)}),!1):(this.lastAngle=r,[r,n,i])},t.prototype._setShader=function(e,t,n){var r,i,s,o;i=Math.abs(n),o=i/90*this.shadingIntensity,this.shading==="hard"?(o*=.15,this.lastAngle<0?n=i:n=-i):o*=.4;switch(t){case"left":case"top":n<0?(r=o,s=0):(r=0,s=o);break;case"right":case"bottom":n<0?(r=0,s=o):(r=o,s=0)}return t==="left"||t==="right"?(this.shaders[t].left[e].style.opacity=r,this.shaders[t].right[e].style.opacity=s):(this.shaders[t].top[e].style.opacity=r,this.shaders[t].bottom[e].style.opacity=s)},t.prototype._getShaderGradient=function(e){return""+n.gradientProp+"("+e+", rgba(0, 0, 0, .5) 0%, rgba(255, 255, 255, .35) 100%)"},t.prototype._showStage=function(e){return this.stages[e].style.display="block",this.stages[this.lastAnchor].style.display="none",this.lastAnchor=e},t.prototype._getPanelType=function(e){return e==="left"||e==="right"?this.vPanels:this.hPanels},t.prototype._getLonghandAnchor=function(e){switch(e){case"left":case"l":case"4":case 4:return"left";case"right":case"r":case"2":case 2:return"right";case"top":case"t":case"1":case 1:return"top";case"bottom":case"b":case"3":case 3:return"bottom";default:return"left"}},t.prototype._methodDefaults={accordion:{sticky:!1,stairs:!1,fracture:!1,twist:!1},curl:{twist:!1},ramp:{},foldUp:{}},t.prototype.reset=function(e){var t,r,i,s,o;if(this.isFoldedUp)return this.unfold(e);o=this.panels[this.lastAnchor];for(t=i=0,s=o.length;i<s;t=++i)r=o[t],r.style[n.transform]=this._transform(0),this.shading&&this._setShader(t,this.lastAnchor,0);return this._callback({callback:e})},t.prototype.freeze=function(e){var t=this;if(!this.isFrozen)return this.reset(function(){t.isFrozen=!0,t.el.style.display="none",t.cleanEl.style.display=t.displayStyle;if(typeof e=="function")return e()});if(typeof e=="function")return e()},t.prototype.unfreeze=function(){if(this.isFrozen)return this.isFrozen=!1,this.cleanEl.style.display="none",this.el.style.display=this.displayStyle},t.prototype.destroy=function(t){var n=this;return this.freeze(function(){e&&e.data(n.cleanEl,"oriDomi",null),n.el.parentNode.removeChild(n.el),o[o.indexOf(n)]=null;if(typeof t=="function")return t()})},t.prototype.accordion=function(e,t,r){var i,s,o,u,a,f,l;o=this._normalizeArgs("accordion",arguments);if(!o)return;e=o[0],t=o[1],r=o[2],l=this.panels[t];for(s=a=0,f=l.length;a<f;s=++a){u=l[s],s%2!==0&&!r.twist?i=-e:i=e;if(r.sticky){if(s===0)i=0;else if(s>1||r.stairs)i*=2}else s!==0&&(i*=2);r.stairs&&(i=-i),u.style[n.transform]=this._transform(i,r.fracture),this.shading&&(s!==0||!r.sticky)&&Math.abs(i)!==180&&this._setShader(s,t,i)}return this._callback(r)},t.prototype.curl=function(e,t,r){var i,s,o,u,a,f;s=this._normalizeArgs("curl",arguments);if(!s)return;e=s[0],t=s[1],r=s[2],e/=this._getPanelType(t),f=this.panels[t];for(i=u=0,a=f.length;u<a;i=++u)o=f[i],o.style[n.transform]=this._transform(e),this.shading&&this._setShader(i,t,0);return this._callback(r)},t.prototype.ramp=function(e,t,r){var i,s,o,u,a,f;s=this._normalizeArgs("ramp",arguments);if(!s)return;e=s[0],t=s[1],r=s[2],this.panels[t][1].style[n.transform]=this._transform(e),f=this.panels[t];for(i=u=0,a=f.length;u<a;i=++u)o=f[i],i>1&&(this.panels[t][i].style[n.transform]=this._transform(0)),this.shading&&this._setShader(i,t,0);return this._callback(r)},t.prototype.foldUp=function(e,t){var r,i,s,o,u,a=this;e?typeof e=="function"&&(t=e):e="left",o=this._normalizeArgs("foldUp",[0,e,{}]);if(!o)return;return e=o[1],this.isFoldedUp=!0,i=this.panels[e].length-1,r=100,s=function(){a.panels[e][i].addEventListener(n.transitionEnd,u,!1),a.panels[e][i].style[n.transform]=a._transform(r);if(a.shading)return a._setShader(i,e,r)},u=function(r){a.panels[e][i].removeEventListener(n.transitionEnd,u,!1),a.panels[e][i].style.display="none";if(--i!==0)return setTimeout(s,0);if(typeof t=="function")return t()},s()},t.prototype.unfold=function(e){var t,r,i,s,o=this;return this.isFoldedUp||typeof e=="function"&&e(),this.isFoldedUp=!1,r=1,t=0,i=function(){return o.panels[o.lastAnchor][r].style.display="block",setTimeout(function(){o.panels[o.lastAnchor][r].addEventListener(n.transitionEnd,s,!1),o.panels[o.lastAnchor][r].style[n.transform]=o._transform(t);if(o.shading)return o._setShader(r,o.lastAnchor,t)},0)},s=function(t){o.panels[o.lastAnchor][r].removeEventListener(n.transitionEnd,s,!1);if(++r!==o.panels[o.lastAnchor].length)return setTimeout(i,0);if(typeof e=="function")return e()},i()},t.prototype.collapse=function(e,t){return t==null&&(t={}),t.sticky=!1,this.accordion(-89,e,t)},t.prototype.collapseAlt=function(e,t){return t==null&&(t={}),t.sticky=!1,this.accordion(89,e,t)},t.prototype.reveal=function(e,t,n){return n==null&&(n={}),n.sticky=!0,this.accordion(e,t,n)},t.prototype.stairs=function(e,t,n){return n==null&&(n={}),n.stairs=!0,n.sticky=!0,this.accordion(e,t,n)},t.prototype.fracture=function(e,t,n){return n==null&&(n={}),n.fracture=!0,this.accordion(e,t,n)},t.prototype.twist=function(e,t,n){return n==null&&(n={}),n.fracture=!0,n.twist=!0,this.accordion(e/10,t,n)},t}(),t.VERSION="0.1.3",t.devMode=function(){return i=!0},l.OriDomi=t,e&&(e.fn.oriDomi=function(n){var r,s,o,u,f,l,c;if(!a)return this;if(typeof n=="string"){if(typeof t.prototype[n]!="function")return i&&console.warn("oriDomi: No such method '"+n+"'");for(u=0,l=this.length;u<l;u++){s=this[u],o=e.data(s,"oriDomi");if(o==null)return i&&console.warn("oriDomi: Can't call "+n+", oriDomi hasn't been initialized on this element");r=Array.prototype.slice.call(arguments),r.shift(),o[n].apply(o,r)}return this}for(f=0,c=this.length;f<c;f++){s=this[f],o=e.data(s,"oriDomi");if(o)return o;e.data(s,"oriDomi",new t(s,n))}return this})}).call(this);

@@ -6,3 +6,3 @@ {

"homepage": "http://oridomi.com",
"version": "0.1.2",
"version": "0.1.3",
"license": "MIT",

@@ -9,0 +9,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc