PageSourceSearch

https://wdn-cdn.unl.edu/wdn/templates_6.1/js/chunks/chunk.dcf-figcaption-toggle.js?v=6.1.6

js unl.edu collected 2026-09-24 06:52:24 UTC 4,968 bytes, 80 lines download raw bytes

1var __defProp = Object.defineProperty;
2var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
3import { u as uuidv4 } from "./chunk.dcf-utility.js?v=6.1.6";
4import { D as DCFButtonToggles } from "./chunk.dcf-button-toggle.js?v=6.1.6";
5class DCFFigcaptionToggles {
6  static {
7    __name(this, "DCFFigcaptionToggles");
8  }
9  uuid = uuidv4();
10  figcaption = null;
11  figure = null;
12  toggleButton = null;
13  toggleButtonInstance = null;
14  toggleButtonInnerHTML = `<svg class="dcf-h-4 dcf-w-4 dcf-fill-current"
15        width="24" height="24" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
16    <path class="dcf-btn-toggle-figcaption-icon-open"
17        d="M1,3h19c0.6,0,1-0.4,1-1c0-0.6-0.4-1-1-1H1C0.4,1,0,1.4,0,2C0,2.6,0.4,3,1,3z"/>
18        '<path class="dcf-btn-toggle-figcaption-icon-open"
19        d="M1,8h15c0.6,0,1-0.4,1-1c0-0.6-0.4-1-1-1H1C0.4,6,0,6.4,0,7C0,7.6,0.4,8,1,8z"/>
20    <path class="dcf-btn-toggle-figcaption-icon-close-1"
21        d="M1,13h22c0.6,0,1-0.4,1-1c0-0.6-0.4-1-1-1H1c-0.6,0-1,0.4-1,1C0,12.6,0.4,13,1,13z"/>
22    <path class="dcf-btn-toggle-figcaption-icon-close-2"
23        d="M1,13h22c0.6,0,1-0.4,1-1c0-0.6-0.4-1-1-1H1c-0.6,0-1,0.4-1,1C0,12.6,0.4,13,1,13z"/>
24    <path class="dcf-btn-toggle-figcaption-icon-open"
25        d="M1,18h18c0.6,0,1-0.4,1-1c0-0.6-0.4-1-1-1H1c-0.6,0-1,0.4-1,1C0,17.6,0.4,18,1,18z"/>
26    <path class="dcf-btn-toggle-figcaption-icon-open"
27        d="M1,23h15c0.6,0,1-0.4,1-1c0-0.6-0.4-1-1-1H1c-0.6,0-1,0.4-1,1C0,22.6,0.4,23,1,23z"/>
28</svg>`;
29  toggleButtonClassList = [
30    "dcf-btn",
31    "dcf-btn-inverse-tertiary",
32    "dcf-absolute",
33    "dcf-z-1",
34    "dcf-d-flex",
35    "dcf-ai-center",
36    "dcf-white",
37    "dcf-btn-toggle-figcaption"
38  ];
39  figcaptionClassList = [
40    "dcf-absolute",
41    "dcf-left-0",
42    "dcf-top-0",
43    "dcf-h-100%",
44    "dcf-w-100%",
45    "dcf-z-1",
46    "dcf-figcaption-toggle"
47  ];
48  toggleKeys = [];
49  onKeys = [];
50  offKeys = [];
51  // Set up the button
52  constructor(figcaption, options = {}) {
53    if (Array.isArray(options.toggleKeys) ? this.toggleKeys = [...options.toggleKeys] : options.toggleKeys !== null && options.toggleKeys !== void 0 && options.toggleKeys !== "" && this.toggleKeys.push(options.toggleKeys), Array.isArray(options.onKeys) ? this.onKeys = [...options.onKeys] : options.onKeys !== null && options.onKeys !== void 0 && options.onKeys !== "" && this.onKeys.push(options.onKeys), Array.isArray(options.offKeys) ? this.offKeys = [...options.offKeys] : options.offKeys !== null && options.offKeys !== void 0 && options.offKeys !== "" && this.offKeys.push(options.offKeys), "toggleButtonInnerHTML" in options && typeof options.toggleButtonInnerHTML == "string" && (this.toggleButtonInnerHTML = options.toggleButtonInnerHTML), "toggleButtonClassList" in options && Array.isArray(options.toggleButtonClassList) && (this.toggleButtonClassList = options.toggleButtonClassList), "figcaptionClassList" in options && Array.isArray(options.figcaptionClassList) && (this.figcaptionClassList = options.figcaptionClassList), this.figcaption = figcaption, this.figure = this.figcaption.parentElement, this.figure !== null && this.figure.tagName !== "FIGURE")
54      throw new Error("Figcaption-Toggle Missing Figure Tag Parent");
55    this.figure.classList.add("dcf-relative"), (this.figcaption.getAttribute("id") === "" || this.figcaption.getAttribute("id") === null) && this.figcaption.setAttribute("id", this.uuid.concat("-figcaption-toggle")), this.figcaptionClassList && this.figcaptionClassList.forEach((cssClass) => {
56      this.figcaption.classList.add(cssClass);
57    }), this.toggleButton = document.createElement("button"), this.toggleButton.dataset.controls = this.figcaption.getAttribute("id"), this.toggleButton.dataset.labelOn = "Show caption", this.toggleButton.dataset.labelOff = "Hide caption", this.toggleButton.dataset.startExpanded = "false", this.toggleButton.innerHTML = this.toggleButtonInnerHTML, this.toggleButtonClassList && this.toggleButtonClassList.forEach((cssClass) => {
58      this.toggleButton.classList.add(cssClass);
59    }), this.figure.appendChild(this.toggleButton), this.toggleButtonInstance = new DCFButtonToggles(this.toggleButton, {
60      toggleKeys: this.toggleKeys,
61      onKeys: this.onKeys,
62      offKeys: this.offKeys
63    }), this.figcaption.classList.add("dcf-figcaption-toggle-initialized"), this.figcaption.removeAttribute("hidden"), this.figcaption.dispatchEvent(new CustomEvent(DCFFigcaptionToggles.events("figcaptionToggleReady"), {
64      detail: {
65        classInstance: this
66      }
67    }));
68  }
69  // The names of the events to be used easily
70  static events(name) {
71    const events = {
72      figcaptionToggleReady: "figcaptionToggleReady"
73    };
74    return Object.freeze(events), DCFButtonToggles.events(name) !== void 0 ? DCFButtonToggles.events(name) : name in events ? events[name] : void 0;
75  }
76}
77export {
78  DCFFigcaptionToggles as D
79};
80//# sourceMappingURL=chunk.dcf-figcaption-toggle.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.