]> iEval git - gruntmaster-page.git/blob - js/90-themes.js
Collapse nav on mobile devices
[gruntmaster-page.git] / js / 90-themes.js
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 }
8
9 var selector;
10
11 function add_themelink(theme, text) {
12 var link = $('<a role="button">' + text + '</a>');
13 link.appendTo(selector.find('ul')).wrap('<li>').on('click', function () { set_style(theme) });
14 }
15
16 $( document ).ready(function() {
17 selector = $('<div>Themes: <ul class="list-inline"></ul></div>');
18 add_themelink('cyborg', 'Black');
19 add_themelink('slate', 'Grey');
20 add_themelink('readable', 'White');
21 $('#sidebar').prepend(selector);
22 });
23
24 var theme = localStorage.getItem("theme");
25 if(theme) {
26 if(theme == "cerulean" || theme == "cosmo")
27 theme = "readable";
28 set_style(theme);
29 }
30 })();
This page took 0.049511 seconds and 4 git commands to generate.