aboutsummaryrefslogtreecommitdiff
blob: f1ab1fb2a25f6198bf4e7f1dff31b9ee53014b6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var sleep = function(ms, callback) {
        setTimeout(function() {
            callback()
        }, ms)
    },
    favthings = ["raspberrypi", "Linux", "Let's Encrypt", "Ingress", "Computer Vision", 
"Machine Learning"],
    removeClass = function(el, className) {
        el.classList ? el.classList.remove(className) : el.className = 
el.className.replace(new RegExp("(^|\\b)" + className.split(" ").join("|") + "(\\b|$)", 
"gi"), " ")
    },
    addClass = function(el, className) {
        el.classList ? el.classList.add(className) : el.className += " " + className
    },
    i = 0,
    nextThing = function(thing) {
        i < favthings.length - 1 ? i++ : i = 0, removeClass(thing, "slideInDown"), 
addClass(thing, "slideOutUp"), sleep(700, function() {
            thing.innerHTML = favthings[i], removeClass(thing, "slideOutUp"), 
addClass(thing, "slideInDown")
        })
    };
document.addEventListener("DOMContentLoaded", function() {
    var thing = document.querySelectorAll(".favthing")[0];
    setTimeout(function() {
        nextThing(thing)
    }, 1e3), setInterval(function() {
        nextThing(thing)
    }, 4e3)
});
Powered by cgit v1.2.3 (git 2.41.0)