X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=js%2F90-custom.js;h=183f3dd3c282aff96679e85b6f942df027ecfb80;hb=4b4a81371ead43b2f9e01a924625eda1e5275199;hp=a108d940b78ac11d1cf2f8e18fab14621f9daf06;hpb=7dc3247307f2e86af154dc449224f22ba8923c79;p=gruntmaster-page.git diff --git a/js/90-custom.js b/js/90-custom.js index a108d94..183f3dd 100644 --- a/js/90-custom.js +++ b/js/90-custom.js @@ -1,45 +1,36 @@ -function set_style(name){ - $('#stylesheet').attr("href", "/css/" + name); - localStorage.setItem("theme", name); +(function(){ + 'use strict'; + function set_style(name){ + $('#stylesheet').attr("href", "/css/" + name + ".css"); + localStorage.setItem("theme", name); + } - $('#yardi').attr('src', name == "slate" || name == "cyborg" ? "/img/yardi-white.png" : "/img/yardi-blue.png"); -} + $( document ).ready(function() { + $('#theme-selector').removeClass('hidden'); -$( document ).ready(function() { - var txt = $('#comments'); - hiddenDiv = $(document.createElement('div')), - content = null; + var hiddenDiv = $(document.createElement('div')); - txt.addClass('txtstuff'); - hiddenDiv.addClass('hiddendiv common'); + hiddenDiv.addClass('hiddendiv common'); - $('body').append(hiddenDiv); + $('body').append(hiddenDiv); - $(".form-control").on('keyup', function () { - content = $(this).val(); + $("textarea.autoresize").on('keyup', function () { + var content = $(this).val(); - content = content.replace(/\n/g, '
'); - hiddenDiv.html(content + '
'); + content = content.replace(/\n/g, '
'); + hiddenDiv.html(content + '
'); - $(this).css('height', hiddenDiv.height()+23); + $(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"); }); }); - $('#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"); }); -}); - -var theme = localStorage.getItem("theme"); -if(theme) { - set_style(theme); - $(document).ready(function(){ - $('#yardi').attr('src', theme == "slate" || theme == "cyborg" ? "/img/yardi-white.png" : "/img/yardi-blue.png"); - }) -} - -$( document ).ready(function() { - var sb=$('#sidebar').detach(); - sb.appendTo($('#sponsors')); - console.log( "inside!" ); -}); + var theme = localStorage.getItem("theme"); + if(theme) { + set_style(theme); + } +})();