vendor: 16,723 bytes, lines 1-381
1/*! 2 * 3 * typed.js - A JavaScript Typing Animation Library 4 * Author: Matt Boldt <[email protected]> 5 * Version: v2.0.11 6 * Url: https://github.com/mattboldt/typed.js 7 * License(s): MIT 8 * 9 */ 10(function(t, e) { 11 "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Typed = e() : t.Typed = e() 12})(this, function() { 13 return function(t) { 14 function e(n) { 15 if (s[n]) return s[n].exports; 16 var i = s[n] = { 17 exports: {}, 18 id: n, 19 loaded: !1 20 }; 21 return t[n].call(i.exports, i, i.exports, e), i.loaded = !0, i.exports 22 } 23 var s = {}; 24 return e.m = t, e.c = s, e.p = "", e(0) 25 }([function(t, e, s) { 26 "use strict"; 27 28 function n(t, e) { 29 if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") 30 } 31 Object.defineProperty(e, "__esModule", { 32 value: !0 33 }); 34 var i = function() { 35 function t(t, e) { 36 for (var s = 0; s < e.length; s++) { 37 var n = e[s]; 38 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 39 } 40 } 41 return function(e, s, n) { 42 return s && t(e.prototype, s), n && t(e, n), e 43 } 44 }(), 45 r = s(1), 46 o = s(3), 47 a = function() { 48 function t(e, s) { 49 n(this, t), r.initializer.load(this, s, e), this.begin() 50 } 51 return i(t, [{ 52 key: "toggle", 53 value: function() { 54 this.pause.status ? this.start() : this.stop() 55 } 56 }, { 57 key: "stop", 58 value: function() { 59 this.typingComplete || this.pause.status || (this.toggleBlinking(!0), this.pause.status = !0, this.options.onStop(this.arrayPos, this)) 60 } 61 }, { 62 key: "start", 63 value: function() { 64 this.typingComplete || this.pause.status && (this.pause.status = !1, this.pause.typewrite ? this.typewrite(this.pause.curString, this.pause.curStrPos) : this.backspace(this.pause.curString, this.pause.curStrPos), this.options.onStart(this.arrayPos, this)) 65 } 66 }, { 67 key: "destroy", 68 value: function() { 69 this.reset(!1), this.options.onDestroy(this) 70 } 71 }, { 72 key: "reset", 73 value: function() { 74 var t = arguments.length <= 0 || void 0 === arguments[0] || arguments[0]; 75 clearInterval(this.timeout), this.replaceText(""), this.cursor && this.cursor.parentNode && (this.cursor.parentNode.removeChild(this.cursor), this.cursor = null), this.strPos = 0, this.arrayPos = 0, this.curLoop = 0, t && (this.insertCursor(), this.options.onReset(this), this.begin()) 76 } 77 }, { 78 key: "begin", 79 value: function() { 80 var t = this; 81 this.options.onBegin(this), this.typingComplete = !1, this.shuffleStringsIfNeeded(this), this.insertCursor(), this.bindInputFocusEvents && this.bindFocusEvents(), this.timeout = setTimeout(function() { 82 t.currentElContent && 0 !== t.currentElContent.length ? t.backspace(t.currentElContent, t.currentElContent.length) : t.typewrite(t.strings[t.sequence[t.arrayPos]], t.strPos) 83 }, this.startDelay) 84 } 85 }, { 86 key: "typewrite", 87 value: function(t, e) { 88 var s = this; 89 this.fadeOut && this.el.classList.contains(this.fadeOutClass) && (this.el.classList.remove(this.fadeOutClass), this.cursor && this.cursor.classList.remove(this.fadeOutClass)); 90 var n = this.humanizer(this.typeSpeed), 91 i = 1; 92 return this.pause.status === !0 ? void this.setPauseStatus(t, e, !0) : void(this.timeout = setTimeout(function() { 93 e = o.htmlParser.typeHtmlChars(t, e, s); 94 var n = 0, 95 r = t.substr(e); 96 if ("^" === r.charAt(0) && /^\^\d+/.test(r)) { 97 var a = 1; 98 r = /\d+/.exec(r)[0], a += r.length, n = parseInt(r), s.temporaryPause = !0, s.options.onTypingPaused(s.arrayPos, s), t = t.substring(0, e) + t.substring(e + a), s.toggleBlinking(!0) 99 } 100 if ("`" === r.charAt(0)) { 101 for (; 102 "`" !== t.substr(e + i).charAt(0) && (i++, !(e + i > t.length));); 103 var u = t.substring(0, e), 104 l = t.substring(u.length + 1, e + i), 105 c = t.substring(e + i + 1); 106 t = u + l + c, i-- 107 } 108 s.timeout = setTimeout(function() { 109 s.toggleBlinking(!1), e >= t.length ? s.doneTyping(t, e) : s.keepTyping(t, e, i), s.temporaryPause && (s.temporaryPause = !1, s.options.onTypingResumed(s.arrayPos, s)) 110 }, n) 111 }, n)) 112 } 113 }, { 114 key: "keepTyping", 115 value: function(t, e, s) { 116 0 === e && (this.toggleBlinking(!1), this.options.preStringTyped(this.arrayPos, this)), e += s; 117 var n = t.substr(0, e); 118 this.replaceText(n), this.typewrite(t, e) 119 } 120 }, { 121 key: "doneTyping", 122 value: function(t, e) { 123 var s = this; 124 this.options.onStringTyped(this.arrayPos, this), this.toggleBlinking(!0), this.arrayPos === this.strings.length - 1 && (this.complete(), this.loop === !1 || this.curLoop === this.loopCount) || (this.timeout = setTimeout(function() { 125 s.backspace(t, e) 126 }, this.backDelay)) 127 } 128 }, { 129 key: "backspace", 130 value: function(t, e) { 131 var s = this; 132 if (this.pause.status === !0) return void this.setPauseStatus(t, e, !0); 133 if (this.fadeOut) return this.initFadeOut(); 134 this.toggleBlinking(!1); 135 var n = this.humanizer(this.backSpeed); 136 this.timeout = setTimeout(function() { 137 e = o.htmlParser.backSpaceHtmlChars(t, e, s); 138 var n = t.substr(0, e); 139 if (s.replaceText(n), s.smartBackspace) { 140 var i = s.strings[s.arrayPos + 1]; 141 i && n === i.substr(0, e) ? s.stopNum = e : s.stopNum = 0 142 } 143 e > s.stopNum ? (e--, s.backspace(t, e)) : e <= s.stopNum && (s.arrayPos++, s.arrayPos === s.strings.length ? (s.arrayPos = 0, s.options.onLastStringBackspaced(), s.shuffleStringsIfNeeded(), s.begin()) : s.typewrite(s.strings[s.sequence[s.arrayPos]], e)) 144 }, n) 145 } 146 }, { 147 key: "complete", 148 value: function() { 149 this.options.onComplete(this), this.loop ? this.curLoop++ : this.typingComplete = !0 150 } 151 }, { 152 key: "setPauseStatus", 153 value: function(t, e, s) { 154 this.pause.typewrite = s, this.pause.curString = t, this.pause.curStrPos = e 155 } 156 }, { 157 key: "toggleBlinking", 158 value: function(t) { 159 this.cursor && (this.pause.status || this.cursorBlinking !== t && (this.cursorBlinking = t, t ? this.cursor.classList.add("typed-cursor--blink") : this.cursor.classList.remove("typed-cursor--blink"))) 160 } 161 }, { 162 key: "humanizer", 163 value: function(t) { 164 return Math.round(Math.random() * t / 2) + t 165 } 166 }, { 167 key: "shuffleStringsIfNeeded", 168 value: function() { 169 this.shuffle && (this.sequence = this.sequence.sort(function() { 170 return Math.random() - .5 171 })) 172 } 173 }, { 174 key: "initFadeOut", 175 value: function() { 176 var t = this; 177 return this.el.className += " " + this.fadeOutClass, this.cursor && (this.cursor.className += " " + this.fadeOutClass), setTimeout(function() { 178 t.arrayPos++, t.replaceText(""), t.strings.length > t.arrayPos ? t.typewrite(t.strings[t.sequence[t.arrayPos]], 0) : (t.typewrite(t.strings[0], 0), t.arrayPos = 0) 179 }, this.fadeOutDelay) 180 } 181 }, { 182 key: "replaceText", 183 value: function(t) { 184 this.attr ? this.el.setAttribute(this.attr, t) : this.isInput ? this.el.value = t : "html" === this.contentType ? this.el.innerHTML = t : this.el.textContent = t 185 } 186 }, { 187 key: "bindFocusEvents", 188 value: function() { 189 var t = this; 190 this.isInput && (this.el.addEventListener("focus", function(e) { 191 t.stop() 192 }), this.el.addEventListener("blur", function(e) { 193 t.el.value && 0 !== t.el.value.length || t.start() 194 })) 195 } 196 }, { 197 key: "insertCursor", 198 value: function() { 199 this.showCursor && (this.cursor || (this.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))) 200 } 201 }]), t 202 }(); 203 e["default"] = a, t.exports = e["default"] 204 }, function(t, e, s) { 205 "use strict"; 206 207 function n(t) { 208 return t && t.__esModule ? t : { 209 "default": t 210 } 211 } 212 213 function i(t, e) { 214 if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") 215 } 216 Object.defineProperty(e, "__esModule", { 217 value: !0 218 }); 219 var r = Object.assign || function(t) { 220 for (var e = 1; e < arguments.length; e++) { 221 var s = arguments[e]; 222 for (var n in s) Object.prototype.hasOwnProperty.call(s, n) && (t[n] = s[n]) 223 } 224 return t 225 }, 226 o = function() { 227 function t(t, e) { 228 for (var s = 0; s < e.length; s++) { 229 var n = e[s]; 230 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 231 } 232 } 233 return function(e, s, n) { 234 return s && t(e.prototype, s), n && t(e, n), e 235 } 236 }(), 237 a = s(2), 238 u = n(a), 239 l = function() { 240 function t() { 241 i(this, t) 242 } 243 return o(t, [{ 244 key: "load", 245 value: function(t, e, s) { 246 if ("string" == typeof s ? t.el = document.querySelector(s) : t.el = s, t.options = r({}, u["default"], e), t.isInput = "input" === t.el.tagName.toLowerCase(), t.attr = t.options.attr, t.bindInputFocusEvents = t.options.bindInputFocusEvents, t.showCursor = !t.isInput && t.options.showCursor, t.cursorChar = t.options.cursorChar, t.cursorBlinking = !0, t.elContent = t.attr ? t.el.getAttribute(t.attr) : t.el.textContent, t.contentType = t.options.contentType, t.typeSpeed = t.options.typeSpeed, t.startDelay = t.options.startDelay, t.backSpeed = t.options.backSpeed, t.smartBackspace = t.options.smartBackspace, t.backDelay = t.options.backDelay, t.fadeOut = t.options.fadeOut, t.fadeOutClass = t.options.fadeOutClass, t.fadeOutDelay = t.options.fadeOutDelay, t.isPaused = !1, t.strings = t.options.strings.map(function(t) { 247 return t.trim() 248 }), "string" == typeof t.options.stringsElement ? t.stringsElement = document.querySelector(t.options.stringsElement) : t.stringsElement = t.options.stringsElement, t.stringsElement) { 249 t.strings = [], t.stringsElement.style.display = "none"; 250 var n = Array.prototype.slice.apply(t.stringsElement.children), 251 i = n.length; 252 if (i) 253 for (var o = 0; o < i; o += 1) { 254 var a = n[o]; 255 t.strings.push(a.innerHTML.trim()) 256 } 257 } 258 t.strPos = 0, t.arrayPos = 0, t.stopNum = 0, t.loop = t.options.loop, t.loopCount = t.options.loopCount, t.curLoop = 0, t.shuffle = t.options.shuffle, t.sequence = [], t.pause = { 259 status: !1, 260 typewrite: !0, 261 curString: "", 262 curStrPos: 0 263 }, t.typingComplete = !1; 264 for (var o in t.strings) t.sequence[o] = o; 265 t.currentElContent = this.getCurrentElContent(t), t.autoInsertCss = t.options.autoInsertCss, this.appendAnimationCss(t) 266 } 267 }, { 268 key: "getCurrentElContent", 269 value: function(t) { 270 var e = ""; 271 return e = t.attr ? t.el.getAttribute(t.attr) : t.isInput ? t.el.value : "html" === t.contentType ? t.el.innerHTML : t.el.textContent 272 } 273 }, { 274 key: "appendAnimationCss", 275 value: function(t) { 276 var e = "data-typed-js-css"; 277 if (t.autoInsertCss && (t.showCursor || t.fadeOut) && !document.querySelector("[" + e + "]")) { 278 var s = document.createElement("style"); 279 s.type = "text/css", s.setAttribute(e, !0); 280 var n = ""; 281 t.showCursor && (n += "\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 "), t.fadeOut && (n += "\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 "), 0 !== s.length && (s.innerHTML = n, document.body.appendChild(s)) 282 } 283 } 284 }]), t 285 }(); 286 e["default"] = l; 287 var c = new l; 288 e.initializer = c 289 }, function(t, e) { 290 "use strict"; 291 Object.defineProperty(e, "__esModule", { 292 value: !0 293 }); 294 var s = { 295 strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"], 296 stringsElement: null, 297 typeSpeed: 0, 298 startDelay: 0, 299 backSpeed: 0, 300 smartBackspace: !0, 301 shuffle: !1, 302 backDelay: 700, 303 fadeOut: !1, 304 fadeOutClass: "typed-fade-out", 305 fadeOutDelay: 500, 306 loop: !1, 307 loopCount: 1 / 0, 308 showCursor: !0, 309 cursorChar: "|", 310 autoInsertCss: !0, 311 attr: null, 312 bindInputFocusEvents: !1, 313 contentType: "html", 314 onBegin: function(t) {}, 315 onComplete: function(t) {}, 316 preStringTyped: function(t, e) {}, 317 onStringTyped: function(t, e) {}, 318 onLastStringBackspaced: function(t) {}, 319 onTypingPaused: function(t, e) {}, 320 onTypingResumed: function(t, e) {}, 321 onReset: function(t) {}, 322 onStop: function(t, e) {}, 323 onStart: function(t, e) {}, 324 onDestroy: function(t) {} 325 }; 326 e["default"] = s, t.exports = e["default"] 327 }, function(t, e) { 328 "use strict"; 329 330 function s(t, e) { 331 if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") 332 } 333 Object.defineProperty(e, "__esModule", { 334 value: !0 335 }); 336 var n = function() { 337 function t(t, e) { 338 for (var s = 0; s < e.length; s++) { 339 var n = e[s]; 340 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n) 341 } 342 } 343 return function(e, s, n) { 344 return s && t(e.prototype, s), n && t(e, n), e 345 } 346 }(), 347 i = function() { 348 function t() { 349 s(this, t) 350 } 351 return n(t, [{ 352 key: "typeHtmlChars", 353 value: function(t, e, s) { 354 if ("html" !== s.contentType) return e; 355 var n = t.substr(e).charAt(0); 356 if ("<" === n || "&" === n) { 357 var i = ""; 358 for (i = "<" === n ? ">" : ";"; t.substr(e + 1).charAt(0) !== i && (e++, !(e + 1 > t.length));); 359 e++ 360 } 361 return e 362 } 363 }, { 364 key: "backSpaceHtmlChars", 365 value: function(t, e, s) { 366 if ("html" !== s.contentType) return e; 367 var n = t.substr(e).charAt(0); 368 if (">" === n || ";" === n) { 369 var i = ""; 370 for (i = ">" === n ? "<" : "&"; t.substr(e - 1).charAt(0) !== i && (e--, !(e < 0));); 371 e-- 372 } 373 return e 374 } 375 }]), t 376 }(); 377 e["default"] = i; 378 var r = new i; 379 e.htmlParser = r 380 }]) 381});
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.