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