X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=js%2F90-themes.js;h=0bfa8bf839b2cb158da41c426e57fe9e00440538;hb=0d12c5c7ec3492867894f88979c51264374c0593;hp=9bc36047b545d8d781111259ca4e25bff45be3e2;hpb=83f90ae19688a43b54eb4f2032f43cbe0a8fa3d0;p=gruntmaster-page.git diff --git a/js/90-themes.js b/js/90-themes.js index 9bc3604..0bfa8bf 100644 --- a/js/90-themes.js +++ b/js/90-themes.js @@ -1,7 +1,8 @@ (function(){ 'use strict'; function set_style(name){ - $('#stylesheet').attr("href", "/css/" + name + ".css"); + $('link[rel~="stylesheet"]').prop('disabled', true); + $('link[title="' + name + '"]').prop('disabled', false); localStorage.setItem("theme", name); $(document).ready(function() { if(name == 'slate' || name == 'cyborg') @@ -12,14 +13,16 @@ } $( document ).ready(function() { + $('#theme-selector').detach().prependTo($('#sidebar')); $('#theme_slate' ).on('click', function () { set_style("slate"); }); - $('#theme_cerulean').on('click', function () { set_style("cerulean"); }); $('#theme_cyborg' ).on('click', function () { set_style("cyborg"); }); - $('#theme_cosmo' ).on('click', function () { set_style("cosmo"); }); + $('#theme_readable').on('click', function () { set_style("readable"); }); }); var theme = localStorage.getItem("theme"); if(theme) { + if(theme == "cerulean" || theme == "cosmo") + theme = "readable"; set_style(theme); } })();