PageSourceSearch

https://www.medigarden.it/js/cookie_law.js

js medigarden.it collected 2026-10-01 07:51:42 UTC 14,753 bytes, 412 lines download raw bytes

1(function($) {
2    function cwsetCookie(c_name, value, exdays) {
3        var exdate = new Date();
4        exdate.setDate(exdate.getDate() + exdays);
5        var c_value =
6            escape(value) +
7            (exdays == null ? "" : "; expires=" + exdate.toUTCString());
8
9        var cookie = c_name + "=" + c_value + "; path=/; SameSite=Lax";
10        try {
11            if (window.location && window.location.protocol === "https:") {
12                cookie += "; Secure";
13            }
14        } catch (e) {}
15
16        document.cookie = cookie;
17    }
18
19    function cwdeleteCookieAtPath(c_name, path) {
20        var p = typeof path === "string" && path ? path : "/";
21        var cookie =
22            c_name +
23            "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=" +
24            p +
25            "; SameSite=Lax";
26        try {
27            if (window.location && window.location.protocol === "https:") {
28                cookie += "; Secure";
29            }
30        } catch (e) {}
31        document.cookie = cookie;
32    }
33
34    function cwdeleteCookieEverywhere(c_name) {
35        // Best-effort cleanup for legacy cookies created without path=/.
36        // Some browsers may ignore non-prefix paths; that's fine.
37        var paths = ["/", "/it", "/it/", "/en", "/en/"];
38        for (var i = 0; i < paths.length; i++) {
39            try {
40                cwdeleteCookieAtPath(c_name, paths[i]);
41            } catch (e) {}
42        }
43    }
44
45    function cwgetCookie(c_name) {
46        var i,
47            x,
48            y,
49            ARRcookies = document.cookie.split(";");
50        for (i = 0; i < ARRcookies.length; i++) {
51            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
52            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
53            x = x.replace(/^\s+|\s+$/g, "");
54            if (x == c_name) {
55                return unescape(y);
56            }
57        }
58    }
59    $.fn.cwAllowCookies = function (options) {
60        var dateObject = new Date();
61        var timeOffset = -dateObject.getTimezoneOffset() / 60;
62        var region = "TheWorld";
63        switch (timeOffset) {
64            case -1:
65            case -0:
66            case 0:
67            case 1:
68            case 2:
69            case 3:
70            case 3.5:
71            case 4:
72            case 4.5:
73                region = "Europe";
74                break;
75            case 9:
76                region = "Japan";
77        }
78
79        // Do not show the cookie banner on policy pages.
80        // The Cookie Policy and Privacy Policy must always be readable.
81        try {
82            var pth =
83                window.location && window.location.pathname
84                    ? String(window.location.pathname)
85                    : "";
86            if (
87                /(?:^|\/)(?:it|en)\/(?:cookie-policy|privacy)\.html$/.test(pth)
88            ) {
89                try {
90                    jQuery("body").removeClass("cw-cookie-open");
91                } catch (e0) {}
92                try {
93                    jQuery(".cwcookielaw, .cwcookielawbg").remove();
94                } catch (e1) {}
95                return false;
96            }
97        } catch (e2) {}
98
99        $(document).on("click", ".cwallowcookies", function (e) {
100            try {
101                if (e && typeof e.preventDefault === "function") {
102                    e.preventDefault();
103                }
104            } catch (e2) {}
105            cwsetCookie("cwallowcookies", true, 365);
106
107            try {
108                jQuery("body").removeClass("cw-cookie-open");
109            } catch (e) {}
110
111            try {
112                var evt;
113                if (typeof Event === "function") {
114                    evt = new Event("cwallowcookiesaccepted");
115                } else {
116                    evt = document.createEvent("Event");
117                    evt.initEvent("cwallowcookiesaccepted", true, true);
118                }
119                document.dispatchEvent(evt);
120            } catch (e) {}
121
122            $(".cwcookielaw").slideUp("slow", function () {
123                $(this).remove();
124            });
125            $(".cwcookielawbg").slideUp("slow", function () {
126                $(this).remove();
127                $(".cwcookielaw").remove();
128            });
129
130            return false;
131        });
132
133        $(document).on("click", ".cwdeclinecookies", function (e) {
134            try {
135                if (e && typeof e.preventDefault === "function") {
136                    e.preventDefault();
137                }
138            } catch (e2) {}
139
140            // Store an explicit choice (declined). GA stays off.
141            cwsetCookie("cwallowcookies", "0", 365);
142
143            try {
144                jQuery("body").removeClass("cw-cookie-open");
145            } catch (e3) {}
146
147            try {
148                var evt;
149                if (typeof Event === "function") {
150                    evt = new Event("cwallowcookiesdeclined");
151                } else {
152                    evt = document.createEvent("Event");
153                    evt.initEvent("cwallowcookiesdeclined", true, true);
154                }
155                document.dispatchEvent(evt);
156            } catch (e4) {}
157
158            $(".cwcookielaw").slideUp("slow", function () {
159                $(this).remove();
160            });
161            $(".cwcookielawbg").slideUp("slow", function () {
162                $(this).remove();
163                $(".cwcookielaw").remove();
164            });
165
166            return false;
167        });
168        $(document).on("click", ".cwcookiesmoreinfo", function () {
169            // Allow normal navigation to the Cookie Policy page.
170            // Ensure the banner doesn't stay in front (e.g. lightbox overlay).
171            try {
172                jQuery("body").removeClass("cw-cookie-open");
173            } catch (e0) {}
174            try {
175                jQuery(".cwcookielaw, .cwcookielawbg").remove();
176            } catch (e1) {}
177        });
178        $(document).on("click", ".cwcookiebubble", function () {
179            $(".cwcookiebubble").fadeOut("slow");
180        });
181        var forceReset = false;
182        try {
183            forceReset =
184                window.location &&
185                typeof window.location.search === "string" &&
186                /(?:\?|&)mgCookieReset=1(?:&|$)/.test(window.location.search);
187        } catch (e) {}
188
189        if (forceReset) {
190            cwdeleteCookieEverywhere("cwallowcookies");
191        }
192
193        var cwallowcookiesRaw = cwgetCookie("cwallowcookies");
194        var cwallowcookies = false;
195        var cwchoiceMade = false;
196        if (
197            cwallowcookiesRaw !== null &&
198            typeof cwallowcookiesRaw !== "undefined"
199        ) {
200            cwchoiceMade = String(cwallowcookiesRaw) !== "";
201            try {
202                var v = String(cwallowcookiesRaw).toLowerCase();
203                cwallowcookies =
204                    v === "true" ||
205                    v === "1" ||
206                    v === "yes" ||
207                    v === "y" ||
208                    v === "ok";
209            } catch (e) {
210                cwallowcookies = false;
211            }
212        }
213
214        // Normalize legacy path-scoped consent cookies to site-wide consent.
215        if (cwallowcookies) {
216            cwsetCookie("cwallowcookies", true, 365);
217        }
218
219        var isEnglish = false;
220        try {
221            isEnglish =
222                window.location &&
223                window.location.pathname &&
224                window.location.pathname.indexOf("/en/") === 0;
225        } catch (e) {}
226
227        var defaultMoreInfoUrl = "/it/cookie-policy.html";
228        try {
229            if (
230                window.location &&
231                window.location.pathname &&
232                window.location.pathname.indexOf("/en/") === 0
233            ) {
234                defaultMoreInfoUrl = "/en/cookie-policy.html";
235            }
236        } catch (e) {}
237
238        var defaults = {
239            cwmessage: isEnglish
240                ? "This website uses technical cookies and, with your consent, analytics cookies (Google Analytics). Click ‘Accept’ to allow analytics cookies. "
241                : "Questo sito utilizza cookie tecnici e, previo consenso, cookie di analisi (Google Analytics). Cliccando ‘Accetto’ acconsenti all’uso dei cookie di analisi. ",
242            cwbubblemessage:
243                "On 26th May 2012, new laws came into force in the EU that affect most web sites. If cookies are used in a site, the Privacy and Electronic Communications (EC Directive) (Amendment) Regulations 2011 (UK Regulations) asks that the website user must give consent to the use and placing of the cookies.",
244            cwbubbletitle: "Cookie Laws within the EU",
245            cwhref: "",
246            cwreadmore: "Read More",
247            cwagree: isEnglish ? "Accept" : "Accetto",
248            cwdecline: isEnglish
249                ? "Continue without accepting"
250                : "Continua senza accettare",
251            cwmoreinfo: isEnglish ? "More info" : "Maggiori info",
252            fixed: true,
253            animate: true,
254            europeonly: false,
255            cwmoreinfourl: defaultMoreInfoUrl,
256        };
257        var options = $.extend(defaults, options);
258        if (options.europeonly == true) {
259            if (region !== "Europe") {
260                return false;
261            }
262        }
263        if (options.cwhref !== "") {
264            options.cwbubblemessage =
265                options.cwbubblemessage +
266                ' <a href="' +
267                options.cwhref +
268                '">' +
269                options.cwreadmore +
270                "</a>";
271        }
272        var html =
273            '<div class="cwcookielaw"><style>' +
274            ".cwcookielaw	{" +
275            "	background:rgba(0, 0, 0, 0.8);" +
276            "	height: auto; " +
277            "	font-family: Calibri, Tahoma, Geneva, sans-serif;" +
278            "	font-size: 12px; " +
279            "	font-weight: bold; " +
280            "	z-index: 9999; " +
281            "	width: 100%; " +
282            "	position: absolute; " +
283            "	display: none; " +
284            "	bottom: 0px; " +
285            "	padding-bottom: 10px; " +
286            "	border-top: 1px solid #a29c88; " +
287            "	line-height: 14px; ";
288        if (options.fixed) {
289            html = html + "	position: fixed; ";
290        }
291        html =
292            html +
293            "} " +
294            ".cwcookielaw p { " +
295            "	padding: 17px 0 0 0; " +
296            "	margin: 0; " +
297            "	float: left; " +
298            "	color: #fff; " +
299            "	line-height: 14px; " +
300            "	font-size: 14px; " +
301            "	font-weight: normal; " +
302            "} " +
303            ".cwcookielaw .cwallowcookies { " +
304            "	float: right; " +
305            "	margin-right: 30px; " +
306            "	margin-top: 10px; " +
307            "	padding: 5px; " +
308            "	color: #fff; " +
309            "	font-size: 14px; " +
310            "	font-weight: normal; " +
311            "	border: 1px solid #fff; " +
312            "	text-decoration: none; " +
313            "} " +
314            ".cwcookielaw .cwcookiesmoreinfo { " +
315            "	float: right; " +
316            "	margin-top: 10px; " +
317            "	padding: 5px; " +
318            "	color: #fff; " +
319            "	font-size: 14px; " +
320            "	font-weight: normal; " +
321            "	border: 1px solid #fff; " +
322            "	text-decoration: none; " +
323            "} " +
324            ".cwcookielaw .cwallowcookies:hover, .cwcookielaw .cwcookiesmoreinfo:hover { text-decoration: none; color: #fff; border: 1px solid #fff; } " +
325            "@media only screen and (max-width: 900px) {.cwcookielaw .cwcookiecontainer { width: 100% !important;}}" +
326            ".cwcookielaw .cwcookiecontainer { width: 70%; margin: auto; position: relative;} " +
327            ".cwcookielawbg {  display:none; } " +
328            ".cwcookielaw .cwcookiebubble { " +
329            "	background-repeat: no-repeat; " +
330            "	position: absolute; " +
331            "	width: 291px; " +
332            "	height: 132px; " +
333            "	right: -5px; " +
334            "	top: 40px; " +
335            "	padding: 31px 24px 0 24px; " +
336            "	display: none; " +
337            "	cursor: pointer; " +
338            "} " +
339            ".cwcookiebubble .cwcookietitle { " +
340            "	font-family: Calibri, Tahoma, Geneva, sans-serif; " +
341            "	font-size: 14px; " +
342            "	font-weight: bold; " +
343            "	margin-bottom: 10px; " +
344            "	color: #6e6205; " +
345            "} " +
346            ".cwcookiebubble p { margin: 0; padding: 0; color: #fff; line-height: 14px;} " +
347            ".cwcookiebubble a { text-decoration: underline; color: #fff; } " +
348            "</style> " +
349            '<div class="cwcookiecontainer">' +
350            "<p>" +
351            options.cwmessage +
352            "</p>" +
353            '<a class="cwcookiesmoreinfo" href=\'' +
354            options.cwmoreinfourl +
355            "' title='Cookie Policy' \">" +
356            options.cwmoreinfo +
357            "</a>" +
358            '<a class="cwallowcookies" href="#">' +
359            options.cwagree +
360            "</a>" +
361            '<!--<div class="cwcookiebubble"><p class="cwcookietitle">' +
362            options.cwbubbletitle +
363            "</p><p>" +
364            options.cwbubblemessage +
365            "</p></div>-->" +
366            "</div>" +
367            "</div><!-- cwcookielaw -->" +
368            '<div class="cwcookielawbg"></div>';
369        if (!cwchoiceMade) {
370            try {
371                jQuery("body").addClass("cw-cookie-open");
372            } catch (e) {}
373            $(this).prepend(html);
374
375            try {
376                var $law = $(".cwcookielaw");
377
378                try {
379                    if ($law && $law.length) {
380                        $law.find(".cwcookiesmoreinfo").removeClass(
381                            "html5lightbox",
382                        );
383                    }
384                } catch (e0) {}
385
386                if (
387                    $law.length &&
388                    $law.find(".cwdeclinecookies").length === 0 &&
389                    $law.find(".cwallowcookies").length
390                ) {
391                    $law.find(".cwallowcookies").before(
392                        '<a class="cwdeclinecookies" href="#">' +
393                            options.cwdecline +
394                            "</a>",
395                    );
396                }
397            } catch (e2) {}
398
399            if (options.animate) {
400                $(".cwcookielaw").slideDown("slow");
401                $(".cwcookielawbg").slideDown("slow");
402            } else {
403                $(".cwcookielaw").show();
404                $(".cwcookielawbg").show();
405            }
406        } else {
407            try {
408                jQuery("body").removeClass("cw-cookie-open");
409            } catch (e) {}
410        }
411    };
412})(jQuery);

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.