PageSourceSearch

http://www.codehouse.com.au/wp-content/themes/workforce/assets/js/cookie.js?ver=8639

js codehouse.com.au collected 2026-10-05 05:31:59 UTC 1,445 bytes, 43 lines download raw bytes

1document.addEventListener("DOMContentLoaded", () => {
2  const COOKIE_NAME = "cookiesNoticeTtl";
3
4  // ---- READ COOKIE FUNCTION ----
5  function getCookie(name) {
6    const value = `; ${document.cookie}`;
7    const parts = value.split(`; ${name}=`);
8    if (parts.length === 2) return parts.pop().split(";").shift();
9  }
10
11  // ---- CHECK COOKIE ----
12  const cookieTtl = getCookie(COOKIE_NAME);
13
14  // Show banner only if no cookie exists or cookie is expired
15  if (!cookieTtl || Date.now() > parseInt(cookieTtl)) {
16    const banner = document.getElementById("cookie-banner");
17    banner.style.display = "block";
18
19    const acceptBtn = document.getElementById("cookie-accept");
20    const declineBtn = document.getElementById("cookie-decline");
21
22    // ---- ACCEPT → SET 6-MONTH COOKIE ----
23    acceptBtn.addEventListener("click", () => {
24      const currentMonth = new Date().getMonth();
25      const ttl = new Date().setMonth(currentMonth + 6); // +6 months
26
27      document.cookie = `${COOKIE_NAME}=${ttl}; expires=${new Date(
28        ttl
29      ).toUTCString()}; path=/`;
30      banner.style.display = "none";
31    });
32
33    // ---- DECLINE → SET 24-HOUR COOKIE ----
34    declineBtn.addEventListener("click", () => {
35      const ttl = Date.now() + 24 * 60 * 60 * 1000; // 24 hours
36
37      document.cookie = `${COOKIE_NAME}=${ttl}; expires=${new Date(
38        ttl
39      ).toUTCString()}; path=/`;
40      banner.style.display = "none";
41    });
42  }
43});

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.