]> iEval git - gruntmaster-page.git/blob - js/90-themes.js
c280266f466e6ac7506ce355df3d4c8767bcdceb
[gruntmaster-page.git] / js / 90-themes.js
1 function set_style(name){
2 $('link[rel~="stylesheet"]').each(function (e){
3 e.disabled = true;
4 });
5 $('link[title="' + name + '"]')[0].disabled = false;
6 localStorage.setItem("theme", name);
7 }
8
9 $(function() {
10 var theme_ul = '<ul class="list-inline" id="themes">' +
11 '<li><a role="button" data-theme="cyborg">Black</a>' +
12 '<li><a role="button" data-theme="slate">Grey</a>' +
13 '<li><a role="button" data-theme="readable">White</a></ul>';
14 var sidebar = $('#sidebar')[0];
15 sidebar.insertBefore(m(theme_ul), sidebar.firstChild);
16 $('#themes a').on('click', function(e){
17 set_style(this.dataset.theme);
18 });
19 });
20
21 var theme = localStorage.getItem("theme");
22 if(theme) {
23 if(theme == "cerulean" || theme == "cosmo")
24 theme = "readable";
25 set_style(theme);
26 }
This page took 0.050664 seconds and 3 git commands to generate.