X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=js%2Fscripts.js;h=9e4f7700dc800e773e639a84d4efe7dc50c3a598;hb=88da92e702d2f02d56047f54b5dbcb025d49b1f9;hp=fc421abf857cb25aaf509066c3c696f606cf81e8;hpb=e9902b1b1f99d9298e3bdac4616ae3c457512b65;p=mindcoding-template-patches.git diff --git a/js/scripts.js b/js/scripts.js index fc421ab..9e4f770 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -1,3 +1,8 @@ +function set_style(name){ + $('#stylesheet').attr("href", "/css/" + name + ".var"); + localStorage.setItem("theme", name); +} + $( document ).ready(function() { var txt = $('#comments'); hiddenDiv = $(document.createElement('div')), @@ -9,14 +14,19 @@ $( document ).ready(function() { $('body').append(hiddenDiv); $(".form-control").on('keyup', function () { + content = $(this).val(); - content = $(this).val(); - - content = content.replace(/\n/g, '
'); - hiddenDiv.html(content + '
'); - - $(this).css('height', hiddenDiv.height()+23); + content = content.replace(/\n/g, '
'); + hiddenDiv.html(content + '
'); + $(this).css('height', hiddenDiv.height()+23); }); -}); \ No newline at end of file + $('#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"); }); +}); + +if(localStorage.getItem("theme")) + set_style(localStorage.getItem("theme"));