summaryrefslogtreecommitdiff
path: root/webcards/scripts/theme.js
blob: 8e693773160e191cc1a52867284b9ecec84cad2b (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
function Theme(){
    this.t = document.getElementById("theme");
}

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

    restore: function() {
        this.init();
        this.t.setAttribute("href", Cookies.getCookie("theme") + "?v=" + Date.now());
    },

    set: function(sheet) {
        Cookies.setYearCookie("theme", sheet);
        this.restore();
    }
};

var GlobalTheme = new Theme();
GlobalTheme.restore();