X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=js%2F90-themes.js;h=50834da65622a6ffd71536067798d34a8ad54d95;hb=5776eb1224280d006eda895436aeff574311366c;hp=a9d9b5185ebf5f1bd905dffc0767b46841b7bf4e;hpb=65d5cb3b6007fa0bc758722983b3f0afefc02f2e;p=gruntmaster-page.git diff --git a/js/90-themes.js b/js/90-themes.js index a9d9b51..50834da 100644 --- a/js/90-themes.js +++ b/js/90-themes.js @@ -3,9 +3,14 @@ function set_style(name, trans){ document.body.classList.add('transition-color'); setTimeout(() => document.body.classList.remove('transition-color'), 1000); } - $('link[title]').each(e => e.disabled = true); - $('link[title="' + name + '"]')[0].disabled = false; + q('html').className = name; 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() { @@ -13,7 +18,7 @@ $(function() { '
  • Black' + '
  • Grey' + '
  • White'; - const sidebar = $('#sidebar')[0]; + const sidebar = q('#sidebar'); sidebar.insertBefore(m(theme_ul), sidebar.firstChild); $('#themes a').on('click', e => set_style(e.target.dataset.theme, true)); });