forked from Keyframes/jQuery.Keyframes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.keyframes.min.js
More file actions
1 lines (1 loc) · 3.71 KB
/
Copy pathjquery.keyframes.min.js
File metadata and controls
1 lines (1 loc) · 3.71 KB
1
!function(){return function e(t,n,i){function r(o,u){if(!n[o]){if(!t[o]){var s="function"==typeof require&&require;if(!u&&s)return s(o,!0);if(a)return a(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var c=n[o]={exports:{}};t[o][0].call(c.exports,function(e){var n=t[o][1][e];return r(n||e)},c,c.exports,e,t,n,i)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<i.length;o++)r(i[o]);return r}}()({1:[function(e,t,n){"use strict";var i,r,a=(i=e("@keyframes/core"))&&i.__esModule?i:{default:i};r=function(e,t){e.each(function(e,n){n.Keyframes?t(n.Keyframes):(n.Keyframes=new a.default(n),t(n.Keyframes))})},$.keyframe={isSupported:a.default.isSupported,generate:a.default.generate,define:a.default.define},$.fn.resetKeyframe=function(e){r(this,function(t){return t.reset(e)})},$.fn.pauseKeyframe=function(){r(this,function(e){return e.pause()})},$.fn.resumeKeyframe=function(){r(this,function(e){return e.resume()})},$.fn.playKeyframe=function(e,t){r(this,function(n){return n.play(e,t)})}},{"@keyframes/core":2}],2:[function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.elem=t}var t,n,r;return t=e,r=[{key:"createKeyframeTag",value:function(e,t){var n=document.createElement("style");n.innerHTML=t,n.setAttribute("class","keyframe-style"),n.setAttribute("id",e),n.setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(n)}},{key:"generate",value:function(t){var n=t.name||"",i="@keyframes ".concat(n," {");for(var r in t)if("name"!==r&&"media"!==r&&"complete"!==r){i+="".concat(r," {");for(var a in t[r])i+="".concat(a,":").concat(t[r][a],";");i+="}"}t.media&&(i="@media ".concat(t.media,"{").concat(i,"}"));var o="Keyframes".concat(n),u=document.getElementById(o);u?u.innerHTML=i:e.createKeyframeTag(o,i)}},{key:"define",value:function(e){if(e.length)for(var t=0;t<e.length;t+=1)this.generate(e[t]);else this.generate(e)}},{key:"plugin",value:function(t){t(e)}}],(n=[{key:"isSupported",value:function(){return void 0!==document.body.style.animationName}},{key:"reset",value:function(e){this.removeEvents(),this.elem.style.animationPlayState="running",this.elem.style.animation="none",e&&setTimeout(e,0)}},{key:"pause",value:function(){this.elem.style.animationPlayState="paused"}},{key:"resume",value:function(){this.elem.style.animationPlayState="running"}},{key:"play",value:function(e,t){var n=this;if(this.elem.style.animationName===e.name)return this.reset(function(){return n.play(e,t)}),this;var i=function(e){var t=Object.assign({},{duration:"0s",timingFunction:"ease",delay:"0s",iterationCount:1,direction:"normal",fillMode:"forwards"},e);return[t.name,t.duration,t.timingFunction,t.delay,t.iterationCount,t.direction,t.fillMode].join(" ")},r="";if(e.constructor===Array){for(var a=[],o=0;o<e.length;o+=1)a.push("string"==typeof e[o]?e[o]:i(e[o]));r=a.join(", ")}else r="string"==typeof e?e:i(e);var u=function(e,t){var i="".concat(e,"Listener");n.elem.removeEventListener(e,n[i]),n[i]=t,n.elem.addEventListener(e,n[i])};return this.elem.style.animationPlayState="running",this.elem.style.animation=r,this.frameOptions=e,u("animationiteration",t||e.complete),u("animationend",t||e.complete),this}},{key:"removeEvents",value:function(){this.elem.removeEventListener("animationiteration",this.animationiterationListener),this.elem.removeEventListener("animationend",this.animationendListener)}}])&&i(t.prototype,n),r&&i(t,r),e}();n.default=r},{}]},{},[1]);