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