X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=js%2F90-custom.js;h=d847fc12092dc8dcd444e7929088dc02993e59e9;hb=e63eaf407e505337cd02d7bc7ca3010ab6337348;hp=b9a05ebcb3c0ad1d8cd4b267a30e8c7a950b6235;hpb=eef56f7a0a705023eae000009947e42014dfaefe;p=plack-app-gruntmaster.git diff --git a/js/90-custom.js b/js/90-custom.js index b9a05eb..d847fc1 100644 --- a/js/90-custom.js +++ b/js/90-custom.js @@ -1,44 +1,46 @@ -function set_style(name){ - $('#stylesheet').attr("href", "/css/" + name); - localStorage.setItem("theme", name); - - $('#yardi').attr('src', name == "slate" || name == "cyborg" ? "/img/yardi-white.png" : "/img/yardi-blue.png"); -} - -$( document ).ready(function() { - var txt = $('#comments'); - hiddenDiv = $(document.createElement('div')), - content = null; - - txt.addClass('txtstuff'); - hiddenDiv.addClass('hiddendiv common'); - - $('body').append(hiddenDiv); - - $(".form-control").on('keyup', function () { - content = $(this).val(); - - content = content.replace(/\n/g, '
'); - hiddenDiv.html(content + '
'); - - $(this).css('height', hiddenDiv.height()+23); +(function(){ + 'use strict'; + function set_style(name){ + $('#stylesheet').attr("href", "/css/" + name + ".css"); + localStorage.setItem("theme", name); + if(name == 'slate' || name == 'cyborg') + $('.logo').addClass('logo-dark'); + else + $('.logo').removeClass('logo-dark'); + } + + var theme = localStorage.getItem("theme"); + if(theme) { + set_style(theme); + } + + $( document ).ready(function() { + var hiddenDiv = $(document.createElement('div')); + + hiddenDiv.addClass('hiddendiv common'); + + $('body').append(hiddenDiv); + + $("textarea.autoresize").on('keyup', function () { + var content = $(this).val(); + + content = content.replace(/\n/g, '
'); + hiddenDiv.html(content + '
'); + + $(this).css('height', hiddenDiv.height()+23); + }); + + $('#theme_slate' ).on('click', function () { set_style("slate"); }); + $('#theme_cerulean').on('click', function () { set_style("cerulean"); }); + $('#theme_cyborg' ).on('click', function () { set_style("cyborg"); }); + $('#theme_cosmo' ).on('click', function () { set_style("cosmo"); }); + + if(!$('#sidebar').size()) { + var content = $('#content'); + content.wrapInner('
').append('