typewriting
Advanced tools
Comparing version 1.2.6 to 1.2.7
@@ -7,2 +7,3 @@ "use strict";function _classCallCheck(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function t(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(n,e,i){return e&&t(n.prototype,e),i&&t(n,i),n}}(),_typeof="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};/*! | ||
*/ | ||
!function(t,n){"function"==typeof define&&define.amd?define(n):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?module.exports=n(require,exports,module):t?t.TypeWriting=n():window.TypeWriting=n()}(void 0,function(t,n,e){var i=1,r=!1,o={UNREADY:"UNREADY",READY:"READY",TYPEING:"TYPEING"},a={targetElement:null,inputString:"",typingInterval:150,blinkInterval:"0.7s",cursorColor:"black",pluginCallback:function(){},task:o.UNREADY},l=function t(){if(i<=a.inputString.length){var n=c(i);i+=1,"<"===n.slice(-1)?r=!0:">"===n.slice(-1)&&(r=!1),a.targetElement.innerHTML=n,r?t():setTimeout(function(){t()},a.typingInterval)}else a.task=o.READY,i=1,a.pluginCallback.call()},c=function(t){return a.inputString.slice(0,t)},u=function(){a.pluginCallback=function(){}},s=function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e]);return t},f=function(){function t(n,e){if(_classCallCheck(this,t),!n||"object"!==("undefined"==typeof n?"undefined":_typeof(n)))throw new Error("`options` is invalid");if(!n.inputString)throw new Error("Missing argument: inputString");if("string"!=typeof n.inputString)throw new Error("`inputString` is not a string");a=s(a,n),e?"function"==typeof e?a.pluginCallback=e:(console.error(e+" is not a function"),u()):u();var i=document.createElement("div");i.style.display="inline-block",i.innerHTML="I",a.targetElement.appendChild(i);var r=i.offsetHeight,c=i.offsetWidth;a.targetElement.removeChild(i);var f="@-webkit-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@-moz-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}.typingCursor::after{content:'';width:"+c+"px;height:"+r+"px;margin-left:5px;display:inline-block;vertical-align:bottom;background-color:"+a.cursorColor+";-webkit-animation:blink "+a.blinkInterval+" infinite;-moz-animation:blink "+a.blinkInterval+" infinite;animation:blink "+a.blinkInterval+" infinite}",p=document.createElement("style");p.type="text/css",p.styleSheet?p.styleSheet.cssText=f:p.appendChild(document.createTextNode(f)),document.head.appendChild(p),a.targetElement.className+=" typingCursor",a.task=o.TYPING,l()}return _createClass(t,[{key:"rewrite",value:function(t,n){var e=this;if(a.task===o.TYPING)return console.warn("Last task is not finished yet"),void setTimeout(function(){e.rewrite(t,n)},a.typingInterval);if(!t)throw new Error("Missing argument: inputString");if("string"!=typeof t)throw new Error("`inputString` is not a string");a.inputString=t,n?"function"==typeof n?a.pluginCallback=n:(console.error(n+" is not a function"),u()):u(),a.task=o.TYPING,l()}}]),t}();return f}); | ||
!function(t,n){"function"==typeof define&&define.amd?define(n):"object"===("undefined"==typeof exports?"undefined":_typeof(exports))?module.exports=n(require,exports,module):t?t.TypeWriting=n():window.TypeWriting=n()}(void 0,function(t,n,e){var i=1,r=!1,o={UNREADY:"UNREADY",READY:"READY",TYPEING:"TYPEING"},a={targetElement:null,inputString:"",typingInterval:150,blinkInterval:"0.7s",cursorColor:"black",pluginCallback:function(){},task:o.UNREADY},l=function t(){if(i<=a.inputString.length){var n=c(i);i+=1,"<"===n.slice(-1)?r=!0:">"===n.slice(-1)&&(r=!1),a.targetElement.innerHTML=n,r?t():setTimeout(function(){t()},a.typingInterval)}else a.task=o.READY,i=1,a.pluginCallback.call()},c=function(t){return a.inputString.slice(0,t)},u=function(){a.pluginCallback=function(){}},s=function(t,n){for(var e in n)n.hasOwnProperty(e)&&(t[e]=n[e]);return t},f=function(){function t(n,e){if(_classCallCheck(this,t),!n||"object"!==("undefined"==typeof n?"undefined":_typeof(n)))throw new Error("`options` is invalid");if(!n.inputString)throw new Error("Missing argument: inputString");if("string"!=typeof n.inputString)throw new Error("`inputString` is not a string");a=s(a,n),e?"function"==typeof e?a.pluginCallback=e:(console.error(e+" is not a function"),u()):u();var i=document.createElement("div");i.style.display="inline-block",i.innerHTML="I",a.targetElement.appendChild(i);var r=i.offsetHeight,c=i.offsetWidth;a.targetElement.removeChild(i);var f="@-webkit-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@-moz-keyframes blink{0%,100%{opacity:1}50%{opacity:0}}@keyframes blink{0%,100%{opacity:1}50%{opacity:0}}.typingCursor::after{content:'';width:"+c+"px;height:"+r+"px;margin-left:5px;display:inline-block;vertical-align:bottom;background-color:"+a.cursorColor+";-webkit-animation:blink "+a.blinkInterval+" infinite;-moz-animation:blink "+a.blinkInterval+" infinite;animation:blink "+a.blinkInterval+" infinite}",p=document.createElement("style");p.type="text/css",p.styleSheet?p.styleSheet.cssText=f:p.appendChild(document.createTextNode(f)),document.head.appendChild(p),a.targetElement.className+=" typingCursor",a.task=o.TYPING,l()}return _createClass(t,[{key:"rewrite",value:function(t,n){var e=this;if(a.task===o.TYPING)return console.warn("Last task is not finished yet"),void setTimeout(function(){e.rewrite(t,n)},a.typingInterval);if(!t)throw new Error("Missing argument: inputString");if("string"!=typeof t)throw new Error("`inputString` is not a string");a.inputString=t,n?"function"==typeof n?a.pluginCallback=n:(console.error(n+" is not a function"),u()):u(),a.task=o.TYPING,l()}}]),t}();return f}); | ||
//# sourceMappingURL=typewriting.min.js.map |
{ | ||
"name": "typewriting", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"description": "TypeWriting.js is a javascript library to make a typewriter effect.", | ||
@@ -30,4 +30,5 @@ "scripts": { | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sourcemaps": "^2.4.0", | ||
"gulp-uglify": "^2.0.1" | ||
} | ||
} |
@@ -60,5 +60,5 @@ ## TypeWriting.js [![npm version](https://badge.fury.io/js/typewriting.svg)](https://badge.fury.io/js/typewriting) | ||
inputString : 'Hello, world.', | ||
typingInterval : 130, | ||
blinkInterval : '1s', | ||
cursorColor : '#00fd55', | ||
typingInterval : 130, | ||
blinkInterval : '1s', | ||
cursorColor : '#00fd55', | ||
}, () => console.log('END')); | ||
@@ -65,0 +65,0 @@ ~~~ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106744
9
267
7