Highlight current nav via javascript
[gruntmaster-page.git] / js / 90-custom.js
CommitLineData
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 8 $( document ).ready(function() {
4896df53
MG
9 $('#theme-selector').removeClass('hidden');
10
c7a5e4e0 11 var hiddenDiv = $(document.createElement('div'));
7dc32473 12
c7a5e4e0 13 hiddenDiv.addClass('hiddendiv common');
7dc32473 14
c7a5e4e0 15 $('body').append(hiddenDiv);
7dc32473 16
c7a5e4e0
MG
17 $("textarea.autoresize").on('keyup', function () {
18 var content = $(this).val();
7dc32473 19
c7a5e4e0
MG
20 content = content.replace(/\n/g, '<br>');
21 hiddenDiv.html(content + '<br class="lbr">');
7dc32473 22
c7a5e4e0
MG
23 $(this).css('height', hiddenDiv.height()+23);
24 });
7dc32473 25
c7a5e4e0
MG
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"); });
7dc32473
MG
30 });
31
c7a5e4e0
MG
32 var theme = localStorage.getItem("theme");
33 if(theme) {
34 set_style(theme);
35 }
36})();
This page took 0.013002 seconds and 4 git commands to generate.