1var logged_in = 0; 2var newsletter; 3var recapcha_needed; 4function subscribe_to_product(sku,email,address,name,type,price,_newsletter,_recaptcha_needed,currency) { 5 6 if (email !== "") { 7 logged_in = 1; 8 } 9 10 newsletter = _newsletter; 11 recapcha_needed = _recaptcha_needed; 12 13 if (popup_open && unas_design_ver < 5) { 14 $.shop_popup("close"); 15 } 16 17 setTimeout(function () { 18 if (newsletter != 1) { 19 check_valid_email(email).then(function (response) { 20 return response.json(); 21 }).then(function (response) { 22 logged_in_dont_have_email = response["error"] ? 1 : 0; 23 24 product_subscribe_params['sku'] = sku; 25 product_subscribe_params['email'] = email; 26 product_subscribe_params['type'] = type; 27 product_subscribe_params['price'] = price; 28 product_subscribe_params['currency'] = currency; 29 30 if (logged_in_dont_have_email) { 31 subscribe_to_product_overlay("", 0, 0, type, { 32 recaptcha_callback_name: "subscribe_to_product_no_login_email", 33 recaptcha_callback_parameters: {} 34 }); 35 36 return; 37 } 38 39 handle_product_subscribe(sku, email, type, price, currency); 40 }); 41 42 return; 43 } 44 45 $.ajax({ 46 url: shop_url_main + "/shop_ajax/ajax_product_subscribe.php", 47 type: "POST", 48 dataType: "json", 49 data: { 50 get_ajax: 1, 51 email: email, 52 type: type, 53 action: "check_newsletter_subscription", 54 cikk: sku, 55 change_lang: actual_lang 56 }, 57 success: function (response) { 58 switch (response.code) { 59 case 0: 60 check_valid_email(email).then(function (_response) { 61 return _response.json(); 62 }).then(function (_response) { 63 64 if (_response["error"]) { 65 logged_in_dont_have_email = 1 66 67 product_subscribe_params['sku'] = sku; 68 product_subscribe_params['email'] = email; 69 product_subscribe_params['type'] = type; 70 product_subscribe_params['price'] = price; 71 product_subscribe_params['currency'] = currency; 72 73 subscribe_to_product_overlay("", 0, 0, type, { 74 recaptcha_callback_name: "subscribe_to_product_no_login_email", 75 recaptcha_callback_parameters: {} 76 }); 77 78 return; 79 } 80 81 handle_product_subscribe(sku, email, type, price, currency); 82 }); 83 84 break; 85 case 1: 86 subscribe_to_product_overlay(response, 1, 1, type, { 87 recaptcha_callback_name: "handle_newsletter_subscribe", 88 recaptcha_callback_parameters: { 89 sku: sku, 90 address: address, 91 email_from_js: 1, 92 email: '$("#overlay_product_subscription_subscribe #subscribe_email").val()', 93 type: type, 94 name: '$("#overlay_product_subscription_subscribe #subscribe_name").val()', 95 price: price, 96 currency: currency 97 } 98 }); 99 100 if (!_recaptcha_needed) { 101 $("#overlay_product_subscription").on('click', '#overlay_product_subscription_agree button', function (e) { 102 var name = $("#overlay_product_subscription_subscribe input[name='name']").val(); 103 var nologin_email = $("#overlay_product_subscription_subscribe input[name='email']").val(); 104 handle_newsletter_subscribe(sku, address, nologin_email, type, name, price, currency); 105 }); 106 } 107 break; 108 case 2: 109 let _subscribe = 0; 110 111 check_valid_email(email).then(function (_response) { 112 return _response.json(); 113 }).then(function (_response) {
114 //Nem valid email, pl felhasználó név alapú azonosÃtás okán 115 _subscribe = _response["error"] ? 1 : 0; 116 117 if (_recaptcha_needed && _subscribe) { 118 email = '$("#overlay_product_subscription_subscribe #subscribe_email").val()'; 119 name = '$("#overlay_product_subscription_subscribe #subscribe_name").val()'; 120 } 121 122 subscribe_to_product_overlay(response, _subscribe, 1, type, { 123 recaptcha_callback_name: "handle_newsletter_subscribe", 124 recaptcha_callback_parameters: { 125 sku: sku, 126 address: address, 127 email: email, 128 type: type, 129 name: name, 130 price: price, 131 currency: currency 132 } 133 }); 134 135 if (!_recaptcha_needed) { 136 $("#overlay_product_subscription").on('click', '#overlay_product_subscription_agree button', function () { 137 //Nem valid email, pl felhasználó név alapú azonosÃtás okán 138 //Ekkor kikényszerÃtjük az email bekérÅ formot és abból kérük be az email cÃmet 139 if (_subscribe) { 140 email = $("#overlay_product_subscription_subscribe #subscribe_email").val(); 141 name = $("#overlay_product_subscription_subscribe #subscribe_name").val(); 142 } 143 144 handle_newsletter_subscribe(sku, address, email, type, name, price, currency); 145 }); 146 } 147 }); 148 149 break; 150 } 151 } 152 }); 153 }, 300); 154} 155function handle_newsletter_subscribe (sku,address,email,type,name,price,currency) { 156 157 const overlay = $("#overlay_product_subscription"); 158 159 if (typeof address === "undefined" || address === "") { 160 if ($("#overlay_product_subscription_subscribe").is(":visible") && $("#overlay_product_subscription_subscribe input[name='address']").length>0) { 161 address=$("#overlay_product_subscription_subscribe input[name='address']").val(); 162 } 163 if ($("#overlay_product_subscription_agree").is(":visible") && $("#overlay_product_subscription_agree input[name='address']").length>0) { 164 address=$("#overlay_product_subscription_agree input[name='address']").val(); 165 } 166 } 167 168 let ajax_data = { 169 get_ajax:1, 170 action:"subscribe", 171 name:name, 172 email: email, 173 addr: address, 174 change_lang: actual_lang, 175 product_subscribe: 1, 176 privacy_policy: $("#product_subscribe_privacy_policy").prop("checked") 177 }; 178 179 if (recapcha_needed) { 180 ajax_data["recaptcha_response"] = grecaptcha.getResponse(recaptcha_id_product_subscribe); 181 } 182 183 $.ajax({ 184 type:"GET", 185 url: shop_url_main + "/shop_ajax/ajax_newsletter.php", 186 dataType:"json", 187 data: ajax_data, 188 success: function (result) { 189 if (result.status==="ok" || result.error_code==="newsletter_error_up_old") { 190 $(".subscribe_validation_error",overlay).css("display","none"); 191 overlay.overlay().close(); 192 193 if (email!="") logged_in = 1; 194 setTimeout(function () { handle_product_subscribe(sku,email,type,price,currency); },500); 195 overlay.off('click', '#overlay_product_subscription_agree button'); 196 } else { 197 $(".subscribe_validation_error",overlay).html(result.error_text).css("display","block"); 198 } 199 } 200 }); 201} 202var product_subscribe_params = []; 203function handle_product_subscribe (sku,email,type,price,currency) { 204 205 if (logged_in != 1) { 206 product_subscribe_params['sku'] = sku; 207 product_subscribe_params['type'] = type; 208 product_subscribe_params['price'] = price; 209 product_subscribe_params['currency'] = currency; 210 211 subscribe_to_product_overlay("", 0, 0, type, { 212 recaptcha_callback_name: "subscribe_to_product_no_login_email", 213 recaptcha_callback_parameters: {} 214 }); 215 return; 216 } 217 218 $.ajax({ 219 type: "POST", 220 url: shop_url_main + "/shop_ajax/ajax_product_subscribe.php", 221 dataType:"json", 222 data: { 223 get_ajax: 1, 224 cikk: sku, 225 email: email, 226 type: type, 227 price: price, 228 currency: currency, 229 change_lang: actual_lang, 230 action: "subscribe_to_product" 231 }, 232 success: function (response) { 233 $("#recaptcha_placeholder_product_subscribe").hide(); 234 subscribe_to_product_overlay(response,0,0, type); 235 } 236 }); 237} 238var subscribe_to_product_response; 239var subscribe_to_product_subscribe; 240var subscribe_to_product_agree; 241var subscribe_to_product_type; 242var subscribe_to_product_captcha_required; 243var subscribe_to_product_params; 244var logged_in_dont_have_email = 0; 245function subscribe_to_product_overlay(response,subscribe,agree,type,params = {}) { 246 params['overlay_type'] = 'info'; 247 248 subscribe_to_product_response=response; 249 subscribe_to_product_subscribe=subscribe; 250 subscribe_to_product_agree=agree; 251 subscribe_to_product_type=type; 252 subscribe_to_product_params=params; 253 254 overlay_ajax("product_subscription", subscribe_to_product_params); 255 256 $(document).off("overlayAjaxLoaded").on("overlayAjaxLoaded",function(event, params) { 257 if (params['id'] == "product_subscription" && (logged_in == 1 || newsletter == 1) && logged_in_dont_have_email == 0) { 258 $("#overlay_product_subscription .overlay_title").html(subscribe_to_product_response.message); 259 $("#overlay_product_subscription .overlay_text").html(subscribe_to_product_response.message_sub); 260 261 if (subscribe_to_product_response.message_sub!=="" && typeof subscribe_to_product_response.message_sub !=="undefined") { 262 $("#overlay_product_subscription .overlay_text").css("display","block"); 263 } else { 264 $("#overlay_product_subscription .overlay_text").css("display","none"); 265 } 266 267 if (subscribe_to_product_subscribe==1) { 268 $("#overlay_product_subscription #overlay_product_subscription_subscribe").css("display", "block"); 269 $("#overlay_product_subscription_subscribe input[name='email']").val("").focusout(); 270 $("#overlay_product_subscription_subscribe input[name='address']").val("").focusout(); 271 $("#overlay_product_subscription_subscribe input[name='name']").val("").focusout(); 272 } else { 273 $("#overlay_product_subscription #overlay_product_subscription_subscribe").css("display", "none"); 274 } 275 276 $("#overlay_product_subscription .overlay_subscribe_button").html(subscribe_to_product_response.button_text); 277 $("#overlay_product_subscription .subscribe_validation_error").html(subscribe_to_product_response.error_message); 278 279 if (subscribe_to_product_agree==1) { 280 $("#overlay_product_subscription #overlay_product_subscription_agree").css("display", "block"); 281 } else { 282 $("#overlay_product_subscription #overlay_product_subscription_agree").css("display", "none"); 283 } 284 285 if(typeof input_checkbox_alter !== 'undefined' && $.isFunction(input_checkbox_alter)) input_checkbox_alter(); 286 287 $("#product_subscribe_privacy_policy").prop("checked",false); 288 if (unas_design_ver < 5) $("#overlay_product_subscription").overlay().load(); 289 290 logged_in = 0; 291 } else { 292 if (params['id']=="product_subscription") { 293 $("#overlay_product_subscription .overlay_title").text($("#overlay_product_subscription .overlay_title_hidden_" + subscribe_to_product_type).val()); 294 295 $("#overlay_product_subscribe_no_login").show(); 296 $(".overlay_row").show(); 297 $(".overlay_privacy_policy").show(); 298 $(".overlay_subscribe_button").show(); 299 $("#product_subscribe_no_login_privacy_policy").prop("checked",false); 300 $(".overlay_text").show(); 301 $("#overlay_product_subscribe_no_login input[name='email']").val("").focusout(); 302 $("#overlay_product_subscribe_no_login input[name='address']").val("").focusout(); 303 $("#overlay_product_subscribe_no_login input[name='name']").val("").focusout(); 304 if (newsletter !== 1){ 305 $("#overlay_product_subscribe_no_login input[name='address']").closest('.overlay_row').hide(); 306 $("#overlay_product_subscribe_no_login input[name='name']").closest('.overlay_row').hide(); 307 } 308 309 if (unas_design_ver < 5) $("#overlay_product_subscription").overlay().load(); 310 311 if(typeof input_checkbox_alter !== 'undefined' && $.isFunction(input_checkbox_alter)) input_checkbox_alter(); 312 313 if (!recapcha_needed) { 314 $("#overlay_product_subscribe_no_login .overlay_subscribe_button").off('click').on("click", function () { 315 subscribe_to_product_no_login_email(); 316 }); 317 } 318 } 319 } 320 }); 321} 322function subscribe_to_product_no_login_email() { 323 var email = $("#overlay_product_subscribe_no_login input[name='email']").val(); 324 325 $(".subscribe_validation_error #privacy").hide(); 326 $(".subscribe_validation_error #email").hide(); 327 $(".subscribe_validation_error #not_valid_email").hide(); 328 329 if (email == "") { 330 $(".subscribe_validation_error").show(); 331 $("#email").show(); 332 setTimeout(function () { 333 $(".subscribe_validation_error #email").hide(); 334 $(".subscribe_validation_error").hide(); 335 }, 3000); 336 337 return; 338 } 339 340 var email_valid = false;
341 342 $.ajax({ 343 type:"GET", 344 url:shop_url_main+"/shop_ajax/ajax_validate.php", 345 dataType:"json", 346 data: { 347 get_ajax:1, 348 change_lang: actual_lang, 349 action:"email", 350 email_to_check: email 351 }, 352 success: function (result) { 353 if (result.success) email_valid=true; 354 355 if (!email_valid) { 356 $(".subscribe_validation_error").show(); 357 $(".subscribe_validation_error #not_valid_email").show(); 358 359 setTimeout(function () { 360 $(".subscribe_validation_error").hide(); 361 $(".subscribe_validation_error #not_valid_email").hide(); 362 }, 3000); 363 364 return; 365 } 366 367 if ($("#product_subscribe_no_login_privacy_policy:checked").length < 1) { 368 $(".subscribe_validation_error").show(); 369 $(".subscribe_validation_error #privacy").show(); 370 setTimeout(function () { 371 $(".subscribe_validation_error #privacy").hide(); 372 $(".subscribe_validation_error").hide(); 373 }, 3000); 374 375 return; 376 } 377 378 $(".overlay_row").hide(); 379 $(".overlay_privacy_policy").hide(); 380 $(".overlay_subscribe_button").hide(); 381 382 $("#overlay_product_subscription").overlay().close(); 383 $("#product_subscribe_no_login_privacy_policy").parent().removeClass("text_input_checkbox_checked").addClass("text_input_checkbox_unchecked").attr("rel_checked",0); 384 385 setTimeout(function () { 386 logged_in = 1; 387 logged_in_dont_have_email = 0; 388 handle_product_subscribe(product_subscribe_params['sku'],email,product_subscribe_params['type'],product_subscribe_params['price'],product_subscribe_params['currency']); 389 }, 750); 390 } 391 }); 392} 393 394async function check_valid_email (email) { 395 return await fetch(`${UNAS.shop.base_url}/shop_ajax/ajax_validate.php?get_ajax=1&change_lang=${actual_lang}&action=email&email_to_check=${email}`); 396}
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.