PageSourceSearch

https://lambdalegal.org/wp-content/plugins/lambda-legal-theme-exte…/alert-bars/js/alert-bars.js?ver=1790199046

js lambdalegal.org collected 2026-09-24 08:39:55 UTC 2,398 bytes, 96 lines download raw bytes

1(function () {
2  init();
3
4  /**
5   * A helper function to set a cookie in the browser
6   *
7   * @param {string} cookieName
8   * @param {string} cookieValue
9   * @param {number} expireInHalfDays The number of half-days until the cookie expires
10   */
11  function setCookie(cookieName, cookieValue, expireInHalfDays) {
12    const d = new Date();
13
14    d.setTime(d.getTime() + expireInHalfDays * 12 * 60 * 60 * 1000);
15
16    const expires = 'expires=' + d.toUTCString();
17
18    document.cookie =
19      cookieName + '=' + cookieValue + ';' + expires + ';path=/';
20  }
21
22  /**
23   * A helper function to get a cookie from the browser based on the cookie name
24   *
25   * @param {string} cookieName
26   *
27   * @returns {string}
28   */
29  function getCookie(cookieName) {
30    let name = cookieName + '=';
31    let decodedCookie = decodeURIComponent(document.cookie);
32    let allCookies = decodedCookie.split(';');
33
34    for (let i = 0; i < allCookies.length; i++) {
35      let currentCookie = allCookies[i];
36
37      while (currentCookie.charAt(0) == ' ') {
38        currentCookie = currentCookie.substring(1);
39      }
40
41      if (currentCookie.indexOf(name) == 0) {
42        return currentCookie.substring(name.length, currentCookie.length);
43      }
44    }
45
46    return '';
47  }
48
49  function bindEvents() {
50    const alertBarCloseButtons = document.querySelectorAll(
51      '.alert-bar__close-button'
52    );
53
54    alertBarCloseButtons.forEach((button) => {
55      button.addEventListener('click', (event) => {
56        const sectionElement = button.closest('.alert-bar');
57
58        if (!sectionElement) {
59          return;
60        }
61
62        const sectionID = sectionElement.id;
63
64        setCookie('STYXKEY_' + sectionID, 'true', 1);
65        sectionElement.style.maxHeight = 0;
66
67        setTimeout(() => {
68          sectionElement.remove();
69        }, 500);
70      });
71    });
72
73    setMaxHeightToAlertBars();
74  }
75
76  function setMaxHeightToAlertBars() {
77    const alertBarCloseButtons = document.querySelectorAll(
78      '.alert-bar__close-button'
79    );
80
81    alertBarCloseButtons.forEach((button) => {
82      const sectionElement = button.closest('.alert-bar');
83      sectionElement.style.maxHeight = sectionElement.scrollHeight + 'px';
84    });
85  }
86
87  function init() {
88    window.addEventListener('load', () => {
89      bindEvents();
90    });
91
92    window.addEventListener('resize', () => {
93      setMaxHeightToAlertBars();
94    });
95  }
96})();

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.