PageSourceSearch

https://www.onghansel.com/static/_common/image_sets/featherlight.m…0dd0d76998abe879d48cd4b8e145648218166400.js

js onghansel.com collected 2026-10-07 07:35:56 UTC 15,080 bytes, 471 lines download raw bytes

1/**
2 * Featherlight - ultra slim jQuery lightbox
3 * Version 1.7.13 - http://noelboss.github.io/featherlight/
4 *
5 * Copyright 2018, Noël Raoul Bossart (http://www.noelboss.com)
6 * MIT Licensed.
7**/
8
9!(function(a) {
10  function b(a, c) {
11    if (!(this instanceof b)) {
12      var d = new b(a, c);
13      return d.open(), d;
14    }
15    (this.id = b.id++), this.setup(a, c), this.chainCallbacks(b._callbackChain);
16  }
17  function c(a, b) {
18    var c = {};
19    for (var d in a) d in b && ((c[d] = a[d]), delete a[d]);
20    return c;
21  }
22  function d(a, b) {
23    var c = {},
24      d = new RegExp("^" + b + "([A-Z])(.*)");
25    for (var e in a) {
26      var f = e.match(d);
27      if (f) {
28        var g = (f[1] + f[2].replace(/([A-Z])/g, "-$1")).toLowerCase();
29        c[g] = a[e];
30      }
31    }
32    return c;
33  }
34  if (typeof a === "undefined")
35    return void ("console" in window && window.console.info("Too much lightness, Featherlight needs jQuery."));
36  if (a.fn.jquery.match(/-ajax/))
37    return void (
38      "console" in window && window.console.info("Featherlight needs regular jQuery, not the slim version.")
39    );
40  var e = [],
41    f = function(b) {
42      return (e = a.grep(e, function(a) {
43        return a !== b && a.$instance.closest("body").length > 0;
44      }));
45    },
46    g = {
47      allow: 1,
48      allowfullscreen: 1,
49      frameborder: 1,
50      height: 1,
51      longdesc: 1,
52      marginheight: 1,
53      marginwidth: 1,
54      mozallowfullscreen: 1,
55      name: 1,
56      referrerpolicy: 1,
57      sandbox: 1,
58      scrolling: 1,
59      src: 1,
60      srcdoc: 1,
61      style: 1,
62      webkitallowfullscreen: 1,
63      width: 1
64    },
65    h = { keyup: "onKeyUp", resize: "onResize" },
66    i = function(c) {
67      a.each(b.opened().reverse(), function() {
68        return c.isDefaultPrevented() || !1 !== this[h[c.type]](c)
69          ? void 0
70          : (c.preventDefault(), c.stopPropagation(), !1);
71      });
72    },
73    j = function(c) {
74      if (c !== b._globalHandlerInstalled) {
75        b._globalHandlerInstalled = c;
76        var d = a
77          .map(h, function(a, c) {
78            return c + "." + b.prototype.namespace;
79          })
80          .join(" ");
81        a(window)[c ? "on" : "off"](d, i);
82      }
83    };
84  (b.prototype = {
85    constructor: b,
86    namespace: "featherlight",
87    targetAttr: "data-featherlight",
88    variant: null,
89    resetCss: !1,
90    background: null,
91    openTrigger: "click",
92    closeTrigger: "click",
93    filter: null,
94    root: "body",
95    openSpeed: 250,
96    closeSpeed: 250,
97    closeOnClick: "background",
98    closeOnEsc: !0,
99    closeIcon: "✕",
100    loading: "",
101    persist: !1,
102    otherClose: null,
103    beforeOpen: a.noop,
104    beforeContent: a.noop,
105    beforeClose: a.noop,
106    afterOpen: a.noop,
107    afterContent: a.noop,
108    afterClose: a.noop,
109    onKeyUp: a.noop,
110    onResize: a.noop,
111    type: null,
112    contentFilters: ["jquery", "image", "html", "ajax", "iframe", "text"],
113    setup: function(b, c) {
114      typeof b !== "object" || b instanceof a != !1 || c || ((c = b), (b = void 0));
115      var d = a.extend(this, c, { target: b }),
116        e = d.resetCss ? d.namespace + "-reset" : d.namespace,
117        f = a(
118          d.background ||
119            [
120              '<div class="' + e + "-loading " + e + '">',
121              '<div class="' + e + '-content">',
122              '<button class="' + e + "-close-icon " + d.namespace + '-close" aria-label="Close">',
123              d.closeIcon,
124              "</button>",
125              '<div class="' + d.namespace + '-inner">' + d.loading + "</div>",
126              "</div>",
127              "</div>"
128            ].join("")
129        ),
130        g = "." + d.namespace + "-close" + (d.otherClose ? "," + d.otherClose : "");
131      return (
132        (d.$instance = f.clone().addClass(d.variant)),
133        d.$instance.on(d.closeTrigger + "." + d.namespace, function(b) {
134          if (!b.isDefaultPrevented()) {
135            var c = a(b.target);
136            ((d.closeOnClick === "background" && c.is("." + d.namespace)) ||
137              d.closeOnClick === "anywhere" ||
138              c.closest(g).length) &&
139              (d.close(b), b.preventDefault());
140          }
141        }),
142        this
143      );
144    },
145    getContent: function() {
146      if (this.persist !== !1 && this.$content) return this.$content;
147      var b = this,
148        c = this.constructor.contentFilters,
149        d = function(a) {
150          return b.$currentTarget && b.$currentTarget.attr(a);
151        },
152        e = d(b.targetAttr),
153        f = b.target || e || "",
154        g = c[b.type];
155      if ((!g && f in c && ((g = c[f]), (f = b.target && e)), (f = f || d("href") || ""), !g))
156        for (var h in c) b[h] && ((g = c[h]), (f = b[h]));
157      if (!g) {
158        var i = f;
159        if (
160          ((f = null),
161          a.each(b.contentFilters, function() {
162            return (
163              (g = c[this]), g.test && (f = g.test(i)), !f && g.regex && i.match && i.match(g.regex) && (f = i), !f
164            );
165          }),
166          !f)
167        )
168          return (
169            "console" in window &&
170              window.console.error(
171                "Featherlight: no content filter found " + (i ? ' for "' + i + '"' : " (no target specified)")
172              ),
173            !1
174          );
175      }
176      return g.process.call(b, f);
177    },
178    setContent: function(b) {
179      return (
180        this.$instance.removeClass(this.namespace + "-loading"),
181        this.$instance.toggleClass(this.namespace + "-iframe", b.is("iframe")),
182        this.$instance
183          .find("." + this.namespace + "-inner")
184          .not(b)
185          .slice(1)
186          .remove()
187          .end()
188          .replaceWith(a.contains(this.$instance[0], b[0]) ? "" : b),
189        (this.$content = b.addClass(this.namespace + "-inner")),
190        this
191      );
192    },
193    open: function(b) {
194      var c = this;
195      if ((c.$instance.hide().appendTo(c.root), !((b && b.isDefaultPrevented()) || c.beforeOpen(b) === !1))) {
196        b && b.preventDefault();
197        var d = c.getContent();
198        if (d)
199          return (
200            e.push(c),
201            j(!0),
202            c.$instance.fadeIn(c.openSpeed),
203            c.beforeContent(b),
204            a
205              .when(d)
206              .always(function(a) {
207                c.setContent(a), c.afterContent(b);
208              })
209              .then(c.$instance.promise())
210              .done(function() {
211                c.afterOpen(b);
212              })
213          );
214      }
215      return (
216        c.$instance.detach(),
217        a
218          .Deferred()
219          .reject()
220          .promise()
221      );
222    },
223    close: function(b) {
224      var c = this,
225        d = a.Deferred();
226      return (
227        c.beforeClose(b) === !1
228          ? d.reject()
229          : (f(c).length === 0 && j(!1),
230            c.$instance.fadeOut(c.closeSpeed, function() {
231              c.$instance.detach(), c.afterClose(b), d.resolve();
232            })),
233        d.promise()
234      );
235    },
236    resize: function(a, b) {
237      if (a && b) {
238        this.$content.css("width", "").css("height", "");
239        var c = Math.max(a / (this.$content.parent().width() - 1), b / (this.$content.parent().height() - 1));
240        c > 1 &&
241          ((c = b / Math.floor(b / c)), this.$content.css("width", "" + a / c + "px").css("height", "" + b / c + "px"));
242      }
243    },
244    chainCallbacks: function(b) {
245      for (var c in b) this[c] = a.proxy(b[c], this, a.proxy(this[c], this));
246    }
247  }),
248    a.extend(b, {
249      id: 0,
250      autoBind: "[data-featherlight]",
251      defaults: b.prototype,
252      contentFilters: {
253        jquery: {
254          regex: /^[#.]\w/,
255          test: function(b) {
256            return b instanceof a && b;
257          },
258          process: function(b) {
259            return this.persist !== !1 ? a(b) : a(b).clone(!0);
260          }
261        },
262        image: {
263          regex: /\.(png|jpg|jpeg|gif|tiff?|bmp|svg|heic|webp)(\?\S*)?$/i,
264          process: function(b) {
265            var c = this,
266              d = a.Deferred(),
267              e = new Image(),
268              f = a('<img src="' + b + '" alt="" class="' + c.namespace + '-image" />');
269            return (
270              (e.onload = function() {
271                (f.naturalWidth = e.width), (f.naturalHeight = e.height), d.resolve(f);
272              }),
273              (e.onerror = function() {
274                d.reject(f);
275              }),
276              (e.src = b),
277              d.promise()
278            );
279          }
280        },
281        html: {
282          regex: /^\s*<[\w!][^<]*>/,
283          process: function(b) {
284            return a(b);
285          }
286        },
287        ajax: {
288          regex: /./,
289          process: function(b) {
290            var c = a.Deferred(),
291              d = a("<div></div>").load(b, function(a, b) {
292                b !== "error" && c.resolve(d.contents()), c.fail();
293              });
294            return c.promise();
295          }
296        },
297        iframe: {
298          process: function(b) {
299            var e = new a.Deferred(),
300              f = a("<iframe/>"),
301              h = d(this, "iframe"),
302              i = c(h, g);
303            return (
304              f
305                .hide()
306                .attr("src", b)
307                .attr(i)
308                .css(h)
309                .on("load", function() {
310                  e.resolve(f.show());
311                })
312                .appendTo(this.$instance.find("." + this.namespace + "-content")),
313              e.promise()
314            );
315          }
316        },
317        text: {
318          process: function(b) {
319            return a("<div>", { text: b });
320          }
321        }
322      },
323      functionAttributes: ["beforeOpen", "afterOpen", "beforeContent", "afterContent", "beforeClose", "afterClose"],
324      readElementConfig: function(b, c) {
325        var d = this,
326          e = new RegExp("^data-" + c + "-(.*)"),
327          f = {};
328        return (
329          b &&
330            b.attributes &&
331            a.each(b.attributes, function() {
332              var b = this.name.match(e);
333              if (b) {
334                var c = this.value,
335                  g = a.camelCase(b[1]);
336                if (a.inArray(g, d.functionAttributes) >= 0) c = new Function(c);
337                else
338                  try {
339                    c = JSON.parse(c);
340                  } catch (h) {}
341                f[g] = c;
342              }
343            }),
344          f
345        );
346      },
347      extend: function(b, c) {
348        var d = function() {
349          this.constructor = b;
350        };
351        return (
352          (d.prototype = this.prototype),
353          (b.prototype = new d()),
354          (b.__super__ = this.prototype),
355          a.extend(b, this, c),
356          (b.defaults = b.prototype),
357          b
358        );
359      },
360      attach: function(b, c, d) {
361        var e = this;
362        typeof c !== "object" || c instanceof a != !1 || d || ((d = c), (c = void 0)), (d = a.extend({}, d));
363        var f,
364          g = d.namespace || e.defaults.namespace,
365          h = a.extend({}, e.defaults, e.readElementConfig(b[0], g), d),
366          i = function(g) {
367            var i = a(g.currentTarget),
368              j = a.extend(
369                { $source: b, $currentTarget: i },
370                e.readElementConfig(b[0], h.namespace),
371                e.readElementConfig(g.currentTarget, h.namespace),
372                d
373              ),
374              k = f || i.data("featherlight-persisted") || new e(c, j);
375            k.persist === "shared" ? (f = k) : k.persist !== !1 && i.data("featherlight-persisted", k),
376              j.$currentTarget.blur && j.$currentTarget.blur(),
377              k.open(g);
378          };
379        return b.on(h.openTrigger + "." + h.namespace, h.filter, i), { filter: h.filter, handler: i };
380      },
381      current: function() {
382        var a = this.opened();
383        return a[a.length - 1] || null;
384      },
385      opened: function() {
386        var b = this;
387        return (
388          f(),
389          a.grep(e, function(a) {
390            return a instanceof b;
391          })
392        );
393      },
394      close: function(a) {
395        var b = this.current();
396        return b ? b.close(a) : void 0;
397      },
398      _onReady: function() {
399        var b = this;
400        if (b.autoBind) {
401          var c = a(b.autoBind);
402          c.each(function() {
403            b.attach(a(this));
404          }),
405            a(document).on("click", b.autoBind, function(d) {
406              if (!d.isDefaultPrevented()) {
407                var e = a(d.currentTarget),
408                  f = c.length;
409                if (((c = c.add(e)), f !== c.length)) {
410                  var g = b.attach(e);
411                  (!g.filter || a(d.target).parentsUntil(e, g.filter).length > 0) && g.handler(d);
412                }
413              }
414            });
415        }
416      },
417      _callbackChain: {
418        onKeyUp: function(b, c) {
419          return c.keyCode === 27 ? (this.closeOnEsc && a.featherlight.close(c), !1) : b(c);
420        },
421        beforeOpen: function(b, c) {
422          var height = document.body.style.height;
423          return (
424            document.body.style.height = 'auto',
425            document.body.dataset.height = height,
426            a(document.documentElement).addClass("with-featherlight"),
427            (this._previouslyActive = document.activeElement),
428            (this._$previouslyTabbable = a("a, input, select, textarea, iframe, button, iframe, [contentEditable=true]")
429              .not("[tabindex]")
430              .not(this.$instance.find("button"))),
431            (this._$previouslyWithTabIndex = a("[tabindex]").not('[tabindex="-1"]')),
432            (this._previousWithTabIndices = this._$previouslyWithTabIndex.map(function(b, c) {
433              return a(c).attr("tabindex");
434            })),
435            this._$previouslyWithTabIndex.add(this._$previouslyTabbable).attr("tabindex", -1),
436            document.activeElement.blur && document.activeElement.blur(),
437            b(c)
438          );
439        },
440        afterClose: function(c, d) {
441          var e = c(d),
442            f = this;
443          return (
444            this._$previouslyTabbable.removeAttr("tabindex"),
445            this._$previouslyWithTabIndex.each(function(b, c) {
446              a(c).attr("tabindex", f._previousWithTabIndices[b]);
447            }),
448            this._previouslyActive.focus(),
449            b.opened().length === 0 && a(document.documentElement).removeClass("with-featherlight"),
450            document.body.style.height = document.body.dataset.height,
451            delete document.body.dataset.height,
452            e
453          );
454        },
455        onResize: function(a, b) {
456          return this.resize(this.$content.naturalWidth, this.$content.naturalHeight), a(b);
457        },
458        afterContent: function(a, b) {
459          var c = a(b);
460          return this.$instance.find("[autofocus]:not([disabled])").focus(), this.onResize(b), c;
461        }
462      }
463    }),
464    (a.featherlight = b),
465    (a.fn.featherlight = function(a, c) {
466      return b.attach(this, a, c), this;
467    }),
468    a(document).ready(function() {
469      b._onReady();
470    });
471})(_4ORMAT.jQuery);

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.