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

autotyper-jquery

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

autotyper-jquery - npm Package Compare versions

Comparing version 0.13.1 to 0.13.2

115

dist/index.amd.js

@@ -10,2 +10,46 @@ define([ "autotyper", "jquery" ], function(autotyper, jQuery) {

};
var _extends = Object.assign || function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var slicedToArray = function() {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return function(arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
var DESTROY = autotyper.EVENTS.DESTROY;

@@ -15,2 +59,15 @@ var EVENT_NAMES = Object.keys(autotyper.EVENTS).map(function(name) {

});
var jAutotyper = Object.create(autotyper__default);
_extends(jAutotyper, {
parseArguments: function parseArguments(args) {
var _args = slicedToArray(args, 2), firstArg = _args[0], secondArg = _args[1];
if (args.length === 0) {
return args;
}
if (firstArg instanceof jQuery) {
return [ firstArg[0], secondArg ];
}
return [ null, secondArg ];
}
});
jQuery.fn.autotyper = function plugin() {

@@ -25,26 +82,4 @@ var _this = this;

}
if (typeof arg === "undefined" || (typeof arg === "undefined" ? "undefined" : _typeof(arg)) === "object") {
(function() {
var options = arg;
_this.each(function init() {
var $this = jQuery(this);
var instance = Object.create(autotyper__default);
$this.data(autotyper.NAME, instance);
EVENT_NAMES.forEach(function(event) {
instance.on(event, function() {
for (var _len2 = arguments.length, eventArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
eventArgs[_key2] = arguments[_key2];
}
$this.trigger.apply($this, [ autotyper.NAME + ":" + event ].concat(eventArgs));
});
});
instance.on(DESTROY, function() {
instance.off(DESTROY);
$this.off(autotyper.NAME);
});
instance.init(this, options);
});
})();
} else if (typeof arg === "string") {
(function() {
if (typeof arg === "string") {
var _ret = function() {
var functionName = arg;

@@ -56,12 +91,34 @@ _this.each(function callFunction() {

instance[functionName](functionArgs);
if (functionName === autotyper__default.destroy.name) {
jQuery.removeData(this, autotyper.NAME);
}
}
});
})();
return {
v: _this
};
}();
if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
}
var options = arg;
this.each(function init() {
var $this = jQuery(this);
var instance = Object.create(jAutotyper);
$this.data(autotyper.NAME, instance);
EVENT_NAMES.forEach(function(event) {
instance.on(event, function() {
for (var _len2 = arguments.length, eventArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
eventArgs[_key2] = arguments[_key2];
}
$this.trigger.apply($this, [ autotyper.NAME + "." + event ].concat(eventArgs));
if (event === DESTROY) {
$this.off(autotyper.NAME);
jQuery.removeData($this[0], autotyper.NAME);
}
});
});
instance.init($this, options);
});
return this;
};
jQuery.autotyper = autotyper__default;
jQuery.autotyper = function(options) {
return Object.create(jAutotyper).init(options);
};
jQuery.extend(jQuery.autotyper, {

@@ -68,0 +125,0 @@ DEFAULTS: autotyper.DEFAULTS,

@@ -10,2 +10,94 @@ import autotyper, { DEFAULTS, EVENTS, NAME, VERSION } from 'autotyper';

var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
var DESTROY = EVENTS.DESTROY;

@@ -17,2 +109,22 @@

var jAutotyper = Object.create(autotyper);
_extends(jAutotyper, {
parseArguments: function parseArguments(args) {
var _args = slicedToArray(args, 2),
firstArg = _args[0],
secondArg = _args[1];
if (args.length === 0) {
return args;
}
if (firstArg instanceof jQuery) {
return [firstArg[0], secondArg];
}
return [null, secondArg];
}
});
jQuery.fn.autotyper = function plugin() {

@@ -33,54 +145,56 @@ var _this = this;

if (typeof arg === 'undefined' || (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object') {
(function () {
var options = arg;
if (typeof arg === 'string') {
var _ret = function () {
var functionName = arg;
_this.each(function init() {
_this.each(function callFunction() {
var $this = jQuery(this);
var instance = Object.create(autotyper);
var instance = $this.data(NAME);
$this.data(NAME, instance);
if ((typeof instance === 'undefined' ? 'undefined' : _typeof(instance)) === 'object' && typeof instance[functionName] === 'function') {
instance[functionName](functionArgs);
}
});
EVENT_NAMES.forEach(function (event) {
instance.on(event, function () {
for (var _len2 = arguments.length, eventArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
eventArgs[_key2] = arguments[_key2];
}
return {
v: _this
};
}();
$this.trigger.apply($this, [NAME + ':' + event].concat(eventArgs));
});
});
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
instance.on(DESTROY, function () {
instance.off(DESTROY);
var options = arg;
$this.off(NAME);
});
this.each(function init() {
var $this = jQuery(this);
var instance = Object.create(jAutotyper);
instance.init(this, options);
});
})();
} else if (typeof arg === 'string') {
(function () {
var functionName = arg;
$this.data(NAME, instance);
_this.each(function callFunction() {
var $this = jQuery(this);
var instance = $this.data(NAME);
EVENT_NAMES.forEach(function (event) {
instance.on(event, function () {
for (var _len2 = arguments.length, eventArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
eventArgs[_key2] = arguments[_key2];
}
if ((typeof instance === 'undefined' ? 'undefined' : _typeof(instance)) === 'object' && typeof instance[functionName] === 'function') {
instance[functionName](functionArgs);
$this.trigger.apply($this, [NAME + '.' + event].concat(eventArgs));
if (functionName === autotyper.destroy.name) {
jQuery.removeData(this, NAME);
}
if (event === DESTROY) {
$this.off(NAME);
jQuery.removeData($this[0], NAME);
}
});
})();
}
});
instance.init($this, options);
});
return this;
};
jQuery.autotyper = autotyper;
jQuery.autotyper = function (options) {
return Object.create(jAutotyper).init(options);
};

@@ -87,0 +201,0 @@ jQuery.extend(jQuery.autotyper, {

@@ -19,2 +19,48 @@ "use strict";

var _extends = Object.assign || function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var slicedToArray = function() {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return function(arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
var DESTROY = autotyper.EVENTS.DESTROY;

@@ -26,2 +72,17 @@

var jAutotyper = Object.create(autotyper__default);
_extends(jAutotyper, {
parseArguments: function parseArguments(args) {
var _args = slicedToArray(args, 2), firstArg = _args[0], secondArg = _args[1];
if (args.length === 0) {
return args;
}
if (firstArg instanceof jQuery) {
return [ firstArg[0], secondArg ];
}
return [ null, secondArg ];
}
});
jQuery.fn.autotyper = function plugin() {

@@ -36,26 +97,4 @@ var _this = this;

}
if (typeof arg === "undefined" || (typeof arg === "undefined" ? "undefined" : _typeof(arg)) === "object") {
(function() {
var options = arg;
_this.each(function init() {
var $this = jQuery(this);
var instance = Object.create(autotyper__default);
$this.data(autotyper.NAME, instance);
EVENT_NAMES.forEach(function(event) {
instance.on(event, function() {
for (var _len2 = arguments.length, eventArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
eventArgs[_key2] = arguments[_key2];
}
$this.trigger.apply($this, [ autotyper.NAME + ":" + event ].concat(eventArgs));
});
});
instance.on(DESTROY, function() {
instance.off(DESTROY);
$this.off(autotyper.NAME);
});
instance.init(this, options);
});
})();
} else if (typeof arg === "string") {
(function() {
if (typeof arg === "string") {
var _ret = function() {
var functionName = arg;

@@ -67,13 +106,35 @@ _this.each(function callFunction() {

instance[functionName](functionArgs);
if (functionName === autotyper__default.destroy.name) {
jQuery.removeData(this, autotyper.NAME);
}
}
});
})();
return {
v: _this
};
}();
if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
}
var options = arg;
this.each(function init() {
var $this = jQuery(this);
var instance = Object.create(jAutotyper);
$this.data(autotyper.NAME, instance);
EVENT_NAMES.forEach(function(event) {
instance.on(event, function() {
for (var _len2 = arguments.length, eventArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
eventArgs[_key2] = arguments[_key2];
}
$this.trigger.apply($this, [ autotyper.NAME + "." + event ].concat(eventArgs));
if (event === DESTROY) {
$this.off(autotyper.NAME);
jQuery.removeData($this[0], autotyper.NAME);
}
});
});
instance.init($this, options);
});
return this;
};
jQuery.autotyper = autotyper__default;
jQuery.autotyper = function(options) {
return Object.create(jAutotyper).init(options);
};

@@ -80,0 +141,0 @@ jQuery.extend(jQuery.autotyper, {

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):t.autotyperJquery=e(t.jQuery)}(this,function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function i(t){return""+t.substring(0,1).toUpperCase()+t.substring(1)}function n(t){return t.split("-").map(function(t,e){return 0===e?t:i(t)}).join("")}function r(t,e){return e?"data-"+e+"-"+t:"data-"+t}function s(t,e,i){return e.reduce(function(e,s){var o=t.getAttribute(r(s,i)),a=n(s);return null===o?e:f({},e,l({},a,JSON.parse(o)))},{})}function o(t,e){var i=Math.min(t,e),n=Math.max(t,e),r=n-i+1;return Math.floor(Math.random()*r)+i}t="default"in t?t.default:t;var a=e(function(t){function e(t){if(t)return i(t)}function i(t){for(var i in e.prototype)t[i]=e.prototype[i];return 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 i(){this.off(t,i),e.apply(this,arguments)}return i.fn=e,this.on(t,i),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 i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var n,r=0;r<i.length;r++)if(n=i[r],n===e||n.fn===e){i.splice(r,1);break}return this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),i=this._callbacks["$"+t];if(i){i=i.slice(0);for(var n=0,r=i.length;n<r;++n)i[n].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}}),u="autotyper",h="0.13.1",l=function(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t},f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},c=function(){function t(t,e){var i=[],n=!0,r=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(n=(o=a.next()).done)&&(i.push(o.value),!e||i.length!==e);n=!0);}catch(t){r=!0,s=t}finally{try{!n&&a.return&&a.return()}finally{if(r)throw s}}return i}return function(e,i){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(t){var e=void 0;if(Array.isArray(t)&&2===t.length){var i=c(t,2),n=i[0],r=i[1];e=o(n,r)}else e="function"==typeof t?t():parseInt(t,10);return e},y="init",v="start",g="type",m="loop",d="stop",b="destroy",T={INIT:y,START:v,TYPE:g,LOOP:m,STOP:d,DESTROY:b},x=["text","interval","auto-start","loop","loop-interval","empty-text"],k={text:"This is the default text.",interval:[200,300],autoStart:!0,loop:!1,emptyText:" "},S={init:function(){for(var t=this,e=void 0,i=void 0,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];if(r[0]instanceof HTMLElement){var a=c(r,2);e=a[0];var h=a[1];i=void 0===h?{}:h}else{var l=c(r,1),p=l[0];i=void 0===p?{}:p}if(e){var v=e.innerHTML.trim(),g=f(s(e,x,u),JSON.parse(e.getAttribute("data-"+u+"-options")));this.element=e,this.settings=f({},k,v&&{text:v},g,i),this.originalText=v}else this.element=e,this.settings=f({},k,i),this.originalText=this.settings.text;if(this.settings.loopInterval=this.settings.loopInterval||this.settings.interval,this.isRunning=!1,this.settings.autoStart===!0)this.start();else{var m=parseInt(this.settings.autoStart,10);isNaN(m)||setTimeout(function(){return t.start()},m)}return this.emit(y),this},start:function(){return this.isRunning?this:(clearTimeout(this.timeout),this.isRunning=!0,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.emit(v),this.type(),this)},setText:function(t){return this.text=t,this.element&&(this.element.innerHTML=t),this},type:function(){var t=void 0;return this.tick(p(this.settings.interval)),this.letterCount>this.letterTotal?this.settings.loop?this.loop():this.stop():(t=0===this.letterCount?this.settings.emptyText:this.settings.text.substring(0,this.letterCount),this.setText(t),this.emit(g,t),this.letterCount+=1,this)},stop:function(){return this.isRunning?(clearTimeout(this.timeout),this.isRunning=!1,this.emit(d),this):this},resetText:function(){return this.setText(this.originalText),this},destroy:function(){this.isRunning&&this.stop(),this.emit(b),this.off(),this.element=null},tick:function(t){var e=this;return clearTimeout(this.timeout),0===t?this.type():(this.timeout=setTimeout(function(){return e.type()},t),this)},loop:function(){return this.tick(p(this.settings.loopInterval)),this.loopCount===this.loopTotal?this.stop():(this.loopCount+=1,this.letterTotal=this.settings.text.length,this.letterCount=0,this.emit(m,this.loopCount),this)}};a(S);var 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.DESTROY,j=Object.keys(T).map(function(t){return T[t]});return t.fn.autotyper=function(){for(var e=this,i=arguments.length,n=Array(i),r=0;r<i;r++)n[r]=arguments[r];var s=n[0],o=n.slice(1);return 0===this.length?this:("undefined"==typeof s||"object"===("undefined"==typeof s?"undefined":O(s))?!function(){var i=s;e.each(function(){var e=t(this),n=Object.create(S);e.data(u,n),j.forEach(function(t){n.on(t,function(){for(var i=arguments.length,n=Array(i),r=0;r<i;r++)n[r]=arguments[r];e.trigger.apply(e,[u+":"+t].concat(n))})}),n.on(_,function(){n.off(_),e.off(u)}),n.init(this,i)})}():"string"==typeof s&&!function(){var i=s;e.each(function(){var e=t(this),n=e.data(u);"object"===("undefined"==typeof n?"undefined":O(n))&&"function"==typeof n[i]&&(n[i](o),i===S.destroy.name&&t.removeData(this,u))})}(),this)},t.autotyper=S,t.extend(t.autotyper,{DEFAULTS:k,EVENTS:T,VERSION:h,NAME:u}),S});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):t.autotyperJquery=e(t.jQuery)}(this,function(t){"use strict";function e(t,e){return e={exports:{}},t(e,e.exports),e.exports}function n(t){return""+t.substring(0,1).toUpperCase()+t.substring(1)}function i(t){return t.split("-").map(function(t,e){return 0===e?t:n(t)}).join("")}function r(t,e){return e?"data-"+e+"-"+t:"data-"+t}function o(t,e,n){return e.reduce(function(e,o){var s=t.getAttribute(r(o,n)),u=i(o);return null===s?e:c({},e,h({},u,JSON.parse(s)))},{})}function s(t,e){var n=Math.min(t,e),i=Math.max(t,e),r=i-n+1;return Math.floor(Math.random()*r)+n}t="default"in t?t.default:t;var u=e(function(t){function e(t){if(t)return n(t)}function n(t){for(var n in e.prototype)t[n]=e.prototype[n];return 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=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var i,r=0;r<n.length;r++)if(i=n[r],i===e||i.fn===e){n.splice(r,1);break}return this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n){n=n.slice(0);for(var i=0,r=n.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}}),a="autotyper",l="0.13.2",h=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t},c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},f=function(){function t(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(i=(s=u.next()).done)&&(n.push(s.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{!i&&u.return&&u.return()}finally{if(r)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(t){var e=void 0;if(Array.isArray(t)&&2===t.length){var n=f(t,2),i=n[0],r=n[1];e=s(i,r)}else e="function"==typeof t?t():parseInt(t,10);return e},y="init",v="start",g="type",m="loop",b="stop",d="destroy",T={INIT:y,START:v,TYPE:g,LOOP:m,STOP:b,DESTROY:d},x=["text","interval","auto-start","loop","loop-interval","empty-text"],O={text:"This is the default text.",interval:[200,300],autoStart:!0,loop:!1,emptyText:" "},S={init:function(){for(var t=this,e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];var r=this.parseArguments(n),s=f(r,2),u=s[0],l=void 0===u?null:u,h=s[1],p=void 0===h?{}:h;if(l){var v=l.innerHTML.trim(),g=c(o(l,x,a),JSON.parse(l.getAttribute("data-"+a+"-options")));this.element=l,this.settings=c({},O,v&&{text:v},g,p),this.originalText=v}else this.settings=c({},O,p),this.originalText=this.settings.text;if(this.settings.loopInterval=this.settings.loopInterval||this.settings.interval,this.isRunning=!1,this.emit(y),this.settings.autoStart===!0)this.start();else{var m=parseInt(this.settings.autoStart,10);isNaN(m)||setTimeout(function(){return t.start()},m)}return this},parseArguments:function(t){if(0===t.length)return t;var e=f(t,1),n=e[0];return n instanceof HTMLElement?t:[null,n]},start:function(){return this.isRunning?this:(clearTimeout(this.timeout),this.isRunning=!0,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.emit(v),this.type(),this)},setText:function(t){return this.text=t,this.element&&(this.element.innerHTML=t),this},type:function(){var t=void 0;return this.tick(p(this.settings.interval)),this.letterCount>this.letterTotal?this.settings.loop?this.loop():this.stop():(t=0===this.letterCount?this.settings.emptyText:this.settings.text.substring(0,this.letterCount),this.setText(t),this.emit(g,t),this.letterCount+=1,this)},stop:function(){return this.isRunning?(clearTimeout(this.timeout),this.isRunning=!1,this.emit(b),this):this},resetText:function(){return this.setText(this.originalText),this},destroy:function(){this.isRunning&&this.stop(),this.emit(d),this.off(),this.element=null},tick:function(t){var e=this;return clearTimeout(this.timeout),0===t?this.type():(this.timeout=setTimeout(function(){return e.type()},t),this)},loop:function(){return this.tick(p(this.settings.loopInterval)),this.loopCount===this.loopTotal?this.stop():(this.loopCount+=1,this.letterTotal=this.settings.text.length,this.letterCount=0,this.emit(m,this.loopCount),this)}};u(S);var k="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},j=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},A=function(){function t(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var s,u=t[Symbol.iterator]();!(i=(s=u.next()).done)&&(n.push(s.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{!i&&u.return&&u.return()}finally{if(r)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_=T.DESTROY,E=Object.keys(T).map(function(t){return T[t]}),C=Object.create(S);return j(C,{parseArguments:function(e){var n=A(e,2),i=n[0],r=n[1];return 0===e.length?e:i instanceof t?[i[0],r]:[null,r]}}),t.fn.autotyper=function(){for(var e=this,n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=i[0],s=i.slice(1);if(0===this.length)return this;if("string"==typeof o){var u=function(){var n=o;return e.each(function(){var e=t(this),i=e.data(a);"object"===("undefined"==typeof i?"undefined":k(i))&&"function"==typeof i[n]&&i[n](s)}),{v:e}}();if("object"===("undefined"==typeof u?"undefined":k(u)))return u.v}var l=o;return this.each(function(){var e=t(this),n=Object.create(C);e.data(a,n),E.forEach(function(i){n.on(i,function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];e.trigger.apply(e,[a+"."+i].concat(r)),i===_&&(e.off(a),t.removeData(e[0],a))})}),n.init(e,l)}),this},t.autotyper=function(t){return Object.create(C).init(t)},t.extend(t.autotyper,{DEFAULTS:O,EVENTS:T,VERSION:l,NAME:a}),S});
//# sourceMappingURL=index.min.js.map

@@ -12,2 +12,46 @@ (function(global, factory) {

};
var _extends = Object.assign || function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
var slicedToArray = function() {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return function(arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
var DESTROY = autotyper.EVENTS.DESTROY;

@@ -17,2 +61,15 @@ var EVENT_NAMES = Object.keys(autotyper.EVENTS).map(function(name) {

});
var jAutotyper = Object.create(autotyper__default);
_extends(jAutotyper, {
parseArguments: function parseArguments(args) {
var _args = slicedToArray(args, 2), firstArg = _args[0], secondArg = _args[1];
if (args.length === 0) {
return args;
}
if (firstArg instanceof jQuery) {
return [ firstArg[0], secondArg ];
}
return [ null, secondArg ];
}
});
jQuery.fn.autotyper = function plugin() {

@@ -27,26 +84,4 @@ var _this = this;

}
if (typeof arg === "undefined" || (typeof arg === "undefined" ? "undefined" : _typeof(arg)) === "object") {
(function() {
var options = arg;
_this.each(function init() {
var $this = jQuery(this);
var instance = Object.create(autotyper__default);
$this.data(autotyper.NAME, instance);
EVENT_NAMES.forEach(function(event) {
instance.on(event, function() {
for (var _len2 = arguments.length, eventArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
eventArgs[_key2] = arguments[_key2];
}
$this.trigger.apply($this, [ autotyper.NAME + ":" + event ].concat(eventArgs));
});
});
instance.on(DESTROY, function() {
instance.off(DESTROY);
$this.off(autotyper.NAME);
});
instance.init(this, options);
});
})();
} else if (typeof arg === "string") {
(function() {
if (typeof arg === "string") {
var _ret = function() {
var functionName = arg;

@@ -58,12 +93,34 @@ _this.each(function callFunction() {

instance[functionName](functionArgs);
if (functionName === autotyper__default.destroy.name) {
jQuery.removeData(this, autotyper.NAME);
}
}
});
})();
return {
v: _this
};
}();
if ((typeof _ret === "undefined" ? "undefined" : _typeof(_ret)) === "object") return _ret.v;
}
var options = arg;
this.each(function init() {
var $this = jQuery(this);
var instance = Object.create(jAutotyper);
$this.data(autotyper.NAME, instance);
EVENT_NAMES.forEach(function(event) {
instance.on(event, function() {
for (var _len2 = arguments.length, eventArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
eventArgs[_key2] = arguments[_key2];
}
$this.trigger.apply($this, [ autotyper.NAME + "." + event ].concat(eventArgs));
if (event === DESTROY) {
$this.off(autotyper.NAME);
jQuery.removeData($this[0], autotyper.NAME);
}
});
});
instance.init($this, options);
});
return this;
};
jQuery.autotyper = autotyper__default;
jQuery.autotyper = function(options) {
return Object.create(jAutotyper).init(options);
};
jQuery.extend(jQuery.autotyper, {

@@ -70,0 +127,0 @@ DEFAULTS: autotyper.DEFAULTS,

@@ -22,6 +22,6 @@ {

"homepage": "https://github.com/saulhardman/autotyper/",
"version": "0.13.1",
"version": "0.13.2",
"repository": "https://github.com/saulhardman/autotyper/tree/master/packages/autotyper-jquery",
"dependencies": {
"autotyper": "^0.13.1"
"autotyper": "^0.13.2"
},

@@ -28,0 +28,0 @@ "peerDependencies": {

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