1 2; /* Start:"a:4:{s:4:"full";s:104:"/bitrix/templates/.default/components/altasib/feedback.form/main_feedback/form_script.js?162961503612639";s:6:"source";s:88:"/bitrix/templates/.default/components/altasib/feedback.form/main_feedback/form_script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3var ALXpopup={ 4 timerId: "", 5 timerReId: "", 6 minw: 500, 7 param: "", 8 removeWindow: true, 9 fixed: false, 10 canClearBlock: false, 11 init: function(param) 12 { 13 var oPopup = this; 14 this.param = typeof param !== 'undefined' ? param : ""; 15 this.param.popupAnimation = typeof param.popupAnimation !== 'undefined' ? param.popupAnimation : ['alx-popup-show-anime1', 'alx-popup-hide-anime1', 'alx-popup-mess-show-anime1']; 16 17 if(typeof param.popupWindow != 'undefined'){ 18 this.canClearBlock = typeof param.filledWithErrors !== 'undefined' ? param.filledWithErrors !== 'Y' : false; 19 $('.alx_feed_back').find("form").unbind('submit').submit(function(){ 20 oPopup.send_dataAjax(this); 21 return false; 22 }); 23 }else{ 24 if(typeof param.cssURL !== 'undefined' && typeof param.cssURL !== 'object') 25 $('head').append("<link rel='stylesheet' type='text/css' href='" + param.cssURL + "' />"); 26 else if(typeof param.cssURL == 'object') 27 for(i in param.cssURL) $('head').append("<link rel='stylesheet' type='text/css' href='" + param.cssURL[i] + "' />"); 28 29 if(typeof param.objClick !== 'undefined'){ 30 $(param.objClick).click(function(){ 31 oPopup.show(); 32 }); 33 } 34 this.param.data = typeof param.data !== 'undefined' ? param.data : ""; 35 this.param.url = typeof param.url !== 'undefined' ? param.url : ""; 36 this.param.fixed = typeof param.fixed !== 'undefined' ? param.fixed : oPopup.fixed; 37 this.param.width = typeof param.width !== 'undefined' ? param.width : oPopup.minw; 38 this.param.height = typeof param.height !== 'undefined' ? param.height : 200; 39 this.param.removeWindow = typeof param.removeWindow !== 'undefined' ? param.removeWindow : oPopup.removeWindow; 40 } 41 }, 42 show: function() 43 { 44 var oPopup = this; 45 document.body.style.overflowX = 'hidden'; 46 if(this.param.removeWindow) 47 $('.modal_form , .overlay').remove(); 48 49 if($('.alx-feedb-data').length < 1) 50 { 51 $('body').append('<div class="modal_form"><span class="modal_close"><span class="modal_close__left"></span><span class="modal_close__right"></span></span><div class="alx-feedb-error"></div><div class="alx_cont_popup"></div></div><div class="overlay"></div>'); 52 $('.overlay').fadeIn(400); 53 $('body').append('<div class="alx_fedb_wait"><div class="alx-feedb-loading"></div><div class="alx-feedb-loading-text">loading</div></div>'); 54 $('.modal_close,.overlay,.modal_close_ok').click(function(){ // close modal event 55 oPopup.close(); 56 }); 57 oPopup.timerId = setInterval(function(){ 58 oPopup.update(); 59 }, 200); 60 setTimeout(function(){ 61 clearInterval(oPopup.timerId); 62 oPopup.show_error(); 63 }, 5000); 64 oPopup.load_contentAjax(); 65 } 66 else 67 { 68 $('.overlay').fadeIn(400); 69 if(($(window).height() > ($('.modal_form').outerHeight() + 100)) && this.param.fixed) 70 $('.modal_form').css({'top': (($(window).height() - $('.modal_form').outerHeight()) / 2 - 50) + 'px', 'marginTop': '0', 'position': 'fixed', 'opacity': 1}); 71 else 72 $('.modal_form').css({'position': 'absolute', 'marginTop': $(window).scrollTop() + 100 +'px', 'top': '0', 'opacity': 1}) 73 74 $('.modal_form').removeClass(this.param.popupAnimation[0] + ', ' +this.param.popupAnimation[1]); 75 $('.modal_form').addClass(this.param.popupAnimation[0]); 76 } 77 return true; 78 }, 79 autoResize: function() 80 { 81 var oPopup = this; 82 if($('.alx-feedb-data').length < 1 || $('.modal_form').css('position') != 'fixed') 83 { 84 clearInterval(oPopup.timerReId); 85 return; 86 } 87 88 if(($(window).height() > $('.modal_form').outerHeight() + 100) && this.param.fixed) 89 $('.modal_form').css({'top': (($(window).height() - $('.modal_form').outerHeight()) / 2 - 50) + 'px', 'marginTop': '0', 'position': 'fixed'}); 90 else 91 $('.modal_form').css({'position': 'absolute', 'marginTop': $(window).scrollTop() + 100 +'px', 'top': '0'}); 92 }, 93 update: function() 94 { 95 var oPopup = this; 96 if($('.alx-feedb-data').length < 1) 97 return; 98 99 clearInterval(oPopup.timerId); 100 var w=''; 101 102 if((this.param.width+"").split('%').length == 1){ 103 w = (this.param.width+"").split('px'); 104 var mLeft = 0-parseInt(w[0])/2 + 'px'; 105 }else{ 106 w = (this.param.width+"").split('%'); 107 var mLeft = 0-parseInt(w[0])/2+'%'; 108 } 109 110 $('.modal_form').css({'marginLeft': mLeft, 'width': this.param.width}); 111 112 if(($(window).height() > $('.modal_form').outerHeight() + 100) && this.param.fixed) 113 $('.modal_form').css({'top': (($(window).height() - $('.modal_form').outerHeight()) / 2 - 50) + 'px', 'marginTop': '0', 'position': 'fixed'}); 114 else 115 $('.modal_form').css({'position': 'absolute', 'marginTop': $(window).scrollTop() + 100 +'px', 'top': '0'}); 116 117 if(typeof this.param.popupAnimation!='undefined') 118 var animClass = this.param.popupAnimation[0]; 119 120 $('.modal_form').delay(400).queue(function(){ 121 $('.alx_fedb_wait').fadeOut(400, function(){ $(this).remove() }); 122 $('.modal_form').addClass(animClass); 123 $('.alx-feedb-data').addClass('alx-feedb-data-view'); 124 }); 125 126 if($('.modal_form').css('z-index')<0) 127 $('.modal_form').css({'z-index':'2001'}); 128 setTimeout(function(){ // for ie 129 if($('.modal_form').css('opacity')<1) 130 $('.modal_form').css({'opacity':1}); 131 }, 1000); 132 133 oPopup.timerReId = setInterval(function(){ 134 oPopup.autoResize(); 135 }, 400); 136 }, 137 138 close: function() 139 { 140 var oPopup = this; 141 var animClass = this.param.popupAnimation[1]; 142 $('.alx-feedb-data').css({'maxHeight': ($(window).height()-100)+'px'}); 143 $('.modal_form').addClass(animClass); 144 $('.overlay, .alx_fedb_wait, .modal_form').fadeOut(400); 145 146 setTimeout(function(){ 147 if($('.modal_form').css('z-index')>2000) 148 $('.modal_form').css({'z-index':'-1'}); 149 document.body.style.overflowX = ''; 150 },750); 151 setTimeout(function(){ // for ie 152 if($('.modal_form').css('opacity')>0) 153 $('.modal_form').css({'opacity':0, 'marginTop': '-100000px'}); 154 if(oPopup.removeWindow || ($('.alx-feedb-data-errorLoading').length > 1)) 155 $('.modal_form, .overlay').remove(); 156 }, 500); 157 }, 158 show_error: function() 159 { 160 var oPopup = this; 161 if($('.alx-feedb-data').length < 1){ 162 $('.alx_cont_popup').html('<div class="alx-feedb-data alx-feedb-data-errorLoading">Loading error. Try again.<br /><a href="" onClick="ALXpopup.close(); return false" class="alx-feedb-data-close">close window</a></div>'); 163 oPopup.update(); 164 } 165 }, 166 load_contentAjax: function() 167 { 168 if(typeof this.param.data!='undefined'){ 169 var oPopup = this; 170 $.ajax({ 171 type:'POST', 172 data: this.param.data, 173 url: this.param.url, 174 async:true, 175 success:function(data){ 176 $('.alx_cont_popup').html('<div class="alx-feedb-data">'+data+'</div>'); 177 $('.alx-feedb-data').find("form").submit(function(){ 178 oPopup.send_dataAjax(this); 179 return false;
180 }); 181 } 182 }); 183 } 184 }, 185 reload_contentAjax: function() 186 { 187 var oPopup = this; 188 $('body').append('<div class="alx_fedb_wait"><div class="alx-feedb-loading"></div><div class="alx-feedb-loading-text">loading</div></div>'); 189 $.ajax({ 190 type:'POST', 191 data: this.param.data, 192 url: this.param.url, 193 async:true, 194 success:function(data){ 195 $('.alx-feedb-data').remove(); 196 $('.alx_fedb_wait').remove(); 197 $('.alx_cont_popup').html('<div class="alx-feedb-data">'+data+'</div>'); 198 $('.alx-feedb-data').addClass('alx-feedb-data-view'); 199 $('.alx-feedb-data').find("form").submit(function(){ 200 oPopup.send_dataAjax(this); 201 return false; 202 }); 203 } 204 }); 205 }, 206 ok_window: function(param) 207 { 208 var oPopup = this; 209 var w = typeof param.width !== 'undefined' ? param.width : 300; 210 211 if((w+"").split('%').length == 1){ 212 w = (w+"").split('px'); 213 var mLeft = 0-parseInt(w[0])/2 + 'px'; 214 }else{ 215 w = (w+"").split('%'); 216 var mLeft = 0-parseInt(w[0])/2+'%'; 217 } 218 $('.modal_form').css({'marginLeft': mLeft, 'width': w, 'position': 'fixed', 'top': '30%', 'marginTop': '0'}); 219 if(typeof param.fid!='undefined') 220 $('#alx_feed_back_'+param.fid+'.alx-feedb-data, #alx_feed_back_'+param.fid+'.alx_feed_back').empty(); 221 else 222 $('.modal_form .alx-feedb-data,.alx_feed_back').empty(); 223 $('.modal_close_ok').click(function(){oPopup.close();}); 224 }, 225 send_dataAjax: function(form) 226 { 227 var oPopup = this; 228 229 var animClass = this.param.popupAnimation[2]; 230 var url = $(form).attr('action'); 231 url = typeof url !== 'undefined' ? url : ""; 232 var bTypeFD = false; 233 if(typeof FormData=='function'){ 234 var FORM_DATA = new FormData(form); 235 bTypeFD = true; 236 }else 237 var FORM_DATA = $(form).serializeArray(); 238 $.ajax({ 239 url: url, 240 type:'POST', 241 data:FORM_DATA, 242 cache:false, 243 processData:(bTypeFD?false:true), 244 contentType:(bTypeFD?false:'application/x-www-form-urlencoded;charset=UTF-8'), 245 success:function(data){ 246 var sID = $(form).attr('name').split('_')[2]; 247 var sDelim='<!--REFRESH_SECTION-->'; 248 var pos=data.indexOf(sDelim); 249 var errData=data, formData=false; 250 if(pos>-1){ 251 errData=data.substr(0,pos); 252 formData=data.substr(pos+sDelim.length); 253 } 254 255 if(formData){ 256 $('#alx_feed_back_'+sID+'.alx_feed_back').html(formData); 257 } 258 259 if(typeof sID!='undefined' && $('#alx_feed_back_'+sID).siblings(".alx-feedb-error").length>0){ 260 $('#alx_feed_back_'+sID).siblings(".alx-feedb-error").html(errData).addClass(animClass); 261 } 262 else if(typeof sID!='undefined' && $('#alx_feed_back_'+sID).parent().parent().siblings(".alx-feedb-error").length>0){ 263 $('#alx_feed_back_'+sID).parent().parent().siblings(".alx-feedb-error").html(errData).addClass(animClass); 264 } 265 else{ 266 $('.alx-feedb-error').html(errData).addClass(animClass); 267 } 268 269 if(oPopup.canClearBlock) $('#alx_feed_back_'+sID+'.alx_feed_back').empty(); 270 return true; 271 } 272 }); 273 } 274} 275 276function alx_addFormGroupFocus(element){ 277 var $element = $(element); 278 if(!$element.prop('disabled')){ 279 $element.parents(".afbf_item_pole").addClass("is_focused"); 280 } 281} 282function alx_removeFormGroupFocus(element){ 283 var $element = $(element); 284 $(element).parents(".afbf_item_pole").removeClass("is_focused is_filled"); 285 if($element.val().length !== 0){ 286 $(element).parents(".afbf_item_pole").addClass("is_filled"); 287 } 288} 289 290$(document).ready(function(){ 291 292 $('.alx_feed_back .item_pole__captcha .afbf_name').each(function(i,elem){ 293 $(elem).next().find('input').css({'height':$(elem).height()+'px'}); 294 }); 295 296 $(document).on("focus", ".afbf_item_pole .afbf_inputtext,.afbf_item_pole .afbf_textarea,.afbf_item_pole .afbf_select,.afbf_item_pole .afbf_textarea,.afbf_item_pole .afbf_file_input_add", function(){ 297 alx_addFormGroupFocus(this); 298 }) 299 .on("blur", ".afbf_item_pole .afbf_inputtext,.afbf_item_pole .afbf_textarea,.afbf_item_pole .afbf_select,.afbf_item_pole .afbf_textarea,.afbf_item_pole .afbf_file_input_add", function(){ 300 alx_removeFormGroupFocus(this); 301 }); 302}); 303function poleError(pole){ 304 if(pole.name.split('[').length > 1){ 305 if(pole.name.split('[')[1].split('_')[0] == 'EMAIL'){ 306 if(!checkEmail(pole.value)) return true; 307 } 308 } 309 if(pole.type=='radio' || pole.type=='checkbox'){ 310 if(!pole.checked && $('[name="'+pole.name+'"]:checked').length==0) return true; 311 else return false;
312 } 313 if(pole.value.length==0 || !$(pole).val()){ 314 return true; 315 } 316 return false; 317} 318function checkEmail(email){ 319 var re = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; 320 return re.test(email); 321} 322function validateForm(form){ 323 var required_fields = form.find('.afbf_item_pole.required'); 324 var email_fields = form.find('.afbf_item_pole.is_email'); 325 if(required_fields.length > 0 || email_fields.length > 0){ 326 email_fields.each(function(){ 327 var $this = $(this); 328 $this.find('input[name]').not('[type=hidden]').each(function(){ 329 if(this.value!='' && !checkEmail(this.value)) $this.addClass('error_pole'); 330 else $this.removeClass('error_pole'); 331 }); 332 }); 333 required_fields.each(function(){ 334 var $this = $(this); 335 $this.find('input[name],textarea[name],select[name]').not('[type=hidden]').each(function(){ 336 if(poleError(this)) $this.addClass('error_pole'); 337 else $this.removeClass('error_pole'); 338 }); 339 }); 340 var errorPoles = form.find('.afbf_item_pole.required.error_pole'); 341 if(errorPoles.length > 0){ 342 errorPoles.eq(0).find('input,textarea').not('[type=hidden]').focus(); 343 return false; 344 } 345 } 346 return true; 347} 348function ALX_captcha_Error(){ 349 $('.item_pole__captcha').addClass('error_pole'); 350} 351function ALX_captcha_Error(){ 352 $('.item_pole__captcha').addClass('error_pole'); 353} 354function ALX_fileError(field){ 355 field.addClass('error_fpole'); 356} 357 358 359$(document).on('change', '#licenses_popup_formcallback_main', function() { 360 361 let $this = $(this); 362 let $btn = $('.js-btn-form-main-page-send'); 363 364 if($this.prop('checked') === true) { 365 $btn.prop('disabled', false); 366 } else { 367 $btn.prop('disabled', true); 368 } 369 370}); 371/* End */ 372;; /* /bitrix/templates/.default/components/altasib/feedback.form/main_feedback/form_script.js?162961503612639*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.