1var TxtType = function(el, toRotate, period) { 2 this.toRotate = toRotate; 3 this.el = el; 4 this.loopNum = 0; 5 this.period = parseInt(period, 0) || 0; 6 this.txt = ''; 7 this.tick(); 8 this.isDeleting = false; 9}; 10 11TxtType.prototype.tick = function() { 12 var i = this.loopNum % this.toRotate.length; 13 var fullTxt = this.toRotate[i]; 14 15 if (this.isDeleting) { 16 this.txt = fullTxt.substring(0, this.txt.length - 1); 17 } else { 18 this.txt = fullTxt.substring(0, this.txt.length + 1); 19 } 20 21 this.el.innerHTML = '<span class="typewrap">'+this.txt+'</span>'; 22 23 var that = this; 24 var delta = 110 - Math.random() * 100; 25 26 if (this.isDeleting) { delta /= 20; } 27 28 if (!this.isDeleting && this.txt === fullTxt) { 29 delta = this.period; 30 this.isDeleting = true; 31 } else if (this.isDeleting && this.txt === '') { 32 this.isDeleting = false; 33 this.loopNum++; 34 delta = 500; 35 } 36 37 setTimeout(function() { 38 that.tick(); 39 }, delta); 40}; 41 42document.addEventListener('DOMContentLoaded', function() { 43 var elements = document.getElementsByClassName('typewrite'); 44 for (var i=0; i<elements.length; i++) { 45 var toRotate = elements[i].getAttribute('data-type'); 46 var period = elements[i].getAttribute('data-period'); 47 if (toRotate) { 48 new TxtType(elements[i], JSON.parse(toRotate), period); 49 } 50 } 51});
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.