PageSourceSearch

https://www.pcadv.org/wp-content/themes/pcadv/js/escape.js?ver=20210218

js pcadv.org collected 2026-10-03 22:59:35 UTC 6,609 bytes, 232 lines download raw bytes

1function getAway() {
2    // Get away right now. Go to site in new tab.
3    window.open("https://weather.com", "_newtab");
4    // Replace current site with another benign site
5    window.location.replace('https://google.com');
6}
7
8
9jQuery(document).ready(function ($) {
10    // Cookies.remove('escapeState');
11
12    // vars
13    var toaster = $('.toaster--escape');
14    var toasterTitle = $('#escapeTitle');
15    var escapeButton = $('.js__escape');
16    var escapeOK = $('.js__escape-ok');
17    var escapeMore = $('.js__escape-more');
18    var siteLogo = $('.site-header .custom-logo-link');
19
20    escapeButton.on("click", function (e) {
21        getAway();
22    });
23
24    // Close using esc button
25    $(document).keydown(function(e) {
26      if (e.keyCode == 27) {
27        getAway();
28      }
29    });
30
31
32    function showPopUp() {
33        toaster.addClass('is--active');
34        toaster.attr('aria-hidden', 'false');
35        $('.toaster--escape').focus();
36    }
37
38    function closePopUp() {
39        toaster.removeClass('is--active');
40        toaster.attr('aria-hidden', 'true');
41        siteLogo.focus();
42    }
43
44    function setCookie() {
45        Cookies.set('escapeState', 'closed', {
46            expires: 7
47        });
48    }
49
50    escapeMore.on("click", function (e) {
51        closePopUp();
52        setCookie();
53    });
54
55    escapeOK.on("click", function (e) {
56        closePopUp();
57        setCookie();
58    });
59
60
61    if (Cookies.get('escapeState') === 'closed') {
62        closePopUp();
63    } else {
64        showPopUp();
65    }
66
67});
68//////////////////////////
69/*!
70 * JavaScript Cookie v2.2.0
71 * https://github.com/js-cookie/js-cookie
72 *
73 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
74 * Released under the MIT license
75 */
76;
77(function (factory) {
78    var registeredInModuleLoader;
79    if (typeof define === 'function' && define.amd) {
80        define(factory);
81        registeredInModuleLoader = true;
82    }
83    if (typeof exports === 'object') {
84        module.exports = factory();
85        registeredInModuleLoader = true;
86    }
87    if (!registeredInModuleLoader) {
88        var OldCookies = window.Cookies;
89        var api = window.Cookies = factory();
90        api.noConflict = function () {
91            window.Cookies = OldCookies;
92            return api;
93        };
94    }
95}(function () {
96    function extend() {
97        var i = 0;
98        var result = {};
99        for (; i < arguments.length; i++) {
100            var attributes = arguments[i];
101            for (var key in attributes) {
102                result[key] = attributes[key];
103            }
104        }
105        return result;
106    }
107
108    function decode(s) {
109        return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
110    }
111
112    function init(converter) {
113        function api() {}
114
115        function set(key, value, attributes) {
116            if (typeof document === 'undefined') {
117                return;
118            }
119
120            attributes = extend({
121                path: '/'
122            }, api.defaults, attributes);
123
124            if (typeof attributes.expires === 'number') {
125                attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5);
126            }
127
128            // We're using "expires" because "max-age" is not supported by IE
129            attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
130
131            try {
132                var result = JSON.stringify(value);
133                if (/^[\{\[]/.test(result)) {
134                    value = result;
135                }
136            } catch (e) {}
137
138            value = converter.write ?
139                converter.write(value, key) :
140                encodeURIComponent(String(value))
141                .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
142
143            key = encodeURIComponent(String(key))
144                .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
145                .replace(/[\(\)]/g, escape);
146
147            var stringifiedAttributes = '';
148            for (var attributeName in attributes) {
149                if (!attributes[attributeName]) {
150                    continue;
151                }
vendor: 2,495 bytes, lines 152-232
152                stringifiedAttributes += '; ' + attributeName;
153                if (attributes[attributeName] === true) {
154                    continue;
155                }
156
157                // Considers RFC 6265 section 5.2:
158                // ...
159                // 3.  If the remaining unparsed-attributes contains a %x3B (";")
160                //     character:
161                // Consume the characters of the unparsed-attributes up to,
162                // not including, the first %x3B (";") character.
163                // ...
164                stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
165            }
166
167            return (document.cookie = key + '=' + value + stringifiedAttributes);
168        }
169
170        function get(key, json) {
171            if (typeof document === 'undefined') {
172                return;
173            }
174
175            var jar = {};
176            // To prevent the for loop in the first place assign an empty array
177            // in case there are no cookies at all.
178            var cookies = document.cookie ? document.cookie.split('; ') : [];
179            var i = 0;
180
181            for (; i < cookies.length; i++) {
182                var parts = cookies[i].split('=');
183                var cookie = parts.slice(1).join('=');
184
185                if (!json && cookie.charAt(0) === '"') {
186                    cookie = cookie.slice(1, -1);
187                }
188
189                try {
190                    var name = decode(parts[0]);
191                    cookie = (converter.read || converter)(cookie, name) ||
192                        decode(cookie);
193
194                    if (json) {
195                        try {
196                            cookie = JSON.parse(cookie);
197                        } catch (e) {}
198                    }
199
200                    jar[name] = cookie;
201
202                    if (key === name) {
203                        break;
204                    }
205                } catch (e) {}
206            }
207
208            return key ? jar[key] : jar;
209        }
210
211        api.set = set;
212        api.get = function (key) {
213            return get(key, false /* read as raw */ );
214        };
215        api.getJSON = function (key) {
216            return get(key, true /* read as json */ );
217        };
218        api.remove = function (key, attributes) {
219            set(key, '', extend(attributes, {
220                expires: -1
221            }));
222        };
223
224        api.defaults = {};
225
226        api.withConverter = init;
227
228        return api;
229    }
230
231    return init(function () {});
232}));

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.