]>
Commit | Line | Data |
---|---|---|
c7a5e4e0 MG |
1 | (function(){ |
2 | 'use strict'; | |
3 | function set_style(name){ | |
f06ba039 | 4 | $('#stylesheet').attr("href", "/css/" + name + ".css"); |
c7a5e4e0 MG |
5 | localStorage.setItem("theme", name); |
6 | } | |
7dc32473 | 7 | |
c7a5e4e0 MG |
8 | $( document ).ready(function() { |
9 | var hiddenDiv = $(document.createElement('div')); | |
7dc32473 | 10 | |
c7a5e4e0 | 11 | hiddenDiv.addClass('hiddendiv common'); |
7dc32473 | 12 | |
c7a5e4e0 | 13 | $('body').append(hiddenDiv); |
7dc32473 | 14 | |
c7a5e4e0 MG |
15 | $("textarea.autoresize").on('keyup', function () { |
16 | var content = $(this).val(); | |
7dc32473 | 17 | |
c7a5e4e0 MG |
18 | content = content.replace(/\n/g, '<br>'); |
19 | hiddenDiv.html(content + '<br class="lbr">'); | |
7dc32473 | 20 | |
c7a5e4e0 MG |
21 | $(this).css('height', hiddenDiv.height()+23); |
22 | }); | |
7dc32473 | 23 | |
c7a5e4e0 MG |
24 | $('#theme_slate' ).on('click', function () { set_style("slate"); }); |
25 | $('#theme_cerulean').on('click', function () { set_style("cerulean"); }); | |
26 | $('#theme_cyborg' ).on('click', function () { set_style("cyborg"); }); | |
27 | $('#theme_cosmo' ).on('click', function () { set_style("cosmo"); }); | |
7dc32473 MG |
28 | }); |
29 | ||
c7a5e4e0 MG |
30 | var theme = localStorage.getItem("theme"); |
31 | if(theme) { | |
32 | set_style(theme); | |
33 | } | |
34 | })(); |