]> iEval git - plack-app-gruntmaster.git/blob - js/90-themes.js
Add a class for elements that should have word-break: break-all
[plack-app-gruntmaster.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 $(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 var selector;
16
17 function add_themelink(theme, text) {
18 var link = $('<a role="button">' + text + '</a>');
19 link.appendTo(selector.find('ul')).wrap('<li>').on('click', function () { set_style(theme) });
20 }
21
22 $( document ).ready(function() {
23 selector = $('<div>Themes: <ul class="list-inline"></ul></div>');
24 add_themelink('cyborg', 'Black');
25 add_themelink('slate', 'Grey');
26 add_themelink('readable', 'White');
27 $('#sidebar').prepend(selector);
28 });
29
30 var theme = localStorage.getItem("theme");
31 if(theme) {
32 if(theme == "cerulean" || theme == "cosmo")
33 theme = "readable";
34 set_style(theme);
35 }
36 })();
This page took 0.043919 seconds and 4 git commands to generate.