]> iEval git - gruntmaster-page.git/blame - js/90-themes.js
Merge branch 'master' into newmc
[gruntmaster-page.git] / js / 90-themes.js
CommitLineData
7093e9ba 1function set_style(name){
8345760a 2 $('link[rel~="stylesheet"]').each(e => e.disabled = true);
7093e9ba
MG
3 $('link[title="' + name + '"]')[0].disabled = false;
4 localStorage.setItem("theme", name);
65ef5465
MG
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'));
7dc32473 10 });
7093e9ba 11}
7dc32473 12
7093e9ba 13$(function() {
81c2ef98
MG
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>';
7093e9ba 18 var sidebar = $('#sidebar')[0];
81c2ef98 19 sidebar.insertBefore(m(theme_ul), sidebar.firstChild);
57b322a1 20 $('#themes a').on('click', e => set_style(e.target.dataset.theme));
7093e9ba 21});
7dc32473 22
8345760a 23let theme = localStorage.getItem("theme");
7093e9ba
MG
24if(theme) {
25 if(theme == "cerulean" || theme == "cosmo")
26 theme = "readable";
27 set_style(theme);
28}
This page took 0.065981 seconds and 4 git commands to generate.