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
1.9 KiB
1 lines
1.9 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 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}(); |