+function set_style(name){
+ $('#stylesheet').attr("href", "/css/" + name + ".var");
+ localStorage.setItem("theme", name);
+}
+
$( document ).ready(function() {
var txt = $('#comments');
hiddenDiv = $(document.createElement('div')),
$('body').append(hiddenDiv);
$(".form-control").on('keyup', function () {
+ content = $(this).val();
- content = $(this).val();
-
- content = content.replace(/\n/g, '<br>');
- hiddenDiv.html(content + '<br class="lbr">');
-
- $(this).css('height', hiddenDiv.height()+23);
+ content = content.replace(/\n/g, '<br>');
+ hiddenDiv.html(content + '<br class="lbr">');
+ $(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"));