PageSourceSearch

https://myprofile.servsafe.com/assets/scripts/genesys-ss.js

js servsafe.com collected 2026-10-01 10:13:33 UTC 2,981 bytes, 63 lines download raw bytes

1const CentralSiteStorageLoader = () => {
2    const IFRAME_BASE_DOMAIN = "servsafe.com";
3
4    const SUBDOMAIN_REGEXES = [{ regex: /^testmyprofile\.servsafe\.com$/, subdomain: "cmstest." }, { regex: /^stagingmyprofile\.servsafe\.com$/, subdomain: "cmsstaging." }, { regex: /.*/, subdomain: "www." }];
5
6    const subdomainMatch = SUBDOMAIN_REGEXES.find((i) => i.regex.test(window.location.hostname)).subdomain;
7
8    const IFRAME_URL = "https://" + (subdomainMatch ?? "") + IFRAME_BASE_DOMAIN + "/access/centralsitestorage.html";
9
10    const iframeOrigin = new URL(IFRAME_URL).origin;
11
12    // Setup the iframe element
13    const iframe = document.createElement("iframe");
14    iframe.setAttribute("src", IFRAME_URL + "?origin=" + window.location.origin); iframe.setAttribute("frameborder", 0); iframe.setAttribute("width", 0); iframe.setAttribute("height", 0);
15
16    window.addEventListener("message", (ev) => {
17
18        if (ev.origin !== iframeOrigin || ev.data == null || ev.data.id == null) {
19            // Nothing to do with this message. Either it's not for us, or it's malformed.
20            return;
21        }
22
23        if (ev.data.id === "CentralSiteStorage" && ev.data.event === "Loaded") {
24            // Event when the CentralSiteStorage iframe has finished loading its javascript, and ready for messages
25            // console.log('Loading central site storage for Genesys');
26
27            // Request to retrieve the stored data
28            iframe.contentWindow.postMessage({ id: 'genesys', action: "load-data", origin: location.origin }, iframeOrigin);
29        }
30
31        if (ev.data.id === "genesys" && ev.data.event === "load-data") {
32            // Event from the request to retrieve the stored data
33            if (!ev.data.success) {
34                console.log('Loading failed:', ev.data.ex);
35            }
36
37            // Parse and set the local storage items to replicate what was saved
38            Object.keys(ev.data.data).forEach((key) => localStorage.setItem(key, ev.data.data[key]));
39            // console.log('Data loaded:', ev.data.data);
40
41            (function (g, e, n, es, ys) {
42                g['_genesysJs'] = e;
43                g[e] = g[e] || function () {
44                    (g[e].q = g[e].q || []).push(arguments)
45                };
46                g[e].t = 1 * new Date();
47                g[e].c = es;
48                ys = document.createElement('script');
49                ys.async = 1;
50                ys.src = n;
51                ys.charset = 'utf-8';
52                document.head.appendChild(ys);
53            })(window, 'Genesys', 'https://apps.usw2.pure.cloud/genesys-bootstrap/genesys.min.js', {
54                environment: 'prod-usw2',
55                deploymentId: 'e3fabbe1-f5d6-47f5-928d-4af938e464cc'
56            });
57        }
58    }, false);
59
60    document.body.appendChild(iframe);
61};
62
63document.addEventListener('DOMContentLoaded', (ev) => { CentralSiteStorageLoader(); });

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.