]>
Commit | Line | Data |
---|---|---|
1 | (function(){ | |
2 | 'use strict'; | |
3 | function set_style(name){ | |
4 | $('link[rel~="stylesheet"]').prop('disabled', true); | |
5 | $('link[title="' + name + '"]').prop('disabled', false); | |
6 | localStorage.setItem("theme", name); | |
7 | $(document).ready(function() { | |
8 | if(name == 'slate' || name == 'cyborg') | |
9 | $('.logo').removeClass('logo-light'); | |
10 | else | |
11 | $('.logo').addClass('logo-light'); | |
12 | }); | |
13 | } | |
14 | ||
15 | $( document ).ready(function() { | |
16 | $('#theme-selector').detach().prependTo($('#sidebar')); | |
17 | $('#theme_slate' ).on('click', function () { set_style("slate"); }); | |
18 | $('#theme_cyborg' ).on('click', function () { set_style("cyborg"); }); | |
19 | $('#theme_readable').on('click', function () { set_style("readable"); }); | |
20 | }); | |
21 | ||
22 | var theme = localStorage.getItem("theme"); | |
23 | if(theme) { | |
24 | if(theme == "cerulean" || theme == "cosmo") | |
25 | theme = "readable"; | |
26 | set_style(theme); | |
27 | } | |
28 | })(); |