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