Make theme chooser rememeber theme
[mindcoding-template-patches.git] / js / scripts.js
CommitLineData
4de434ba
MG
1function set_style(name){
2 $('#stylesheet').attr("href", "/css/" + name + ".var");
b78f93c9 3 localStorage.setItem("theme", name);
4de434ba
MG
4}
5
e9902b1b
S
6$( document ).ready(function() {
7 var txt = $('#comments');
8 hiddenDiv = $(document.createElement('div')),
9 content = null;
10
11 txt.addClass('txtstuff');
12 hiddenDiv.addClass('hiddendiv common');
13
14 $('body').append(hiddenDiv);
15
16 $(".form-control").on('keyup', function () {
4de434ba 17 content = $(this).val();
e9902b1b 18
4de434ba
MG
19 content = content.replace(/\n/g, '<br>');
20 hiddenDiv.html(content + '<br class="lbr">');
e9902b1b 21
4de434ba 22 $(this).css('height', hiddenDiv.height()+23);
e9902b1b
S
23 });
24
4de434ba
MG
25 $('#theme_slate' ).on('click', function () { set_style("slate"); });
26 $('#theme_cerulean').on('click', function () { set_style("cerulean"); });
27 $('#theme_cyborg' ).on('click', function () { set_style("cyborg"); });
28});
b78f93c9
MG
29
30if(localStorage.getItem("theme"))
31 set_style(localStorage.getItem("theme"));
This page took 0.011629 seconds and 4 git commands to generate.