Created
January 13, 2018 11:35
-
-
Save shirokoweb/d6056275731ddd0d955c18d75a8df8b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// utilities | |
var get = function (selector, scope) { | |
scope = scope ? scope : document; | |
return scope.querySelector(selector); | |
}; | |
var getAll = function (selector, scope) { | |
scope = scope ? scope : document; | |
return scope.querySelectorAll(selector); | |
}; | |
// setup typewriter effect in the terminal demo | |
if (document.getElementsByClassName('demo').length > 0) { | |
var i = 0; | |
var txt = `scribbler | |
[Entry mode; press Ctrl+D to save and quit; press Ctrl+C to quit without saving] | |
###todo for new year dinner party | |
- milk | |
- butter | |
- green onion | |
- lots and lots of kiwis 🥝`; | |
var speed = 60; | |
function typeItOut () { | |
if (i < txt.length) { | |
document.getElementsByClassName('demo')[0].innerHTML += txt.charAt(i); | |
i++; | |
setTimeout(typeItOut, speed); | |
} | |
} | |
setTimeout(typeItOut, 1800); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment