From: Marius Gavrilescu Date: Wed, 10 Dec 2014 12:04:59 +0000 (+0200) Subject: Split 90-custom into 90-autoresize and 90-themes X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=bcf95b418334059308214ea1c1546536c2ebf545;p=gruntmaster-page.git Split 90-custom into 90-autoresize and 90-themes --- diff --git a/MANIFEST b/MANIFEST index 93228f4..b702b07 100644 --- a/MANIFEST +++ b/MANIFEST @@ -14,8 +14,9 @@ js/00-zepto.js js/01-zepto-jquery.js js/10-bootstrap-dropdown.js js/10-bootstrap-modal.js -js/90-custom.js +js/90-autoresize.js js/90-form.js +js/90-themes.js js/90-nav.js lib/Plack/App/Gruntmaster.pm lib/Plack/App/Gruntmaster/HTML.pm diff --git a/js/90-autoresize.js b/js/90-autoresize.js new file mode 100644 index 0000000..e40ef4e --- /dev/null +++ b/js/90-autoresize.js @@ -0,0 +1,20 @@ +(function(){ + 'use strict'; + + $( 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); + }); + }); +})(); diff --git a/js/90-custom.js b/js/90-custom.js deleted file mode 100644 index 183f3dd..0000000 --- a/js/90-custom.js +++ /dev/null @@ -1,36 +0,0 @@ -(function(){ - 'use strict'; - function set_style(name){ - $('#stylesheet').attr("href", "/css/" + name + ".css"); - localStorage.setItem("theme", name); - } - - $( document ).ready(function() { - $('#theme-selector').removeClass('hidden'); - - 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"); }); - }); - - var theme = localStorage.getItem("theme"); - if(theme) { - set_style(theme); - } -})(); diff --git a/js/90-themes.js b/js/90-themes.js new file mode 100644 index 0000000..74506c8 --- /dev/null +++ b/js/90-themes.js @@ -0,0 +1,20 @@ +(function(){ + 'use strict'; + function set_style(name){ + $('#stylesheet').attr("href", "/css/" + name + ".css"); + localStorage.setItem("theme", name); + } + + $( document ).ready(function() { + $('#theme-selector').removeClass('hidden'); + $('#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); + } +})();