X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=js%2Fscripts.js;h=9e4f7700dc800e773e639a84d4efe7dc50c3a598;hb=ba2dbdbfe2082f76451eeb5aba16be857faf4395;hp=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hpb=7b8697217dd7b910c8600a1290d0a9590437afc0;p=mindcoding-template-patches.git diff --git a/js/scripts.js b/js/scripts.js old mode 100755 new mode 100644 index e69de29..9e4f770 --- a/js/scripts.js +++ b/js/scripts.js @@ -0,0 +1,32 @@ +function set_style(name){ + $('#stylesheet').attr("href", "/css/" + name + ".var"); + localStorage.setItem("theme", name); +} + +$( document ).ready(function() { + var txt = $('#comments'); + hiddenDiv = $(document.createElement('div')), + content = null; + + txt.addClass('txtstuff'); + hiddenDiv.addClass('hiddendiv common'); + + $('body').append(hiddenDiv); + + $(".form-control").on('keyup', function () { + content = $(this).val(); + + content = content.replace(/\n/g, '
'); + hiddenDiv.html(content + '
'); + + $(this).css('height', hiddenDiv.height()+23); + }); + + $('#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"));