autotyper-jquery
Advanced tools
Comparing version 0.15.0 to 0.15.1
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("autotyper"),require("jquery")):"function"==typeof define&&define.amd?define(["exports","autotyper","jquery"],e):e((t=t||self).autotyperJquery={},t.autotyper,t.jQuery)}(this,(function(t,e,r){"use strict";var n="default"in e?e.default:e;function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=t[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,u=t}finally{try{n||null==a.return||a.return()}finally{if(o)throw u}}return r}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r=r&&r.hasOwnProperty("default")?r.default:r;var i=e.EVENTS.DESTROY,a=Object.keys(e.EVENTS).map((function(t){return e.EVENTS[t]})),f=Object.create(n);r.extend(f,{parseArguments:function(t){if(0===t.length)return t;var e=u(t,2),n=e[0],o=e[1];return n instanceof r?[n[0],o]:[null,n]}}),r.fn.autotyper=function(){for(var t=arguments.length,n=new Array(t),u=0;u<t;u++)n[u]=arguments[u];var c=n[0],y=n.slice(1);if(0===this.length)return this;if("string"==typeof c){var l=c;return this.each((function(){var t=r(this).data(e.NAME);"object"===o(t)&&"function"==typeof t[l]&&t[l](y)})),this}var p=c;return this.each((function(){var t=r(this),n=Object.create(f);t.data(e.NAME,n),a.forEach((function(o){n.on(o,(function(){for(var n=arguments.length,u=new Array(n),a=0;a<n;a++)u[a]=arguments[a];t.trigger.apply(t,["".concat(e.NAME,".").concat(o)].concat(u)),o===i&&(t.off(e.NAME),r.removeData(t[0],e.NAME))}))})),n.init(t,p)})),this},r.autotyper=function(){var t;return(t=Object.create(f)).init.apply(t,arguments)},r.extend(r.autotyper,{DEFAULTS:e.DEFAULTS,EVENTS:e.EVENTS,NAME:e.NAME,VERSION:e.VERSION}),t.default=f,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery")):"function"==typeof define&&define.amd?define(["exports","jquery"],e):e((t=t||self).autotyperJquery={},t.jQuery)}(this,(function(t,e){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function s(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if(!(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)))return;var n=[],i=!0,r=!1,s=void 0;try{for(var o,u=t[Symbol.iterator]();!(i=(o=u.next()).done)&&(n.push(o.value),!e||n.length!==e);i=!0);}catch(t){r=!0,s=t}finally{try{i||null==u.return||u.return()}finally{if(r)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}e=e&&e.hasOwnProperty("default")?e.default:e;var u=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){function e(t){if(t)return function(t){for(var n in e.prototype)t[n]=e.prototype[n];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r=0;r<i.length;r++)if((n=i[r])===e||n.fn===e){i.splice(r,1);break}return 0===i.length&&delete this._callbacks["$"+t],this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(n){i=0;for(var r=(n=n.slice(0)).length;i<r;++i)n[i].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}));function a(t,e,n){return e.reduce((function(e,r){var o=t.getAttribute(function(t,e){return e?"data-".concat(e,"-").concat(t):"data-".concat(t)}(r,n)),u=r.split("-").map((function(t,e){return 0===e?t:function(t){return"".concat(t.substring(0,1).toUpperCase()).concat(t.substring(1))}(t)})).join("");return null===o?e:s({},e,i({},u,JSON.parse(o)))}),{})}function h(t){var e;if(Array.isArray(t)&&2===t.length){var n=o(t,2);e=function(t,e){var n=Math.min(t,e),i=Math.max(t,e)-n+1;return Math.floor(Math.random()*i)+n}(n[0],n[1])}else e="function"==typeof t?t():parseInt(t,10);return e}var l="autotyper",c={INIT:"init",START:"start",TYPE:"type",LOOP:"loop",STOP:"stop",DESTROY:"destroy"},p=["text","interval","auto-start","loop","loop-interval","empty"],f={text:"This is the default text.",interval:[200,300],autoStart:!0,loop:!1,loopInterval:0,empty:" "},y=u({init:function(){for(var t=this,e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=this.parseArguments(n),u=o(r,2),h=u[0],c=void 0===h?null:h,y=u[1],g=void 0===y?{}:y;if(c){var m=c.innerHTML.trim(),b=s({},a(c,p,l),{},JSON.parse(c.getAttribute("data-".concat(l,"-options"))));this.element=c,this.settings=s({},f,{},m?{text:m}:{},{},b,{},g),Object.defineProperty(this,"text",{set:function(t){this.element&&(this.element.innerHTML=t)},get:function(){return this.text}})}else this.settings=s({},f,{},g);if(this.isRunning=!1,this.reset(),this.emit("init"),!0===this.settings.autoStart)this.start();else{var v=parseInt(this.settings.autoStart,10);isNaN(v)||setTimeout((function(){return t.start()}),v)}return this},parseArguments:function(t){if(0===t.length)return t;var e=o(t,1)[0];return e instanceof HTMLElement?t:[null,e]},reset:function(){return this.letterTotal=this.settings.text.length,this.letterCount=0,this.settings.loop&&("number"==typeof this.settings.loop&&(this.loopTotal=this.settings.loop),this.loopCount=0),this},start:function(){return this.isRunning?this:(clearTimeout(this.timeout),this.isRunning=!0,this.emit("start"),this.type(),this)},type:function(){var t,e;return this.tick(h(this.settings.interval)),this.letterCount>this.letterTotal?this.settings.loop?this.loop():this.stop():(0===this.letterCount?!1===this.settings.empty?(this.letterCount+=1,t=this.settings.text.substring(0,this.letterCount),e=this.settings.text.substring(this.letterCount-1,this.letterCount)):"string"==typeof this.settings.empty&&(t=this.settings.empty,e=this.settings.empty):(t=this.settings.text.substring(0,this.letterCount),e=this.settings.text.substring(this.letterCount-1,this.letterCount)),this.text=t,this.emit("type",t,e),this.letterCount+=1,this)},stop:function(){return this.isRunning?(clearTimeout(this.timeout),this.isRunning=!1,this.emit("stop"),this):this},destroy:function(){this.isRunning&&this.stop(),this.emit("destroy"),this.off(),this.element=null},tick:function(t){var e=this;return clearTimeout(this.timeout),this.timeout=setTimeout((function(){return e.type()}),t),this},loop:function(){return this.tick(h(this.settings.loopInterval)),this.loopCount===this.loopTotal?this.stop():(this.loopCount+=1,this.letterCount=0,this.emit("loop",this.loopCount),this)},empty:function(){return clearTimeout(this.timeout),"string"==typeof this.settings.empty?this.text=this.settings.empty:this.text=f.empty,this.letterCount=0,this.isRunning&&this.tick(h(this.settings.interval)),this},fill:function(){return clearTimeout(this.timeout),this.text=this.settings.text,this.letterCount=this.settings.text.length,this.isRunning&&this.tick(h(this.settings.interval)),this}}),g=c.DESTROY,m=Object.keys(c).map((function(t){return c[t]})),b=Object.create(y);e.extend(b,{parseArguments:function(t){if(0===t.length)return t;var n=o(t,2),i=n[0],r=n[1];return i instanceof e?[i[0],r]:[null,i]}}),e.fn.autotyper=function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var s=i[0],o=i.slice(1);if(0===this.length)return this;if("string"==typeof s){var u=s;return this.each((function(){var t=e(this).data(l);"object"===n(t)&&"function"==typeof t[u]&&t[u](o)})),this}var a=s;return this.each((function(){var t=e(this),n=Object.create(b);t.data(l,n),m.forEach((function(i){n.on(i,(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];t.trigger.apply(t,["".concat(l,".").concat(i)].concat(r)),i===g&&(t.off(l),e.removeData(t[0],l))}))})),n.init(t,a)})),this},e.autotyper=function(){var t;return(t=Object.create(b)).init.apply(t,arguments)},e.extend(e.autotyper,{DEFAULTS:f,EVENTS:c,NAME:l,VERSION:"0.15.1"}),t.default=b,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.min.js.map |
@@ -22,6 +22,6 @@ { | ||
"homepage": "https://github.com/saulhardman/autotyper/", | ||
"version": "0.15.0", | ||
"version": "0.15.1", | ||
"repository": "https://github.com/saulhardman/autotyper/tree/master/packages/autotyper-jquery", | ||
"dependencies": { | ||
"autotyper": "^0.15.0" | ||
"autotyper": "^0.15.1" | ||
}, | ||
@@ -35,3 +35,3 @@ "peerDependencies": { | ||
], | ||
"gitHead": "822bfef598bd2d40eddfbb4d3c2a06ba5807b68c" | ||
"gitHead": "8f72656ed93462d8e1a92cca49e725c25030e602" | ||
} |
Sorry, the diff of this file is not supported yet
44610
461
Updatedautotyper@^0.15.1