summaryrefslogtreecommitdiff
path: root/views/disable.js
blob: f00b6eae395c4824541daafbc2fb4b4c4e138fb4 (plain)
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
// This piece of javascript reminds you to disable javascript.

eval("") // make librejs block this
window.onload = () => {
    hide(true)
    const text = document.createElement("p")
    const link = document.createElement("a")
    text.textContent = "A friendly reminder to disable JavaScript by default. "
    link.textContent = "Continue anyway"
    link.href = "#"
    link.addEventListener("click", () => {
        text.remove()
        hide(false)

        let t = "#this-messes-with-your-history-navigation-buttons-on-purpose"
        while (t.length > 0) {
            window.location.href = t
            t = t.split("-").slice(0, -1).join("-")
        }
    })
    text.append(link)
    document.body.append(text)
}

function hide(v) {
    for (const e of document.body.children) {
        e.hidden = v
    }
}