PageSourceSearch

https://campingbergamini.it/assets/js/modal_popup.js?v=3102

js campingbergamini.it collected 2026-09-26 11:29:41 UTC 5,251 bytes, 144 lines download raw bytes

1(function($) {
2
3    "use strict";
4    /*
5
6    (function(factory) {
7        if (typeof define === 'function' && define.amd) {
8            // AMD (Register as an anonymous module)
9            define(['jquery'], factory);
10        } else if (typeof exports === 'object') {
11            // Node/CommonJS
12            module.exports = factory(require('jquery'));
13        } else {
14            // Browser globals
15            factory(jQuery);
16        }
17    }(function($) {
18
19        var pluses = /\+/g;
20
21        function encode(s) {
22            return config.raw ? s : encodeURIComponent(s);
23        }
24
25        function decode(s) {
26            return config.raw ? s : decodeURIComponent(s);
27        }
28
29        function stringifyCookieValue(value) {
30            return encode(config.json ? JSON.stringify(value) : String(value));
31        }
32
33        function parseCookieValue(s) {
34            if (s.indexOf('"') === 0) {
35                // This is a quoted cookie as according to RFC2068, unescape...
36                s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
37            }
38
39            try {
40                // Replace server-side written pluses with spaces.
41                // If we can't decode the cookie, ignore it, it's unusable.
42                // If we can't parse the cookie, ignore it, it's unusable.
43                s = decodeURIComponent(s.replace(pluses, ' '));
44                return config.json ? JSON.parse(s) : s;
45            } catch (e) {}
46        }
47
48        function read(s, converter) {
49            var value = config.raw ? s : parseCookieValue(s);
50            return $.isFunction(converter) ? converter(value) : value;
51        }
52
53        var config = $.cookie = function(key, value, options) {
54
55            // Write
56
57            if (arguments.length > 1 && !$.isFunction(value)) {
58                options = $.extend({}, config.defaults, options);
59
60                if (typeof options.expires === 'number') {
61                    var days = options.expires,
62                        t = options.expires = new Date();
63                    t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
64                }
65
66                return (document.cookie = [
67                    encode(key), '=', stringifyCookieValue(value),
68                    options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
69                    options.path ? '; path=' + options.path : '',
70                    options.domain ? '; domain=' + options.domain : '',
71                    options.secure ? '; secure' : ''
72                ].join(''));
73            }
74
75            // Read
76
77            var result = key ? undefined : {},
78                // To prevent the for loop in the first place assign an empty array
79                // in case there are no cookies at all. Also prevents odd result when
80                // calling $.cookie().
81                cookies = document.cookie ? document.cookie.split('; ') : [],
82                i = 0,
83                l = cookies.length;
84
85            for (; i < l; i++) {
86                var parts = cookies[i].split('='),
87                    name = decode(parts.shift()),
88                    cookie = parts.join('=');
89
90                if (key === name) {
91                    // If second argument (value) is a function it's a converter...
92                    result = read(cookie, value);
93                    break;
94                }
95
96                // Prevent storing a cookie that we couldn't decode.
97                if (!key && (cookie = read(cookie)) !== undefined) {
98                    result[name] = cookie;
99                }
100            }
101
102            return result;
103        };
104
105        config.defaults = {};
106
107        $.removeCookie = function(key, options) {
108            // Must not alter options, thus extending a fresh object...
109            $.cookie(key, '', $.extend({}, options, { expires: -1 }));
110            return !$.cookie(key);
111        };
112
113    }));
114    */
115
116    $( document ).ready(function() {
117        setTimeout(function() {
118            $('.popup_wrapper').animate({opacity: 1}, 1000)}, 2000); // Entrance delay
119        $('.popup_close').click(function() { // Class for the close button
120            $('.popup_wrapper').fadeOut(300); // Hide the CTA div
121            //$.cookie('cookie_popup', 'monster', { expires: 0, path: '/' }); // Set Cookie( 'name', 'value' { expires: null, path '/'})
122        });
123    });
124
125
126
127/*
128    if (typeof $.cookie('cookie_popup') === 'undefined') { // Checks to see if the cookie exists
129        $('.popup_wrapper').removeClass('cookie_popup');
129 // IF No Cookie
130    } else {
131        $('.popup_wrapper').addClass('cookie_popup') // IF Cookie
132    }
133
134
135 */
136    // I set the class 'cookie' to display:none !important so that the div doesnt show if the user has the cookie
137    //
138    // EXPIRES: Setting this to null means the Cookie is deleted after the browser is closed
139    //          You can set a number for the amount of days you want the cookie to stay
140    //
141    // PATH: Setting the path to '/' means the cookie will be created on any page of the site
142    //       You can set the path to any of the sites pages '/contact' and that will be the only page the cookie is created on
143
144})(window.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.