PageSourceSearch

https://wdn-cdn.unl.edu/wdn/templates_6.1/js/components/component.banner.js?v=6.1.6

js unl.edu collected 2026-09-24 06:51:45 UTC 2,931 bytes, 65 lines download raw bytes

1var __defProp = Object.defineProperty;
2var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
3import { removeSessionStorage, getSessionStorage, isValidHttpUrl, setSessionStorage } from "../lib/unl-utility.js?v=6.1.6";
4class UNLNoticeBanner {
5  static {
6    __name(this, "UNLNoticeBanner");
7  }
8  bannerContainer = null;
9  bannerElement = null;
10  messageSource = null;
11  messageKey = null;
12  skipNav = document.getElementById("dcf-skip-nav");
13  clearMessageIntervalSecs = 15 * 60 * 1e3;
14  constructor(options = {}) {
15    this.messageSource = "https://its-unl-cms-prd-s3.s3.amazonaws.com/wdn-message.html", this.messageKey = "UNLNoticeMessage", this.#getMessage().then((messageToDisplay) => {
16      this.#buildBanner(messageToDisplay);
17    }), "clearMessageIntervalSecs" in options && typeof options.clearMessageIntervalSecs == "number" && (this.clearMessageIntervalSecs = options.clearMessageIntervalSecs), setInterval(() => {
18      removeSessionStorage(this.messageKey);
19    }, this.clearMessageIntervalSecs), document.dispatchEvent(new CustomEvent(UNLNoticeBanner.events("UNLBannerReady"), {
20      detail: {
21        classInstance: this
22      }
23    }));
24  }
25  // The names of the events to be used easily
26  static events(name) {
27    const events = {
28      UNLBannerReady: "UNLBannerReady"
29    };
30    return Object.freeze(events), name in events ? events[name] : void 0;
31  }
32  /**
33   * Builds the banner and places it on the page
34   * @param { string|null } messageToDisplay 
35   */
36  #buildBanner(messageToDisplay) {
37    messageToDisplay === null && messageToDisplay === "" || (this.bannerElement = document.createElement("div"), this.bannerElement.setAttribute("id", "unl-notice-banner"), this.bannerElement.classList.add("dcf-d-none@print"), this.bannerElement.innerHTML = messageToDisplay, this.skipNav !== null ? this.skipNav.parentNode.insertBefore(this.bannerElement, this.skipNav.nextSibling) : document.body.prepend(this.bannerElement));
38  }
39  /**
40   * Gets the data from session, or fetches from url, or the message source
41   * It will also store the message in session data
42   * @returns { Promise<String> } Message string
43   */
44  async #getMessage() {
45    const sessionData = getSessionStorage(this.messageKey);
46    if (sessionData !== null)
47      return sessionData;
48    let returnText = "";
49    return isValidHttpUrl(this.messageSource) ? returnText = await this.#fetchMessageFromUrl() : returnText = this.messageSource, setSessionStorage(this.messageKey, returnText), returnText;
50  }
51  /**
52   * Fetches message from Url
53   * @returns { Promise<String> } Fetched message
54   */
55  async #fetchMessageFromUrl() {
56    const response = await fetch(this.messageSource);
57    if (!response.ok)
58      throw new Error(`Failed to fetch banner data: ${response.status}`);
59    return await response.text();
60  }
61}
62export {
63  UNLNoticeBanner as default
64};
65//# sourceMappingURL=component.banner.js.map

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.