summaryrefslogtreecommitdiff
path: root/scripts/theme.js
blob: e93f5b55988179e68b83bb56c48d2ec578844240 (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
'use strict';

class Theme{
    static theme = document.getElementById("theme");

    static init()
    {
        if(Cookies.getCookie("theme") == ""){
            Cookies.setYearCookie("theme", "styles/themes/colors-base.css");
        }
    }

    static restore()
    {
        Theme.init();
        Theme.theme.setAttribute("href", Cookies.getCookie("theme") + "?v=" + Date.now());
    }

    static set(sheet)
    {
        Cookies.setYearCookie("theme", sheet);
        Theme.restore();
    }
}

Theme.restore();