Merge pull request #197 from houdiniproject/remove_typewriter

Remove unused typewriter.js
This commit is contained in:
Eric Schultz 2019-05-30 13:06:29 -05:00 committed by GitHub
commit cd5b5c038e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,48 +0,0 @@
// License: LGPL-3.0-or-later
module.exports = function (arr, id, ms) {
var j = 0
var linesLength = arr.length
var typeArea = document.getElementById(id)
typeLine(arr[j])
function typeLine(line) {
var lineLength = line.length
var i = 0
addLetter()
function addLetter(){
setTimeout(function(){
typeArea.innerHTML = toNthLetter(line, i)
if(i <= lineLength) {
i++
addLetter()
} else {
setTimeout(function(){
removeLetter()
}, ms * 6)
}
}, ms)
}
function removeLetter(){
setTimeout(function(){
typeArea.innerHTML = toNthLetter(line, i)
if(i > 0) {
i--
removeLetter()
} else {
setTimeout(function(){
j = (j + 1) % linesLength
typeLine(arr[j])
}, ms * 5)
}
}, ms * 0.3)
}
}
function toNthLetter(string, n) {
return string.split('').splice(0, n).join('')
}
}