]>
iEval git - gruntmaster-page.git/blob - js/90-themes.js
4a7067e29e965d05c66b3ec8e62bf58fc0d9cde2
1 function set_style(name
, trans
){
3 document
.body
.classList
.add('transition-color');
4 setTimeout(() => document
.body
.classList
.remove('transition-color'), 1000);
6 $('link[title]').each(e
=> e
.disabled
= true);
7 $('link[title="' + name
+ '"]')[0].disabled
= false;
8 localStorage
.setItem("theme", name
);
10 if(name
== 'slate' || name
== 'cyborg')
11 $('img').each(e
=> e
.setAttribute('src', e
.getAttribute('src').replace('logos/light', 'logos/dark')));
13 $('img').each(e
=> e
.setAttribute('src', e
.getAttribute('src').replace('logos/dark', 'logos/light')));
18 var theme_ul
= '<ul class="list-inline" id="themes">' +
19 '<li><a role="button" data-theme="cyborg">Black</a>' +
20 '<li><a role="button" data-theme="slate">Grey</a>' +
21 '<li><a role="button" data-theme="readable">White</a></ul>';
22 var sidebar
= $('#sidebar')[0];
23 sidebar
.insertBefore(m(theme_ul
), sidebar
.firstChild
);
24 $('#themes a').on('click', e
=> set_style(e
.target
.dataset
.theme
, true));
27 let theme
= localStorage
.getItem("theme");
29 if(theme
== "cerulean" || theme
== "cosmo")
31 set_style(theme
, false);
This page took 0.044577 seconds and 4 git commands to generate.