]>
Commit | Line | Data |
---|---|---|
1 | function set_style(name){ | |
2 | $('#stylesheet').attr("href", "/css/" + name + ".var"); | |
3 | localStorage.setItem("theme", name); | |
4 | } | |
5 | ||
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 () { | |
17 | content = $(this).val(); | |
18 | ||
19 | content = content.replace(/\n/g, '<br>'); | |
20 | hiddenDiv.html(content + '<br class="lbr">'); | |
21 | ||
22 | $(this).css('height', hiddenDiv.height()+23); | |
23 | }); | |
24 | ||
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 | $('#theme_cosmo' ).on('click', function () { set_style("cosmo"); }); | |
29 | }); | |
30 | ||
31 | if(localStorage.getItem("theme")) | |
32 | set_style(localStorage.getItem("theme")); |