$(function(){
- if(document.documentElement.clientWidth >= 768)
- return;
- $('#title')[0].insertAdjacentHTML('beforebegin', '<div class="text-center">Tap title to toggle menu</div>');
- $('nav')[0].classList.add('hidden');
- $('#title,#logo').on('click', () => $('nav')[0].classList.toggle('hidden'));
+ const nav = $('nav')[0];
+ nav.classList.add('hidden-xs');
+ $('#title')[0].insertAdjacentHTML('beforebegin', '<div class="text-center visible-xs-block">Tap title to toggle menu</div>');
- $('#title').on('click', () => nav.classList.toggle('hidden-xs'));
++ $('#title,#logo').on('click', () => nav.classList.toggle('hidden-xs'));
});
us: /^\/us\//,
account: /^\/account$/,
contribute: /^\/contribute$/,
+ about: /^\/about$/,
};
$(function(){
- let path = location.pathname;
- for (let nav in NAVS)
+ const path = location.pathname;
+ for (const nav in NAVS)
if(path.match(NAVS[nav]))
$('#nav-' + nav)[0].classList.add('active');
});
$('link[title]').each(e => e.disabled = true);
$('link[title="' + name + '"]')[0].disabled = false;
localStorage.setItem("theme", name);
+ $(function() {
+ if(name == 'slate' || name == 'cyborg')
+ $('img').each(e => e.setAttribute('src', e.getAttribute('src').replace('logos/light', 'logos/dark')));
+ else
+ $('img').each(e => e.setAttribute('src', e.getAttribute('src').replace('logos/dark', 'logos/light')));
+ });
}
$(function() {
- var theme_ul = '<ul class="list-inline" id="themes">' +
+ const theme_ul = '<ul class="list-inline" id="themes">' +
'<li><a role="button" data-theme="cyborg">Black</a>' +
'<li><a role="button" data-theme="slate">Grey</a>' +
'<li><a role="button" data-theme="readable">White</a></ul>';
- var sidebar = $('#sidebar')[0];
+ const sidebar = $('#sidebar')[0];
sidebar.insertBefore(m(theme_ul), sidebar.firstChild);
$('#themes a').on('click', e => set_style(e.target.dataset.theme, true));
});
- let theme = localStorage.getItem("theme");
- if(theme) {
- if(theme == "cerulean" || theme == "cosmo")
- theme = "readable";
- set_style(theme, false);
- }
+ const theme = localStorage.getItem("theme");
+ if(theme)
+ set_style(theme == "cerulean" || theme == "cosmo" ? "readable" : theme, false);