]>
Commit | Line | Data |
---|---|---|
1 | (function(){ | |
2 | 'use strict'; | |
3 | function set_style(name){ | |
4 | $('#stylesheet').attr("href", "/static/css/" + name + ".css"); | |
5 | localStorage.setItem("theme", name); | |
6 | } | |
7 | ||
8 | $( document ).ready(function() { | |
9 | $('#theme-selector').detach().prependTo($('#sidebar')); | |
10 | $('#theme_slate' ).on('click', function () { set_style("slate"); }); | |
11 | $('#theme_cyborg' ).on('click', function () { set_style("cyborg"); }); | |
12 | $('#theme_readable').on('click', function () { set_style("readable"); }); | |
13 | }); | |
14 | ||
15 | var theme = localStorage.getItem("theme"); | |
16 | if(theme) { | |
17 | if(theme == "cerulean" || theme == "cosmo") | |
18 | theme = "readable"; | |
19 | set_style(theme); | |
20 | } | |
21 | })(); |