You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
2.1 KiB
1 lines
2.1 KiB
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}(); |