From: Marius Gavrilescu Date: Mon, 20 Apr 2015 07:42:21 +0000 (+0300) Subject: Merge branch 'master' into newmc X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=260a6894d9fdfe3cd2f05cd1926b77b46119dc01;hp=d19b7b577a3b51ad59f88cf0057bf9ff49343d7e;p=gruntmaster-page.git Merge branch 'master' into newmc Conflicts: css/custom.css --- diff --git a/css/custom.css b/css/custom.css index 2d5060b..e85a91b 100644 --- a/css/custom.css +++ b/css/custom.css @@ -79,3 +79,7 @@ td.user, td.owner, .break-all { #themes:before { content: " Themes: "; } + +.transition-color, .transition-color * { + transition: color 0.5s ease-in, background-color 0.5s ease-in; +} diff --git a/js/90-themes.js b/js/90-themes.js index 756b156..347cad2 100644 --- a/js/90-themes.js +++ b/js/90-themes.js @@ -1,4 +1,8 @@ -function set_style(name){ +function set_style(name, trans){ + if(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; localStorage.setItem("theme", name); @@ -17,12 +21,12 @@ $(function() { '
  • White'; var sidebar = $('#sidebar')[0]; sidebar.insertBefore(m(theme_ul), sidebar.firstChild); - $('#themes a').on('click', e => set_style(e.target.dataset.theme)); + $('#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); + set_style(theme, false); }