1 2/*! 3 * 4 * typed.js - A JavaScript Typing Animation Library 5 * Author: Matt Boldt <[email protected]> 6 * Version: v2.0.9 7 * Url: https://github.com/mattboldt/typed.js 8 * License(s): MIT 9 * 10 */ 11(function webpackUniversalModuleDefinition(root,factory){if(typeof exports==='object'&&typeof module==='object') 12module.exports=factory();else if(typeof define==='function'&&define.amd) 13define([],factory);else if(typeof exports==='object') 14exports.Typed=factory();else root.Typed=factory()})(this,function(){return(function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId]) 15return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);module.loaded=!0;return module.exports} 16__webpack_require__.m=modules;__webpack_require__.c=installedModules;__webpack_require__.p="";return __webpack_require__(0)})([(function(module,exports,__webpack_require__){'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _createClass=(function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1;descriptor.configurable=!0;if('value' in descriptor)descriptor.writable=!0;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}})();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function')}} 17var _initializerJs=__webpack_require__(1);var _htmlParserJs=__webpack_require__(3);var Typed=(function(){function Typed(elementId,options){_classCallCheck(this,Typed);_initializerJs.initializer.load(this,options,elementId);this.begin()} 18_createClass(Typed,[{key:'toggle',value:function toggle(){this.pause.status?this.start():this.stop()}},{key:'stop',value:function stop(){clearInterval(this.timeout);if(this.typingComplete)return;if(this.pause.status)return;this.toggleBlinking(!0);this.pause.status=!0;this.options.onStop(this.arrayPos,this)}},{key:'start',value:function start(){if(this.typingComplete)return;if(!this.pause.status)return;this.pause.status=!1;if(this.pause.typewrite){this.typewrite(this.pause.curString,this.pause.curStrPos)}else{this.backspace(this.pause.curString,this.pause.curStrPos)} 19this.options.onStart(this.arrayPos,this)}},{key:'destroy',value:function destroy(){this.reset(!1);this.options.onDestroy(this)}},{key:'reset',value:function reset(){var restart=arguments.length<=0||arguments[0]===undefined?!0:arguments[0];clearInterval(this.timeout);this.replaceText('');if(this.cursor&&this.cursor.parentNode){this.cursor.parentNode.removeChild(this.cursor);this.cursor=null} 20this.strPos=0;this.arrayPos=0;this.curLoop=0;if(restart){this.insertCursor();this.options.onReset(this);this.begin()}}},{key:'begin',value:function begin(){var _this=this;this.typingComplete=!1;this.shuffleStringsIfNeeded(this);this.insertCursor();if(this.bindInputFocusEvents)this.bindFocusEvents();this.timeout=setTimeout(function(){if(!_this.currentElContent||_this.currentElContent.length===0){_this.typewrite(_this.strings[_this.sequence[_this.arrayPos]],_this.strPos)}else{_this.backspace(_this.currentElContent,_this.currentElContent.length)}},this.startDelay)}},{key:'typewrite',value:function typewrite(curString,curStrPos){var _this2=this;if(this.fadeOut&&this.el.classList.contains(this.fadeOutClass)){this.el.classList.remove(this.fadeOutClass);if(this.cursor)this.cursor.classList.remove(this.fadeOutClass);} 21var humanize=this.humanizer(this.typeSpeed);var numChars=1;if(this.pause.status===!0){this.setPauseStatus(curString,curStrPos,!0);return} 22this.timeout=setTimeout(function(){curStrPos=_htmlParserJs.htmlParser.typeHtmlChars(curString,curStrPos,_this2);var pauseTime=0;var substr=curString.substr(curStrPos);if(substr.charAt(0)==='^'){if(/^\^\d+/.test(substr)){var skip=1;substr=/\d+/.exec(substr)[0];
22skip+=substr.length;pauseTime=parseInt(substr);_this2.temporaryPause=!0;_this2.options.onTypingPaused(_this2.arrayPos,_this2);curString=curString.substring(0,curStrPos)+curString.substring(curStrPos+skip);_this2.toggleBlinking(!0)}} 23if(substr.charAt(0)==='`'){while(curString.substr(curStrPos+numChars).charAt(0)!=='`'){numChars++;if(curStrPos+numChars>curString.length)break} 24var stringBeforeSkip=curString.substring(0,curStrPos);var stringSkipped=curString.substring(stringBeforeSkip.length+1,curStrPos+numChars);var stringAfterSkip=curString.substring(curStrPos+numChars+1);curString=stringBeforeSkip+stringSkipped+stringAfterSkip;numChars--} 25_this2.timeout=setTimeout(function(){_this2.toggleBlinking(!1);if(curStrPos>=curString.length){_this2.doneTyping(curString,curStrPos)}else{_this2.keepTyping(curString,curStrPos,numChars)} 26if(_this2.temporaryPause){_this2.temporaryPause=!1;_this2.options.onTypingResumed(_this2.arrayPos,_this2)}},pauseTime)},humanize)}},{key:'keepTyping',value:function keepTyping(curString,curStrPos,numChars){if(curStrPos===0){this.toggleBlinking(!1);this.options.preStringTyped(this.arrayPos,this)} 27curStrPos+=numChars;var nextString=curString.substr(0,curStrPos);this.replaceText(nextString);this.typewrite(curString,curStrPos)}},{key:'doneTyping',value:function doneTyping(curString,curStrPos){var _this3=this;this.options.onStringTyped(this.arrayPos,this);this.toggleBlinking(!0);if(this.arrayPos===this.strings.length-1){this.complete();if(this.loop===!1||this.curLoop===this.loopCount){return}} 28this.timeout=setTimeout(function(){_this3.backspace(curString,curStrPos)},this.backDelay)}},{key:'backspace',value:function backspace(curString,curStrPos){var _this4=this;if(this.pause.status===!0){this.setPauseStatus(curString,curStrPos,!0);return} 29if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var humanize=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){curStrPos=_htmlParserJs.htmlParser.backSpaceHtmlChars(curString,curStrPos,_this4);var curStringAtPosition=curString.substr(0,curStrPos);_this4.replaceText(curStringAtPosition);if(_this4.smartBackspace){var nextString=_this4.strings[_this4.arrayPos+1];if(nextString&&curStringAtPosition===nextString.substr(0,curStrPos)){_this4.stopNum=curStrPos}else{_this4.stopNum=0}} 30if(curStrPos>_this4.stopNum){curStrPos--;_this4.backspace(curString,curStrPos)}else if(curStrPos<=_this4.stopNum){_this4.arrayPos++;if(_this4.arrayPos===_this4.strings.length){_this4.arrayPos=0;_this4.options.onLastStringBackspaced();_this4.shuffleStringsIfNeeded();_this4.begin()}else{_this4.typewrite(_this4.strings[_this4.sequence[_this4.arrayPos]],curStrPos)}}},humanize)}},{key:'complete',value:function complete(){this.options.onComplete(this);if(this.loop){this.curLoop++}else{this.typingComplete=!0}}},{key:'setPauseStatus',value:function setPauseStatus(curString,curStrPos,isTyping){this.pause.typewrite=isTyping;this.pause.curString=curString;this.pause.curStrPos=curStrPos}},{key:'toggleBlinking',value:function toggleBlinking(isBlinking){if(!this.cursor)return;if(this.pause.status)return;if(this.cursorBlinking===isBlinking)return;this.cursorBlinking=isBlinking;if(isBlinking){this.cursor.classList.add('typed-cursor--blink')}else{this.cursor.classList.remove('typed-cursor--blink')}}},{key:'humanizer',value:function humanizer(speed){return Math.round(Math.random()*speed/2)+speed}},{key:'shuffleStringsIfNeeded',value:function shuffleStringsIfNeeded(){if(!this.shuffle)return;this.sequence=this.sequence.sort(function(){return Math.random()-0.5})}},{key:'initFadeOut',value:function initFadeOut(){var _this5=this;this.el.className+=' '+this.fadeOutClass;if(this.cursor)this.cursor.className+=' '+this.fadeOutClass;return setTimeout(function(){_this5.arrayPos++;_this5.replaceText('');if(_this5.strings.length>_this5.arrayPos){_this5.typewrite(_this5.strings[_this5.sequence[_this5.arrayPos]],0)}else{_this5.typewrite(_this5.strings[0],0);_this5.arrayPos=0}},this.fadeOutDelay)}},{key:'replaceText',value:function replaceText(str){if(this.attr){this.el.setAttribute(this.attr,str)}else{if(this.isInput){this.el.value=str}else if(this.contentType==='html'){this.el.innerHTML=str}else{this.el.textContent=str}}}},{key:'bindFocusEvents',value:function bindFocusEvents(){var _this6=this;if(!this.isInput)return;this.el.addEventListener('focus',function(e){_this6.stop()});this.el.addEventListener('blur',function(e){if(_this6.el.value&&_this6.el.value.length!==0){return} 31_this6.start()})}},{key:'insertCursor',value:function insertCursor(){if(!this.showCursor)return;if(this.cursor)return;
31this.cursor=document.createElement('span');this.cursor.className='typed-cursor';this.cursor.innerHTML=this.cursorChar;this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)}}]);return Typed})();exports['default']=Typed;module.exports=exports['default']}),(function(module,exports,__webpack_require__){'use strict';Object.defineProperty(exports,'__esModule',{value:!0});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 _createClass=(function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1;descriptor.configurable=!0;if('value' in descriptor)descriptor.writable=!0;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}})();function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{'default':obj}} 32function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function')}} 33var _defaultsJs=__webpack_require__(2);var _defaultsJs2=_interopRequireDefault(_defaultsJs);var Initializer=(function(){function Initializer(){_classCallCheck(this,Initializer)} 34_createClass(Initializer,[{key:'load',value:function load(self,options,elementId){if(typeof elementId==='string'){self.el=document.querySelector(elementId)}else{self.el=elementId} 35self.options=_extends({},_defaultsJs2['default'],options);self.isInput=self.el.tagName.toLowerCase()==='input';self.attr=self.options.attr;self.bindInputFocusEvents=self.options.bindInputFocusEvents;self.showCursor=self.isInput?!1:self.options.showCursor;self.cursorChar=self.options.cursorChar;self.cursorBlinking=!0;self.elContent=self.attr?self.el.getAttribute(self.attr):self.el.textContent;self.contentType=self.options.contentType;self.typeSpeed=self.options.typeSpeed;self.startDelay=self.options.startDelay;self.backSpeed=self.options.backSpeed;self.smartBackspace=self.options.smartBackspace;self.backDelay=self.options.backDelay;self.fadeOut=self.options.fadeOut;self.fadeOutClass=self.options.fadeOutClass;self.fadeOutDelay=self.options.fadeOutDelay;self.isPaused=!1;self.strings=self.options.strings.map(function(s){return s.trim()});if(typeof self.options.stringsElement==='string'){self.stringsElement=document.querySelector(self.options.stringsElement)}else{self.stringsElement=self.options.stringsElement} 36if(self.stringsElement){self.strings=[];self.stringsElement.style.display='none';var strings=Array.prototype.slice.apply(self.stringsElement.children);var stringsLength=strings.length;if(stringsLength){for(var i=0;i<stringsLength;i+=1){var stringEl=strings[i];self.strings.push(stringEl.innerHTML.trim())}}} 37self.strPos=0;self.arrayPos=0;self.stopNum=0;self.loop=self.options.loop;self.loopCount=self.options.loopCount;self.curLoop=0;self.shuffle=self.options.shuffle;self.sequence=[];self.pause={status:!1,typewrite:!0,curString:'',curStrPos:0};self.typingComplete=!1;for(var i in self.strings){self.sequence[i]=i} 38self.currentElContent=this.getCurrentElContent(self);self.autoInsertCss=self.options.autoInsertCss;this.appendAnimationCss(self)}},{key:'getCurrentElContent',value:function getCurrentElContent(self){var elContent='';if(self.attr){elContent=self.el.getAttribute(self.attr)}else if(self.isInput){elContent=self.el.value}else if(self.contentType==='html'){elContent=self.el.innerHTML}else{elContent=self.el.textContent} 39return elContent}},{key:'appendAnimationCss',value:function appendAnimationCss(self){var cssDataName='data-typed-js-css';if(!self.autoInsertCss){return} 40if(!self.showCursor&&!self.fadeOut){return} 41if(document.querySelector('['+cssDataName+']')){return} 42var css=document.createElement('style');css.type='text/css';css.setAttribute(cssDataName,!0);var innerCss='';if(self.showCursor){innerCss+='\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n '} 43if(self.fadeOut){innerCss+='\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n '} 44if(css.length===0){return} 45css.innerHTML=innerCss;document.body.appendChild(css)}}]);return Initializer})();exports['default']=Initializer;var initializer=new Initializer();exports.initializer=initializer}),(function(module,exports){'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var defaults={strings:['These are the default values...','You know what you should do?','Use your own!','Have a great day!'],stringsElement:null,typeSpeed:0,startDelay:0,backSpeed:0,smartBackspace:!0,shuffle:!1,backDelay:700,fadeOut:!1,fadeOutClass:'typed-fade-out',fadeOutDelay:500,loop:!1,loopCount:Infinity,showCursor:!0,cursorChar:'|',autoInsertCss:!0,attr:null,bindInputFocusEvents:!1,contentType:'html',onComplete:function onComplete(self){},preStringTyped:function preStringTyped(arrayPos,self){},onStringTyped:function onStringTyped(arrayPos,self){},onLastStringBackspaced:function onLastStringBackspaced(self){},onTypingPaused:function onTypingPaused(arrayPos,self){},onTypingResumed:function onTypingResumed(arrayPos,self){},onReset:function onReset(self){},onStop:function onStop(arrayPos,self){},onStart:function onStart(arrayPos,self){},onDestroy:function onDestroy(self){}};exports['default']=defaults;module.exports=exports['default']}),(function(module,exports){'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _createClass=(function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1;descriptor.configurable=!0;if('value' in descriptor)descriptor.writable=!0;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}})();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function')}} 46var HTMLParser=(function(){function HTMLParser(){_classCallCheck(this,HTMLParser)} 47_createClass(HTMLParser,[{key:'typeHtmlChars',value:function typeHtmlChars(curString,curStrPos,self){if(self.contentType!=='html')return curStrPos;var curChar=curString.substr(curStrPos).charAt(0);if(curChar==='<'||curChar==='&'){var endTag='';if(curChar==='<'){endTag='>'}else{endTag=';'} 48while(curString.substr(curStrPos+1).charAt(0)!==endTag){curStrPos++;
48if(curStrPos+1>curString.length){break}} 49curStrPos++} 50return curStrPos}},{key:'backSpaceHtmlChars',value:function backSpaceHtmlChars(curString,curStrPos,self){if(self.contentType!=='html')return curStrPos;var curChar=curString.substr(curStrPos).charAt(0);if(curChar==='>'||curChar===';'){var endTag='';if(curChar==='>'){endTag='<'}else{endTag='&'} 51while(curString.substr(curStrPos-1).charAt(0)!==endTag){curStrPos--;if(curStrPos<0){break}} 52curStrPos--} 53return curStrPos}}]);return HTMLParser})();exports['default']=HTMLParser;var htmlParser=new HTMLParser();exports.htmlParser=htmlParser})])}); 54 55
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.