From 1f50229aa5a7e97a2df285540dddecbb7957df33 Mon Sep 17 00:00:00 2001 From: gskema Date: Mon, 2 May 2016 14:42:19 +0300 Subject: [PATCH 1/4] [*] JS: Clean up blocknewsletter JS --- .../blocknewsletter/blocknewsletter.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/themes/community-theme-16/js/modules/blocknewsletter/blocknewsletter.js b/themes/community-theme-16/js/modules/blocknewsletter/blocknewsletter.js index 8e6b864c..bbd67077 100644 --- a/themes/community-theme-16/js/modules/blocknewsletter/blocknewsletter.js +++ b/themes/community-theme-16/js/modules/blocknewsletter/blocknewsletter.js @@ -1,22 +1,29 @@ -$(document).ready(function() { +$(function() { $('#newsletter-input').on({ focus: function() { - if ($(this).val() == placeholder_blocknewsletter || $(this).val() == msg_newsl) + if ($(this).val() == placeholder_blocknewsletter || $(this).val() == msg_newsl) { $(this).val(''); + } }, blur: function() { - if ($(this).val() == '') + if ($(this).val() == '') { $(this).val(placeholder_blocknewsletter); + } } }); - var cssClass = 'alert alert-danger'; - if (typeof nw_error != 'undefined' && !nw_error) - cssClass = 'alert alert-success'; + var alertClass = 'alert alert-danger'; + if (typeof nw_error != 'undefined' && !nw_error) { + alertClass = 'alert alert-success'; + } if (typeof msg_newsl != 'undefined' && msg_newsl) { - $('#columns').prepend('

' + alert_blocknewsletter + '

'); - $('html, body').animate({scrollTop: $('#columns').offset().top}, 'slow'); + var $cols = $('#columns'); + $cols.prepend('
' + alert_blocknewsletter + '
'); + $('html, body').animate({ + scrollTop: $cols.offset().top + }, 'slow'); } + }); From ae21596f9d1f88df1880d37fc42f9de5d0bc13a5 Mon Sep 17 00:00:00 2001 From: gskema Date: Mon, 2 May 2016 14:42:43 +0300 Subject: [PATCH 2/4] [*] FO: Make blocknewsletter input required and of email type --- .../modules/blocknewsletter/blocknewsletter.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/community-theme-16/modules/blocknewsletter/blocknewsletter.tpl b/themes/community-theme-16/modules/blocknewsletter/blocknewsletter.tpl index 2bda160d..f846268d 100644 --- a/themes/community-theme-16/modules/blocknewsletter/blocknewsletter.tpl +++ b/themes/community-theme-16/modules/blocknewsletter/blocknewsletter.tpl @@ -3,7 +3,7 @@
- +