]>
Commit | Line | Data |
---|---|---|
c7a5e4e0 MG |
1 | (function(){ |
2 | 'use strict'; | |
3 | function set_style(name){ | |
f06ba039 | 4 | $('#stylesheet').attr("href", "/css/" + name + ".css"); |
c7a5e4e0 | 5 | localStorage.setItem("theme", name); |
1fb046b0 MG |
6 | if(name == 'slate' || name == 'cyborg') |
7 | $('.logo').addClass('logo-dark'); | |
8 | else | |
9 | $('.logo').removeClass('logo-dark'); | |
10 | } | |
11 | ||
12 | var theme = localStorage.getItem("theme"); | |
13 | if(theme) { | |
14 | set_style(theme); | |
c7a5e4e0 | 15 | } |
7dc32473 | 16 | |
c7a5e4e0 MG |
17 | $( document ).ready(function() { |
18 | var hiddenDiv = $(document.createElement('div')); | |
7dc32473 | 19 | |
c7a5e4e0 | 20 | hiddenDiv.addClass('hiddendiv common'); |
7dc32473 | 21 | |
c7a5e4e0 | 22 | $('body').append(hiddenDiv); |
7dc32473 | 23 | |
c7a5e4e0 MG |
24 | $("textarea.autoresize").on('keyup', function () { |
25 | var content = $(this).val(); | |
7dc32473 | 26 | |
c7a5e4e0 MG |
27 | content = content.replace(/\n/g, '<br>'); |
28 | hiddenDiv.html(content + '<br class="lbr">'); | |
7dc32473 | 29 | |
c7a5e4e0 MG |
30 | $(this).css('height', hiddenDiv.height()+23); |
31 | }); | |
7dc32473 | 32 | |
c7a5e4e0 MG |
33 | $('#theme_slate' ).on('click', function () { set_style("slate"); }); |
34 | $('#theme_cerulean').on('click', function () { set_style("cerulean"); }); | |
35 | $('#theme_cyborg' ).on('click', function () { set_style("cyborg"); }); | |
36 | $('#theme_cosmo' ).on('click', function () { set_style("cosmo"); }); | |
514a5a0e MG |
37 | |
38 | if(!$('#sidebar').size()) { | |
39 | var content = $('#content'); | |
40 | content.wrapInner('<div class="col-md-9">').append('<div id="sidebar" class="col-md-3">').addClass('row'); | |
41 | } | |
42 | $('#sponsors').detach().appendTo($('#sidebar')); | |
7dc32473 | 43 | |
1fb046b0 MG |
44 | if(theme) set_style(theme); |
45 | }); | |
c7a5e4e0 | 46 | })(); |