PageSourceSearch

https://wpsimplepay.com/wp-content/themes/wp-simple-pay/build/block-formats/modal/script.js?ver=2.8.5

js wpsimplepay.com collected 2026-09-24 17:15:31 UTC 13,245 bytes, 322 lines download raw bytes

vendor: 87 bytes, lines 1-4
1/******/ (() => { // webpackBootstrap
2/******/ 	var __webpack_modules__ = ({
3
4/***/ "./
4block-editor/block-formats/modal/script.js":
5/*!****************************************************!*\
6  !*** ./block-editor/block-formats/modal/script.js ***!
7  \****************************************************/
8/***/ (function(module) {
9
10/* global MicroModal */
11
12function buildModal(modalId) {
13  const modalWrapEl = document.createElement('div');
14  modalWrapEl.id = modalId;
15  modalWrapEl.classList.add('modal');
16  modalWrapEl.classList.add('modal-slide');
17  modalWrapEl.classList.add('has-content');
18  modalWrapEl.ariaHidden = true;
19  const modalOverlayEl = document.createElement('div');
20  modalOverlayEl.classList.add('modal__overlay');
21  modalOverlayEl.tabIndex = -1;
22  modalOverlayEl.dataset.micromodalClose = '';
23  modalWrapEl.appendChild(modalOverlayEl);
24  const modalContainerEl = document.createElement('div');
25  modalContainerEl.classList.add('modal__container');
26  modalContainerEl.role = 'dialog';
27  modalContainerEl.ariaMmodal = true;
28  modalOverlayEl.appendChild(modalContainerEl);
29  const closeButtonEl = document.createElement('div');
30  closeButtonEl.classList.add('modal__close');
31  closeButtonEl.type = 'button';
32  closeButtonEl.dataset.micromodalClose = '';
33  closeButtonEl.ariaLabel = 'Close modal';
34  modalContainerEl.appendChild(closeButtonEl);
35  const modalContentEl = document.createElement('div');
36  modalContentEl.innerHTML = document.getElementById(modalId).innerHTML;
37  modalContainerEl.appendChild(modalContentEl);
38  document.getElementById(modalId).remove();
39  document.body.appendChild(modalWrapEl);
40}
41
42/**
43 * Launches a modal.
44 */
45document.addEventListener('DOMContentLoaded', () => {
46  const triggerEls = document.querySelectorAll('[data-wpsp-micromodal-trigger]');
47  triggerEls.forEach(function (triggerEl) {
48    const parentLinkEl = triggerEl.parentNode;
49    const modalId = triggerEl.dataset.wpspMicromodalTrigger;
50    buildModal(modalId);
51    parentLinkEl.addEventListener('click', function (e) {
52      e.preventDefault();
53      MicroModal.show(modalId);
54    });
55  });
56});
57
58// https://unpkg.com/[email protected]/dist/micromodal.min.js
59// prettier-ignore
60!function (e, t) {
61   true ? module.exports = t() : 0;
62}(this, function () {
63  "use strict";
64
65  function e(e, t) {
66    for (let o = 0; o < t.length; o++) {
67      const n = t[o];
68      n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
69    }
70  }
71  function t(e) {
72    return function (e) {
73      if (Array.isArray(e)) return o(e);
74    }(e) || function (e) {
75      if ("undefined" !== typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e);
76    }(e) || function (e, t) {
77      if (!e) return;
78      if ("string" === typeof e) return o(e, t);
79      let n = Object.prototype.toString.call(e).slice(8, -1);
80      "Object" === n && e.constructor && (n = e.constructor.name);
81      if ("Map" === n || "Set" === n) return Array.from(e);
82      if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return o(e, t);
83    }(e) || function () {
84      throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
85    }();
86  }
87  function o(e, t) {
88    (null == t || t > e.length) && (t = e.length);
89    for (var o = 0, n = new Array(t); o < t; o++) n[o] = e[o];
90    return n;
91  }
92  let n,
93    i,
94    a,
95    r,
96    s,
97    l = (n = ["a[href]", "area[href]", 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', "select:not([disabled]):not([aria-hidden])", "textarea:not([disabled]):not([aria-hidden])", "button:not([disabled]):not([aria-hidden])", "iframe", "object", "embed", "[contenteditable]", '[tabindex]:not([tabindex^="-"])'], i = function () {
98      function o(e) {
99        const n = e.targetModal,
100          i = e.triggers,
101          a = void 0 === i ? [] : i,
102          r = e.onShow,
103          s = void 0 === r ? function () {} : r,
104          l = e.onClose,
105          c = void 0 === l ? function () {} : l,
106          d = e.openTrigger,
107          u = void 0 === d ? "data-micromodal-trigger" : d,
108          f = e.closeTrigger,
109          h = void 0 === f ? "data-micromodal-close" : f,
110          v = e.openClass,
111          g = void 0 === v ? "is-open" : v,
112          m = e.disableScroll,
113          b = void 0 !== m && m,
114          y = e.disableFocus,
115          p = void 0 !== y && y,
116          w = e.awaitCloseAnimation,
117          E = void 0 !== w && w,
118          k = e.awaitOpenAnimation,
119          M = void 0 !== k && k,
120          A = e.debugMode,
121          C = void 0 !== A && A;
122        !function (e, t) {
123          if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
124        }(this, o), this.modal = document.getElementById(n), this.config = {
125          debugMode: C,
126          disableScroll: b,
127          openTrigger: u,
128          closeTrigger: h,
129          openClass: g,
130          onShow: s,
131          onClose: c,
132          awaitCloseAnimation: E,
133          awaitOpenAnimation: M,
134          disableFocus: p
135        }, a.length > 0 && this.registerTriggers.apply(this, t(a)), this.onClick = this.onClick.bind(this), this.onKeydown = this.onKeydown.bind(this);
136      }
137      let i, a, r;
138      return i = o, (a = [{
139        key: "registerTriggers",
140        value() {
141          for (var e = this, t = arguments.length, o = new Array(t), n = 0; n < t; n++) o[n] = arguments[n];
142          o.filter(Boolean).forEach(function (t) {
143            t.addEventListener("click", function (t) {
144              return e.showModal(t);
145            });
146          });
147        }
148      }, {
149        key: "showModal",
150        value() {
151          const e = this,
152            t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
153          if (this.activeElement = document.activeElement, this.modal.setAttribute("aria-hidden", "false"), this.modal.classList.add(this.config.openClass), this.scrollBehaviour("disable"), this.addEventListeners(), this.config.awaitOpenAnimation) {
154            const o = function t() {
155              e.modal.removeEventListener("animationend", t, !1), e.setFocusToFirstNode();
156            };
157            this.modal.addEventListener("animationend", o, !1);
158          } else this.setFocusToFirstNode();
159          this.config.onShow(this.modal, this.activeElement, t);
160        }
161      }, {
162        key: "closeModal",
163        value() {
164          const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,
165            t = this.modal;
166          if (this.modal.setAttribute("aria-hidden", "true"), this.removeEventListeners(), this.scrollBehaviour("enable"), this.activeElement && this.activeElement.focus && this.activeElement.focus(), this.config.onClose(this.modal, this.activeElement, e), this.config.awaitCloseAnimation) {
167            const o = this.config.openClass;
168            this.modal.addEventListener("animationend", function e() {
169              t.classList.remove(o), t.removeEventListener("animationend", e, !1);
170            }, !1);
171          } else t.classList.remove(this.config.openClass);
172        }
173      }, {
174        key: "closeModalById",
175        value(e) {
176          this.modal = document.getElementById(e), this.modal && this.closeModal();
177        }
178      }, {
179        key: "scrollBehaviour",
180        value(e) {
181          if (this.config.disableScroll) {
182            const t = document.querySelector("body");
183            switch (e) {
184              case "enable":
185                Object.assign(t.style, {
186                  overflow: ""
187                });
188                break;
189              case "disable":
190                Object.assign(t.style, {
191                  overflow: "hidden"
192                });
193            }
194          }
195        }
196      }, {
197        key: "addEventListeners",
198        value() {
199          this.modal.addEventListener("touchstart", this.onClick), this.modal.addEventListener("click", this.onClick), document.addEventListener("keydown", this.onKeydown);
200        }
201      }, {
202        key: "removeEventListeners",
203        value() {
204          this.modal.removeEventListener("touchstart", this.onClick), this.modal.removeEventListener("click", this.onClick), document.removeEventListener("keydown", this.onKeydown);
205        }
206      }, {
207        key: "onClick",
208        value(e) {
209          (e.target.hasAttribute(this.config.closeTrigger) || e.target.parentNode.hasAttribute(this.config.closeTrigger)) && (e.preventDefault(), e.stopPropagation(), this.closeModal(e));
210        }
211      }, {
212        key: "onKeydown",
213        value(e) {
214          27 === e.keyCode && this.closeModal(e), 9 === e.keyCode && this.retainFocus(e);
215        }
216      }, {
217        key: "getFocusableNodes",
218        value() {
219          const e = this.modal.querySelectorAll(n);
220          return Array.apply(void 0, t(e));
221        }
222      }, {
223        key: "setFocusToFirstNode",
224        value() {
225          const e = this;
226          if (!this.config.disableFocus) {
227            const t = this.getFocusableNodes();
228            if (0 !== t.length) {
229              const o = t.filter(function (t) {
230                return !t.hasAttribute(e.config.closeTrigger);
231              });
232              o.length > 0 && o[0].focus(), 0 === o.length && t[0].focus();
233            }
234          }
235        }
236      }, {
237        key: "retainFocus",
238        value(e) {
239          let t = this.getFocusableNodes();
240          if (0 !== t.length) if (t = t.filter(function (e) {
241            return null !== e.offsetParent;
242          }), this.modal.contains(document.activeElement)) {
243            const o = t.indexOf(document.activeElement);
244            e.shiftKey && 0 === o && (t[t.length - 1].focus(), e.preventDefault()), !e.shiftKey && t.length > 0 && o === t.length - 1 && (t[0].focus(), e.preventDefault());
245          } else t[0].focus();
246        }
247      }]) && e(i.prototype, a), r && e(i, r), o;
248    }(), a = null, r = function (e) {
249      if (!document.getElementById(e)) return console.warn("MicroModal: ❗Seems like you have missed %c'".concat(e, "'"), "background-color: #f8f9fa;color: #50596c;font-weight: bold;", "ID somewhere in your code. Refer example below to resolve it."), c
249onsole.warn("%cExample:", "background-color: #f8f9fa;color: #50596c;font-weight: bold;", '<div class="modal" id="'.concat(e, '"></div>')), !1;
250    }, s = function (e, t) {
251      if (function (e) {
252        e.length <= 0 && (console.warn("MicroModal: ❗Please specify at least one %c'micromodal-trigger'", "background-color: #f8f9fa;color: #50596c;font-weight: bold;", "data attribute."), console.warn("%cExample:", "background-color: #f8f9fa;color: #50596c;font-weight: bold;", '<a href="#" data-micromodal-trigger="my-modal"></a>'));
253      }(e), !t) return !0;
254      for (const o in t) r(o);
255      return !0;
256    }, {
257      init(e) {
258        const o = Object.assign({}, {
259            openTrigger: "data-micromodal-trigger"
260          }, e),
261          n = t(document.querySelectorAll("[".concat(o.openTrigger, "]"))),
262          r = function (e, t) {
263            const o = [];
264            return e.forEach(function (e) {
265              const n = e.attributes[t].value;
266              void 0 === o[n] && (o[n] = []), o[n].push(e);
267            }), o;
268          }(n, o.openTrigger);
269        if (!0 !== o.debugMode || !1 !== s(n, r)) for (const l in r) {
270          const c = r[l];
271          o.targetModal = l, o.triggers = t(c), a = new i(o);
272        }
273      },
274      show(e, t) {
275        const o = t || {};
276        o.targetModal = e, !0 === o.debugMode && !1 === r(e) || (a && a.removeEventListeners(), (a = new i(o)).showModal());
277      },
278      close(e) {
279        e ? a.closeModalById(e) : a.closeModal();
280      }
281    });
282  return "undefined" !== typeof window && (window.MicroModal = l), l;
283});
284
285/***/ })
285
286
287/******/ 	});
288/************************************************************************/
289/******/ 	// The module cache
290/******/ 	var __webpack_module_cache__ = {};
291/******/ 	
292/******/ 	// The require function
293/******/ 	function __webpack_require__(moduleId) {
294/******/ 		// Check if module is in cache
295/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
296/******/ 		if (cachedModule !== undefined) {
297/******/ 			return cachedModule.exports;
298/******/ 		}
299/******/ 		// Create a new module (and put it into the cache)
300/******/ 		var module = __webpack_module_cache__[moduleId] = {
301/******/ 			// no module.id needed
302/******/ 			// no module.loaded needed
303/******/ 			exports: {}
304/******/ 		};
305/******/ 	
306/******/ 		// Execute the module function
307/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
308/******/ 	
309/******/ 		// Return the exports of the module
310/******/ 		return module.exports;
311/******/ 	}
312/******/ 	
313/************************************************************************/
314/******/ 	
315/******/ 	// startup
316/******/ 	// Load entry module and return exports
317/******/ 	// This entry module is referenced by other modules so it can't be inlined
318/******/ 	var __webpack_exports__ = __webpack_require__("./block-editor/block-formats/modal/script.js");
319/******/ 	
320/******/ })()
321;
322//# sourceMappingURL=script.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.