PageSourceSearch

https://sklepwaneko.pl/modules/czcouponpop/views/js/czcouponpop.js

js sklepwaneko.pl collected 2026-10-02 23:59:04 UTC 4,679 bytes, 164 lines download raw bytes

1/**
2 * Copyright since 2007 PrestaShop SA and Contributors
3 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
4 *
5 * NOTICE OF LICENSE
6 *
7 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
8 * that is bundled with this package in the file LICENSE.md.
9 * It is also available through the world-wide-web at this URL:
10 * https://opensource.org/licenses/AFL-3.0
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to [email protected] so we can send you a copy immediately.
14 *
15 * DISCLAIMER
16 *
17 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18 * versions in the future. If you wish to customize PrestaShop for your
19 * needs please refer to https://devdocs.prestashop.com/ for more information.
20 *
21 * @author    PrestaShop SA and Contributors <[email protected]>
22 * @copyright Since 2007 PrestaShop SA and Contributors
23 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
24 */
25
26$(function(){
27	if(!!('ontouchstart' in window)){		
28		$('html').bind('touchstart', function(){
29			showDialog();
30			$("html").unbind("touchstart");
31		});
32	} else{
33		$("html").bind("mouseleave", function () { 
34			showDialog();
35			$("html").unbind("mouseleave");
36		});
37	}
38});
39
40function createCookie(cookiename, cookievalue, exdays) {
41	const d = new Date();
42	d.setTime(d.getTime() + (exdays*60*60*1000));
43	let expires = "expires="+ d.toUTCString();
44	document.cookie = cookiename + "=" + cookievalue + ";" + expires + ";path=/";
45}
46
47function getCookie(cookiename) {
48	let name = cookiename + "=";
49	let decodedCookie = decodeURIComponent(document.cookie);
50	let ca = decodedCookie.split(';');
51	for(let i = 0; i <ca.length; i++) {
52	  let c = ca[i];
53	  while (c.charAt(0) == ' ') {
54		c = c.substring(1);
55	  }
56	  if (c.indexOf(name) == 0) {
57		return c.substring(name.length, c.length);
58	  }
59	}
60	return "";
61}
62
63function showDialog()
64{  
65	if (!getCookie("cookieCouponPopup")) {	
66		var data={'task':'showPopup'};
67		$.ajax({
68			type: "POST",
69			cache: false,
70			url: cz_coupon_url + '/front-end-ajax.php',
71			dataType : "json",
72			data: data,
73			complete: function(){},
74			success: function (response) {
75				//console.log(response);
76			}
77		});   
78		setTimeout(function(){
79			$("#overlay").show();
80			$(".newsletter-main").show();
81		}, 500);
82	}
83}
84
85function closeDialog(cookies_time)
86{  
87	var data={'task':'cancelRegisNewslette1', 'cookies_time':cookies_time};       
88	if ($('#notshow').is(':checked')){
89		data.notshow = '1';
90		createCookie('cookieCouponPopup','closed',cookies_time);
91    }else{
92        data.notshow = '0';
93    }
94
95	$.ajax({
96		type: "POST",
97		cache: false,
98		url: cz_coupon_url + '/front-end-ajax.php',
99		dataType : "json",
100		data: data,
101		complete: function(){},
102		success: function (response) {
103			//console.log(response);
104		}
105	});  
106
107	setTimeout(function(){
108		$("#overlay").hide();
109		$(".newsletter-main").hide();
110	}, 500);
111}
112function check_email(email){
113	emailRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/;	
114	if(emailRegExp.test(email)){
115		return true;
116	}else{
117		return false;
118	}
119}
120function regisNewsletter(){
121    var data={'task':'regisNewsletter', 'action':0};
122    var email = $("#newsletter_input_email").val();
123    if(check_email(email) == true){
124        data.email = email;
125        $("#regisNewsletterMessage").html("");
126    }else{
127        $("#regisNewsletterMessage").html('<p class="alert alert-danger">'+enterEmail+'</p>');
128        return false;
129    }
130    
131    if ($('#notshow').is(':checked')){
132		data.notshow = '1';
133		createCookie('cookieCouponPopup','closed',cookies_time);
134    }else{
135        data.notshow = '0';
136    }
137    $.ajax({
138		type: "POST",
139		cache: false,
140		url: cz_coupon_url + '/front-end-ajax.php',
141		dataType : "json",
142		data: data,
143        complete: function(){},
144		success: function (response)
145		{
146
147			if(response.indexOf("@")>0)
148			{
149				var new_response = response.substring(response.indexOf("@")+1, response.length);
150				$("#regisNewsletterMessage").html('<p class="alert alert-success">'+new_response+'</p>');
151			}
152			else {
153				$("#regisNewsletterMessage").html('<p class="alert alert-warning">'+response+'</p>');
154			}
155			$("#coupon-text-before").hide();
156			$("#coupon-text-after").show();
157			
158		},
159		 error: function(XMLHttpRequest, textStatus, errorThrown) { 
160            alert("Status: " + textStatus); 
161            alert("Error: " + errorThrown);
162        }  
163	});
164}

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.