PageSourceSearch

https://www.synchrony.com/syc/js/micromodal-min.js?v=1708702646584

js synchrony.com collected 2026-10-01 08:40:33 UTC 11,865 bytes, 264 lines download raw bytes

1!(function (e, t) {
2  "object" == typeof exports && "undefined" != typeof module ? (module.exports = t()) : "function" == typeof define && define.amd ? define(t) : ((e = "undefined" != typeof globalThis ? globalThis : e || self).MicroModal = t());
3})(this, function () {
4  "use strict";
5  function e(e, t) {
6    for (var o = 0; o < t.length; o++) {
7      var n = t[o];
8      (n.enumerable = n.enumerable || !1), (n.configurable = !0), "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
9    }
10  }
11  function t(e) {
12    return (
13      (function (e) {
14        if (Array.isArray(e)) return o(e);
15      })(e) ||
16      (function (e) {
17        if ("undefined" != typeof Symbol && Symbol.iterator in Object(e)) return Array.from(e);
18      })(e) ||
19      (function (e, t) {
20        if (!e) return;
21        if ("string" == typeof e) return o(e, t);
22        var n = Object.prototype.toString.call(e).slice(8, -1);
23        "Object" === n && e.constructor && (n = e.constructor.name);
24        if ("Map" === n || "Set" === n) return Array.from(e);
25        if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return o(e, t);
26      })(e) ||
27      (function () {
28        throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
29      })()
30    );
31  }
32  function o(e, t) {
33    (null == t || t > e.length) && (t = e.length);
34    for (var o = 0, n = new Array(t); o < t; o++) n[o] = e[o];
35    return n;
36  }
37  var n,
38    i,
39    a,
40    r,
41    s,
42    l =
43      ((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^="-"])']),
44      (i = (function () {
45        function o(e) {
46          var n = e.targetModal,
47            i = e.triggers,
48            a = void 0 === i ? [] : i,
49            r = e.onShow,
50            s = void 0 === r ? function () {} : r,
51            l = e.onClose,
52            c = void 0 === l ? function () {} : l,
53            d = e.openTrigger,
54            u = void 0 === d ? "data-micromodal-trigger" : d,
55            f = e.closeTrigger,
56            h = void 0 === f ? "data-micromodal-close" : f,
57            v = e.openClass,
58            g = void 0 === v ? "is-open" : v,
59            m = e.disableScroll,
60            b = void 0 !== m && m,
61            y = e.disableFocus,
62            p = void 0 !== y && y,
63            w = e.awaitCloseAnimation,
64            E = void 0 !== w && w,
65            k = e.awaitOpenAnimation,
66            M = void 0 !== k && k,
67            A = e.debugMode,
68            C = void 0 !== A && A;
69          !(function (e, t) {
70            if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
71          })(this, o),
72            (this.modal = document.getElementById(n)),
73            (this.config = { debugMode: C, disableScroll: b, openTrigger: u, closeTrigger: h, openClass: g, onShow: s, onClose: c, awaitCloseAnimation: E, awaitOpenAnimation: M, disableFocus: p }),
74            a.length > 0 && this.registerTriggers.apply(this, t(a)),
75            (this.onClick = this.onClick.bind(this)),
76            (this.onKeydown = this.onKeydown.bind(this));
77        }
78        var i, a, r;
79        return (
80          (i = o),
81          (a = [
82            {
83              key: "registerTriggers",
84              value: function () {
85                for (var e = this, t = arguments.length, o = new Array(t), n = 0; n < t; n++) o[n] = arguments[n];
86                o.filter(Boolean).forEach(function (t) {
87                  t.addEventListener("click", function (t) {
88                    return e.showModal(t);
89                  });
90                  t.addEventListener("keypress", function (t) {
91                    if ( event.which == 13 ) {
92                      return e.showModal(t);
93                    }
94                  });
95                });
96              },
97            },
98            {
99              key: "showModal",
100              value: function () {
101                var e = this,
102                  t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
103                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)) {
104                  var o = function t() {
105                    e.modal.removeEventListener("animationend", t, !1), e.setFocusToFirstNode();
106                  };
107                  this.modal.addEventListener("animationend", o, !1);
108                } else this.setFocusToFirstNode();
109                this.config.onShow(this.modal, this.activeElement, t);
110              },
111            },
112            {
113              key: "closeModal",
114              value: function () {
115                var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null,
116                  t = this.modal;
117                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)) {
118                  var o = this.config.openClass;
119                  this.modal.addEventListener(
120                    "animationend",
121                    function e() {
122                      t.classList.remove(o), t.removeEventListener("animationend", e, !1);
123                    },
124                    !1
125                  );
126                } else t.classList.remove(this.config.openClass);
127              },
128            },
129            {
130              key: "closeModalById",
131              value: function (e) {
132                (this.modal = document.getElementById(e)), this.modal && this.closeModal();
133              },
134            },
135            {
136              key: "scrollBehaviour",
137              value: function (e) {
138                if (this.config.disableScroll) {
139                  var t = document.querySelector("body");
140                  switch (e) {
141                    case "enable":
142                      Object.assign(t.style, { overflow: "" });
143                      break;
144                    case "disable":
145                      Object.assign(t.style, { overflow: "hidden" });
146                  }
147                }
148              },
149            },
150            {
151              key: "addEventListeners",
152              value: function () {
153                this.modal.addEventListener("touchstart", this.onClick), this.modal.addEventListener("click", this.onClick), document.addEventListener("keydown", this.onKeydown);
154              },
155            },
156            {
157              key: "removeEventListeners",
158              value: function () {
159                this.modal.removeEventListener("touchstart", this.onClick), this.modal.removeEventListener("click", this.onClick), document.removeEventListener("keydown", this.onKeydown);
160              },
161            },
162            {
163              key: "onClick",
164              value: function (e) {
165                (e.target.hasAttribute(this.config.closeTrigger) || e.target.parentNode.hasAttribute(this.config.closeTrigger)) && (e.preventDefault(), e.stopPropagation(), this.closeModal(e));
166              },
167            },
168            {
169              key: "onKeydown",
170              value: function (e) {
171                27 === e.keyCode && this.closeModal(e), 9 === e.keyCode && this.retainFocus(e);
172              },
173            },
174            {
175              key: "getFocusableNodes",
176              value: function () {
177                var e = this.modal.querySelectorAll(n);
178                return Array.apply(void 0, t(e));
179              },
180            },
181            {
182              key: "setFocusToFirstNode",
183              value: function () {
184                var e = this;
185                if (!this.config.disableFocus) {
186                  var t = this.getFocusableNodes();
187                  if (0 !== t.length) {
188                    var o = t.filter(function (t) {
189                      return !t.hasAttribute(e.config.closeTrigger);
190                    });
191                    o.length > 0 && o[0].focus(), 0 === o.length && t[0].focus();
192                  }
193                }
194              },
195            },
196            {
197              key: "retainFocus",
198              value: function (e) {
199                var t = this.getFocusableNodes();
200                if (0 !== t.length)
201                  if (
202                    ((t = t.filter(function (e) {
203                      return null !== e.offsetParent;
204                    })),
205                    this.modal.contains(document.activeElement))
206                  ) {
207                    var o = t.indexOf(document.activeElement);
208                    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());
209                  } else t[0].focus();
210              },
211            },
212          ]) && e(i.prototype, a),
213          r && e(i, r),
214          o
215        );
216      })()),
217      (a = null),
218      (r = function (e) {
219        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
219onsole.warn("%cExample:", "background-color: #f8f9fa;color: #50596c;font-weight: bold;", '<div class="modal" id="'.concat(e, '"></div>')), !1;
220      }),
221      (s = function (e, t) {
222        if (
223          ((function (e) {
224            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>'));
225          })(e),
226          !t)
227        )
228          return !0;
229        for (var o in t) r(o);
230        return !0;
231      }),
232      {
233        init: function (e) {
234          var o = Object.assign({}, { openTrigger: "data-micromodal-trigger" }, e),
235            n = t(document.querySelectorAll("[".concat(o.openTrigger, "]"))),
236            r = (function (e, t) {
237              var o = [];
238              return (
239                e.forEach(function (e) {
240                  var n = e.attributes[t].value;
241                  void 0 === o[n] && (o[n] = []), o[n].push(e);
242                }),
243                o
244              );
245            })(n, o.openTrigger);
246          if (!0 !== o.debugMode || !1 !== s(n, r))
247            for (var l in r) {
248              var c = r[l];
249              (o.targetModal = l), (o.triggers = t(c)), (a = new i(o));
250            }
251        },
252        show: function (e, t) {
253          var o = t || {};
254          (o.targetModal = e), (!0 === o.debugMode && !1 === r(e)) || (a && a.removeEventListeners(), (a = new i(o)).showModal());
255        },
256        close: function (event, e, t) {
257          //  this.modal = document.getElementById(e);
258            // e ? a.closeModalById(e) : a.closeModal(e);
259           //a.closeModalById(e);
260            //a.closeModal(t);
261        },
262      });
263  return "undefined" != typeof window && (window.MicroModal = l), l;
264});

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.