1 2$(document).ready(function(){ 3 $(window).resize(function() { 4 if ($(window).width() > 430) { 5 $("#mpm_callforprice_form_captcha").css({"border-top": "1px solid #dadada", "border-right": "none", "border-bottom": "1px solid #dadada", "border-left": "1px solid #dadada",}); 6 } 7 }); 8 9 $(document).on('click', '.exclusive_callforprice', function(e){ 10 e.stopPropagation(); 11 e.preventDefault(); 12 showCallForPriceForm($(this).attr('data-id-product'), $(this).attr('data-id-lang'), $(this).attr('data-id-shop'), $(this).attr('data-base-dir')); 13 }); 14 15 $(document).on('click', '#button_large_call', function(e){ 16 e.preventDefault(); 17 sendEmail($(this).attr('data-id-product'), $(this).attr('data-id-lang'), $(this).attr('data-id-shop'), $(this).attr('data-base-dir')); 18 }); 19 20 $(document).on('click', '.gomakoil_call_block .close_block, .inform_call_block .close_block, .gomakoil_overlay', function(){ 21 $('.inform_call_block').fadeOut('500'); 22 $('.gomakoil_call_block').css('opacity',0); 23 $('.gomakoil_overlay').fadeOut('900'); 24 setTimeout(" $('.gomakoilFreeCallContent ').remove()", 1000); 25 setTimeout(" $('.inform_call_block').remove()", 100); 26 }); 27 28 29 direction = 0; 30 31 window.onload = function() { 32 if (window.addEventListener) window.addEventListener("DOMMouseScroll", mouse_wheel, false); 33 window.onmousewheel = document.onmousewheel = mouse_wheel; 34 }; 35 36 var mouse_wheel = function(event) { 37 if (false == !!event) event = window.event; 38 direction = ((event.wheelDelta) ? event.wheelDelta/120 : event.detail/-3) || false; 39 }; 40 41 $(document).scroll(function () { 42 if($('.gomakoil_call_block').length>0){ 43 scrollCallforpriceForm($('.gomakoil_call_block'), 0); 44 } 45 }); 46 47 if ($(window).width() <= 430) { 48 $(document).on("click focus", "#mpm_callforprice_form_captcha", function() { 49 $("#mpm_callforprice_form_captcha").css("border", "none"); 50 }); 51 } 52 53 $(document).on("focus", ".form-control", function() { 54 onFocusInputField($(this).attr("name")); 55 }); 56 57 $(document).on("blur", ".form-control", function(e) { 58 onBlurInputField(e, $(this).attr("name")); 59 }); 60 61 $(document).keydown(function(e) { 62 var key = e.keyCode; 63 64 if (key === 13 && e.target.localName !== "textarea") { 65 $("#button_large_call").trigger("click"); 66 } else if (key === 27) { 67 $(".close_block").trigger("click"); 68 } 69 }); 70 71 getConsentForProcessingData(); 72 $(document).on("click change", "#gomakoilFreeCall #consent_checkbox", function() { 73 getConsentForProcessingData(); 74 }); 75}); 76 77function checkIfRecaptchaIsVerified() { 78 getConsentForProcessingData(); 79} 80 81function scrollCallforpriceForm(el, show) { 82 83 var top = $(document).scrollTop(); 84 var height_window = $(window).outerHeight(); 85 var height_form = el.outerHeight(); 86 var margin = (height_window - height_form)/2; 87 var form_offset = el.offset().top; 88 89 if(show && margin < 11){ 90 margin = 11; 91 } 92 93 if(margin > 10){ 94 var margin_top = margin+top; 95 el.css('top', margin_top+'px'); 96 } 97 else { 98 if (direction >= 0) { 99 100 if( top < form_offset ){ 101 el.css({top: (top + 10)}); 102 } 103 } 104 if (direction < 0) { 105 if (top > (height_form + 10 - height_window)) { 106 el.css({top: (top - (height_form - height_window + 10))}); 107 } 108 } 109 } 110} 111 112function sendEmail(id_product, id_lang, id_shop, base_dir){ 113 if ($("#gomakoilFreeCall #consent_checkbox").length && !$("#gomakoilFreeCall #consent_checkbox").is(":checked")) { 114 return false; 115 } 116 117 $.ajax({ 118 type: "POST", 119 url: base_dir+'index.php?rand=' + new Date().getTime(), 120 dataType: 'json', 121 async: true, 122 cache: false, 123 data: { 124 ajax : true, 125 token: "", 126 controller: 'AjaxForm', 127 fc: 'module', 128 module : 'callforprice', 129 action: 'sendEmail', 130 id_shop: id_shop, 131 id_lang: id_lang, 132 id_product: id_product, 133 fio: $('#gomakoilFreeCall input[name="fio"]').val(), 134 email: $('#gomakoilFreeCall input[name="email"]').val(), 135 tel_number: $('#gomakoilFreeCall input[name="tel_number"]').val(), 136 message: $('#gomakoilFreeCall textarea[name="message"]').val(), 137 captcha_value: $('#gomakoilFreeCall input[name="captcha_res"]').val(), 138 delay: $('#gomakoilFreeCall select[name="delay_request"]').val(), 139 }, 140 beforeSend: function(){ 141 $(".progres_bar_call_for_price").show(); 142 }, 143 complete: function(){ 144 $(".progres_bar_call_for_price").hide(); 145 }, 146 success: function(json) { 147 if(json['success']){ 148 $('.gomakoil_call_block').remove(); 149 fancyboxMessage(json['success'], true); 150 } else if (json['error']) { 151 $('.gomakoil_call_block').remove(); 152 fancyboxMessage(json["error"], false); 153 } else if (json["error_field"]) { 154 var form_input_names = ["fio", "email", "tel_number", "delay_request", "message", "captcha_res"]; 155 var error_field = json["error_field"]; 156 var error_message = json["error_message"]; 157 var input_type = error_field === "message" ? "textarea" : "
157input"; 158 159 if (form_input_names.indexOf(error_field) !== -1) { 160 handleFormValidationError(error_field, error_message, input_type) 161 } 162 } 163 }, 164 error: function() { 165 $(".gomakoil_call_block").remove(); 166 fancyboxMessage("Message is not send. Unexpected error.", false); 167 } 168 }); 169} 170 171 172function fancyboxMessage(msg, is_success) { 173 174 var top_sign = "<i class='m-cancel'></i>"; 175 176 if (is_success) { 177 top_sign = "<i class='m-checked'></i>"; 178 } 179 180 var itemTemplate = "<div class='inform_call_block'>"; 181 itemTemplate += "<div class='header_call_back_info'>"; 182 itemTemplate += "<div id='header_call_back_background'></div>"; 183 itemTemplate += "<div class='close_block'><i class='m-cancel'></i></div>"; 184 itemTemplate += "<span id='inform_callback_msg_sign'>"+top_sign+"</span>"; 185 itemTemplate += "</div>"; 186 itemTemplate += "<div class='content_info'>"; 187 itemTemplate += "<span>" + msg + "</span>"; 188 itemTemplate += "</div>"; 189 itemTemplate += "</div>"; 190 191 var top = 100; 192 if($('.gomakoilFreeCallContent').hasClass('mobile_version')){ 193 top = 10; 194 } 195 $(".gomakoilFreeCallContent").prepend(itemTemplate); 196 $(".inform_call_block").css("top", ($(window).scrollTop()+top)+ "px" ); 197 198} 199 200 201 202function showCallForPriceForm(id_product, id_lang, id_shop, base_dir){ 203 $.ajax({ 204 type: "POST", 205 url: base_dir+'index.php?rand=' + new Date().getTime(), 206 dataType: 'json', 207 async: true, 208 cache: false, 209 data: { 210 ajax : true, 211 token: "", 212 controller: 'AjaxForm', 213 fc: 'module', 214 module : 'callforprice', 215 action: 'showForm', 216 id_shop: id_shop, 217 id_lang: id_lang, 218 id_product: id_product, 219 }, 220 success: function(json) { 221 222 if(json['form']){ 223 224 $(".modal.quickview").remove(); 225 $(".modal-backdrop").remove(); 226 227 $("body").removeClass('modal-open'); 228 $("body").prepend(json['form']); 229 230 $('.gomakoil_overlay').fadeIn(); 231 $('.gomakoil_call_block').css("opacity", "1"); 232 233 var consent_checkbox_container = "#gomakoilFreeCall #consent_checkbox_container"; 234 235 if ($(consent_checkbox_container).length) { 236 $(consent_checkbox_container).css("visibility", "visible").fadeIn(); 237 238 $(window).load(function () { 239 if (jQuery().uniform) { 240 $.uniform.restore(); 241 } 242 }); 243 244 $(window).resize(function () { 245 if (jQuery().uniform) { 246 $.uniform.restore(); 247 } 248 }); 249 } 250 251 scrollCallforpriceForm($('.gomakoil_call_block'), 1); 252 } 253 } 254 }); 255} 256 257function getConsentForProcessingData() { 258 var consent_checkbox = "#gomakoilFreeCall #consent_checkbox"; 259 var recaptcha_block = "#gomakoilFreeCall .g-recaptcha"; 260 var submit_button = "#button_large_call"; 261 var validated = true; 262 263 if ($(consent_checkbox).length && !$(recaptcha_block).length) { 264 validated = $(consent_checkbox).is(":checked") ? true : false; 265 } else if ($(recaptcha_block).length && !$(consent_checkbox).length) { 266 var recaptcha_response = grecaptcha.getResponse(); 267 validated = recaptcha_response != 0 ? true : false; 268 } else if ($(recaptcha_block).length && $(consent_checkbox).length) { 269 var consent_is_given = $(consent_checkbox).is(":checked"); 270 var not_robot = grecaptcha.getResponse() != 0; 271 validated = consent_is_given && not_robot; 272 } 273 274 if (validated) { 275 $(submit_button).attr("disabled", false); 276 $(submit_button).removeClass("disabled-submit-btn"); 277 } else { 278 $(submit_button).attr("disabled", true); 279 $(submit_button).addClass("disabled-submit-btn"); 280 } 281} 282 283function handleFormValidationError(error_field_name, error_message) { 284 $("#gomakoilFreeCall .form-group").removeClass("mpm-callforprice-focused-input"); 285 $("#gomakoilFreeCall .form-group").removeClass("mpm-callforprice-validation-error"); 286 287 $("#gomakoilFreeCall ."+error_field_name+"-form-group input, #gomakoilFreeCall ."+error_field_name+"-form-group textarea").focus(); 288 $("#gomakoilFreeCall .form-group").removeClass("mpm-callforprice-focused-input"); 289 $("#gomakoilFreeCall ."+error_field_name+"-form-group").addClass("mpm-callforprice-validation-error"); 290 $("#gomakoilFreeCall ."+error_field_name+"-form-group .mpm-callforprice-form-validation-message").text(error_message); 291 292 return true; 293} 294 295 296function onFocusInputField(input_field_name) { 297 $("#gomakoilFreeCall .form-group").removeClass("mpm-callforprice-focused-input"); 298 299 if ($("#gomakoilFreeCall ."+input_field_name+"-form-group").hasClass("mpm-callforprice-validation-error") === false) { 300 $("#gomakoilFreeCall ."+input_field_name+"-form-group").addClass("mpm-callforprice-focused-input"); 301 $("#gomakoilFreeCall ."+input_field_name+"-form-group").removeClass("mpm-callforprice-validation-error"); 302 } 303 304 return true; 305} 306 307function onBlurInputField(event, input_field_name) { 308 if (event.relatedTarget && event.relatedTarget.id == "button_large_call") { 309 $("#button_large_call").trigger("click"); 310 } 311 312 $("#gomakoilFreeCall ."+input_field_name+"-form-group").removeClass("mpm-callforprice-focused-input"); 313 $("#gomakoilFreeCall ."+input_field_name+"-form-group").removeClass("mpm-callforprice-validation-error"); 314 315 return true; 316}
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.