summaryrefslogtreecommitdiff
path: root/jobs/hövd.ing/index.html
blob: c0bf5f685666452216f7671ce1fc5a74fd5009ed (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="sv">
<head>
    <meta charset="utf-8" />
    <title>Hövding</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            display: flex;
            align-items: center;
            flex-direction: column;
            justify-content: center;
            gap: 2em;
            min-height: 100vh;
            font-family: monospace;
        }
        span {
            position: relative;
        }
        .invisible {
            display: none;
        }
        img {
            max-width: 90vw;
            max-height: 80vh;
        }
    </style>
</head>
<body>
    <h1>Se på fan, en Hövding!</h1>
    <img src="https://d2q01ftr6ua4w.cloudfront.net/assets/images/8d6f885ed2e20f3cd0ed3db9fb1901da6a2695f0.jpeg">

    <script>
        const el = document.querySelector("h1");
        const text = el.textContent;
        el.innerHTML = "";
        const spans = new Array(text.length).fill().map((_, i) => {
            const span = document.createElement("span");
            span.innerText = text[i];
            span.classList.add("invisible");
            el.appendChild(span);
            return span;
        });
        const underscore = document.createElement("span");
        const underscoreInner = document.createElement("span");
        underscoreInner.innerText = "_";
        underscore.appendChild(underscoreInner);
        underscore.style.position = "relative";
        underscoreInner.style.position = "absolute";
        el.appendChild(underscore);
        let i = 0;
        function next() {
            spans[i].classList.remove("invisible");

            i++;
            if (i >= spans.length) {
                setTimeout(removeCursor, 200);
            } else {
                setTimeout(next, Math.ceil(Math.random() * 200));
            }
        }
        next();
        function removeCursor() {
            underscore.classList.add("invisible");
        }
    </script>
</body>
</html>