From b9710b5d532b64603cecc0e6cf7b97e946210015 Mon Sep 17 00:00:00 2001 From: Alexander Burdeiny Date: Mon, 25 Apr 2016 18:19:36 +0300 Subject: [PATCH] =?UTF-8?q?1242:=20=D0=A3=D0=B1=D1=80=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D0=B5=20=D0=BF=D1=80=D0=B8=20=D1=80=D0=B5?= =?UTF-8?q?=D0=B3=D0=B8=D1=81=D1=82=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D1=81=20=D0=9C=D0=BE=D0=B4=D0=B0=D0=BB=D0=BA=D0=B0?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81=D0=BA=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=BE=D0=B2=D0=BE=D1=81=D1=82=D0=B8=20-=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B1=D0=B8=D0=BB=D0=B0=20=D0=BC=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0=D0=BB=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/_modules/block.registration.completion.js | 10 ++++++++-- .../_modules/block.registration.completion.min.js | 2 +- templates/client/popups/announce_subscription.html | 11 +++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/static/client/js/_modules/block.registration.completion.js b/static/client/js/_modules/block.registration.completion.js index dc1c5931..bbc70091 100644 --- a/static/client/js/_modules/block.registration.completion.js +++ b/static/client/js/_modules/block.registration.completion.js @@ -116,7 +116,7 @@ if (EXPO.registration.completion) { }); - + window.reg_opened = window.reg_opened || false $.fancybox.open([ { href: '#end-reg' @@ -134,7 +134,13 @@ if (EXPO.registration.completion) { keys: { // prevents closing when press ESC button close: null - } + }, + afterClose: function() { + window.reg_opened = false; + }, + beforeShow: function() { + window.reg_opened = true; + }, }); diff --git a/static/client/js_min/_modules/block.registration.completion.min.js b/static/client/js_min/_modules/block.registration.completion.min.js index 4264d2c5..91bad516 100644 --- a/static/client/js_min/_modules/block.registration.completion.min.js +++ b/static/client/js_min/_modules/block.registration.completion.min.js @@ -1 +1 @@ -var EXPO=EXPO||{};EXPO.registration=EXPO.registration||{},EXPO.registration.completion?console.warn("WARNING: EXPO.registration..completion is already defined!"):EXPO.registration.completion=function(){var t={},e=function(t){var e=$("#end-reg"),i="pwf-line",o=EXPO.common.opt.activeClass,n="phone",r="label",a=EXPO.common.opt.errMessageClass;if($("."+a,e).removeClass(o),t.success)location=t.redirect;else{console.log(t);for(var s in t.errors)t.errors.hasOwnProperty(s)&&($itemWrap=$("#id_"+s).closest("."+i),$("."+a,$itemWrap).addClass(o).text(t.errors[s][0]),$itemWrap.hasClass(n)&&$("."+r,$itemWrap).hide())}},i=function(t){$("#id_country").val("159").select2({placeholder:"Ваша страна",width:t}).on("change",function(){var t=$("option:selected",this).attr("data-phone-code");""!=$.trim(t)?$("#id_code_country").select2("val",t):$("#id_code_country").select2("val","")}),$("#id_city").select2({placeholder:"Ваш город",width:t,ajax:{url:"/city/get-city/",dataType:"json",quietMillis:200,data:function(t,e,i){var i=$("#id_country").val();return{term:t,page:e,country:i}},results:function(t){var e=[];return $.each(t,function(t,i){e.push({id:i.id,text:i.label})}),{results:e}}},initSelection:function(t,e){var i=$(t).val(),o=$(t).attr("data-init-text");e({id:i,text:o})}})};t.opt={};EXPO.common;return $(function(){var t=$("#end-reg-form");$("body").addClass("body-fixed"),i("100%"),$("#id_code_country").val("7").select2({width:"95px"}),$.fancybox.open([{href:"#end-reg"}],{closeBtn:!1,closeClick:!1,modal:!0,scrolling:"no",helpers:{overlay:{closeClick:!1},locked:!0},keys:{close:null}}),t.on("submit",function(t){t.preventDefault();var i=$(this).attr("action"),o=$(this).serialize();$.post(i,o,e)}),$(".url-field:not(.err) input",t).focusin(function(){$(this).parent().siblings(".hint-box").fadeIn()}),$(".url-field:not(err) input",t).focusout(function(){$(this).parent().siblings(".hint-box").fadeOut()})}),t.init=function(t){$.extend(this.opt,t)},t}(); \ No newline at end of file +var EXPO=EXPO||{};EXPO.registration=EXPO.registration||{},EXPO.registration.completion?console.warn("WARNING: EXPO.registration..completion is already defined!"):EXPO.registration.completion=function(){var e={},t=function(e){var t=$("#end-reg"),o="pwf-line",n=EXPO.common.opt.activeClass,i="phone",r="label",a=EXPO.common.opt.errMessageClass;if($("."+a,t).removeClass(n),e.success)location=e.redirect;else{console.log(e);for(var s in e.errors)e.errors.hasOwnProperty(s)&&($itemWrap=$("#id_"+s).closest("."+o),$("."+a,$itemWrap).addClass(n).text(e.errors[s][0]),$itemWrap.hasClass(i)&&$("."+r,$itemWrap).hide())}},o=function(e){$("#id_country").val("159").select2({placeholder:"Ваша страна",width:e}).on("change",function(){var e=$("option:selected",this).attr("data-phone-code");""!=$.trim(e)?$("#id_code_country").select2("val",e):$("#id_code_country").select2("val","")}),$("#id_city").select2({placeholder:"Ваш город",width:e,ajax:{url:"/city/get-city/",dataType:"json",quietMillis:200,data:function(e,t,o){var o=$("#id_country").val();return{term:e,page:t,country:o}},results:function(e){var t=[];return $.each(e,function(e,o){t.push({id:o.id,text:o.label})}),{results:t}}},initSelection:function(e,t){var o=$(e).val(),n=$(e).attr("data-init-text");t({id:o,text:n})}})};e.opt={};EXPO.common;return $(function(){var e=$("#end-reg-form");$("body").addClass("body-fixed"),o("100%"),$("#id_code_country").val("7").select2({width:"95px"}),window.reg_opened=window.reg_opened||!1,$.fancybox.open([{href:"#end-reg"}],{closeBtn:!1,closeClick:!1,modal:!0,scrolling:"no",helpers:{overlay:{closeClick:!1},locked:!0},keys:{close:null},afterClose:function(){window.reg_opened=!1},beforeShow:function(){window.reg_opened=!0}}),e.on("submit",function(e){e.preventDefault();var o=$(this).attr("action"),n=$(this).serialize();$.post(o,n,t)}),$(".url-field:not(.err) input",e).focusin(function(){$(this).parent().siblings(".hint-box").fadeIn()}),$(".url-field:not(err) input",e).focusout(function(){$(this).parent().siblings(".hint-box").fadeOut()})}),e.init=function(e){$.extend(this.opt,e)},e}(); \ No newline at end of file diff --git a/templates/client/popups/announce_subscription.html b/templates/client/popups/announce_subscription.html index a5d8f08f..7ec387b6 100644 --- a/templates/client/popups/announce_subscription.html +++ b/templates/client/popups/announce_subscription.html @@ -63,8 +63,13 @@ $(function() { + window.reg_opened = window.reg_opened || false - setTimeout(function(){ + function open_func() { + if (window.reg_opened) { + setTimeout(open_func, 1000); + return; + } setCookie('subscribe_popup', '1', 30); $.ajax({ url:'/newsletters/tracking/newsletter/count-popup/', @@ -78,7 +83,9 @@ [{href: '#pw-subscribe-popup'}], {} ); - }, 1000); + } + + setTimeout(open_func, 1000); });