PageSourceSearch

https://www.quagga-illustrations.de/wp-content/plugins/magic-toolt…/assets/js/jquery.modal.js?ver=2.0.55.1031

js quagga-illustrations.de collected 2026-10-02 11:33:01 UTC 8,101 bytes, 244 lines download raw bytes

vendor: 8,101 bytes, lines 1-244
1/*
2    A simple jQuery modalmm (http://github.com/kylefox/jquery-modalmm)
3    Version 0.9.1
4*/
5
6(function (factory) {
7  // Making your jQuery plugin work better with npm tools
8  // http://blog.npmjs.org/post/112712169830/making-your-jquery-plugin-work-better-with-npm
9  if(typeof module === "object" && typeof module.exports === "object") {
10    factory(require("jquery"), window, document);
11  }
12  else {
13    factory(jQuery, window, document);
14  }
15}(function($, window, document, undefined) {
16
17  var modalmms = [],
18      getCurrent = function() {
19        return modalmms.length ? modalmms[modalmms.length - 1] : null;
20      },
21      selectCurrent = function() {
22        var i,
23            selected = false;
24        for (i=modalmms.length-1; i>=0; i--) {
25          if (modalmms[i].$blocker) {
26            modalmms[i].$blocker.toggleClass('current_modal',!selected).toggleClass('behind',selected);
27            selected = true;
28          }
29        }
30      };
31
32  $.modalmm = function(el, options) {
33    var remove, target;
34    this.$body = $('body');
35    this.options = $.extend({}, $.modalmm.defaults, options);
36    this.options.doFade = !isNaN(parseInt(this.options.fadeDuration, 10));
37    this.$blocker = null;
38    if (this.options.closeExisting)
39      while ($.modalmm.isActive())
40        $.modalmm.close(); // Close any open modalmms.
41    modalmms.push(this);
42    if (el.is('a')) {
43      target = el.attr('href');
44      this.anchor = el;
45      //Select element by id from href
46      if (/^#/.test(target)) {
47        this.$elm = $(target);
48        if (this.$elm.length !== 1) return null;
49        this.$body.append(this.$elm);
50        this.open();
51      //AJAX
52      } else {
53        this.$elm = $('<div>');
54        this.$body.append(this.$elm);
55        remove = function(event, modalmm) { modalmm.elm.remove(); };
56        this.showSpinner();
57        el.trigger($.modalmm.AJAX_SEND);
58        $.get(target).done(function(html) {
59          if (!$.modalmm.isActive()) return;
60          el.trigger($.modalmm.AJAX_SUCCESS);
61          var current = getCurrent();
62          current.$elm.empty().append(html).on($.modalmm.CLOSE, remove);
63          current.hideSpinner();
64          current.open();
65          el.trigger($.modalmm.AJAX_COMPLETE);
66        }).fail(function() {
67          el.trigger($.modalmm.AJAX_FAIL);
68          var current = getCurrent();
69          current.hideSpinner();
70          modalmms.pop(); // remove expected modalmm from the list
71          el.trigger($.modalmm.AJAX_COMPLETE);
72        });
73      }
74    } else {
75      this.$elm = el;
76      this.anchor = el;
77      this.$body.append(this.$elm);
78      this.open();
79    }
80  };
81
82  $.modalmm.prototype = {
83    constructor: $.modalmm,
84
85    open: function() {
86      var m = this;
87      this.block();
88      this.anchor.blur();
89      if(this.options.doFade) {
90        setTimeout(function() {
91          m.show();
92        }, this.options.fadeDuration * this.options.fadeDelay);
93      } else {
94        this.show();
95      }
96      $(document).off('keydown.modalmm').on('keydown.modalmm', function(event) {
97        var current = getCurrent();
98        if (event.which === 27 && current.options.escapeClose) current.close();
99      });
100      if (this.options.clickClose)
101        this.$blocker.click(function(e) {
102          if (e.target === this)
103            $.modalmm.close();
104        });
105    },
106
107    close: function() {
108      modalmms.pop();
109      this.unblock();
110      this.hide();
111      if (!$.modalmm.isActive())
112        $(document).off('keydown.modalmm');
113    },
114
115    block: function() {
116      this.$elm.trigger($.modalmm.BEFORE_BLOCK, [this._ctx()]);
117      this.$body.css('overflow','hidden');
118      this.$blocker = $('<div class="' + this.options.blockerClass + ' blocker current_modal"></div>').appendTo(this.$body);
119      selectCurrent();
120      if(this.options.doFade) {
121        this.$blocker.css('opacity',0).animate({opacity: 1}, this.options.fadeDuration);
122      }
123      this.$elm.trigger($.modalmm.BLOCK, [this._ctx()]);
124    },
125
126    unblock: function(now) {
127      if (!now && this.options.doFade)
128        this.$blocker.fadeOut(this.options.fadeDuration, this.unblock.bind(this,true));
129      else {
130        this.$blocker.children().appendTo(this.$body);
131        this.$blocker.remove();
132        this.$blocker = null;
133        selectCurrent();
134        if (!$.modalmm.isActive())
135          this.$body.css('overflow','');
136      }
137    },
138
139    show: function() {
140      this.$elm.trigger($.modalmm.BEFORE_OPEN, [this._ctx()]);
141      if (this.options.showClose) {
142        this.closeButton = $('<a href="#close-modalmm" rel="modalmm:close" class="close-modalmm ' + this.options.closeClass + '">' + this.options.closeText + '</a>');
143        this.$elm.append(this.closeButton);
144      }
145      this.$elm.addClass(this.options.modalmmClass).appendTo(this.$blocker);
146      if(this.options.doFade) {
147        this.$elm.css({opacity: 0, display: 'inline-block'}).animate({opacity: 1}, this.options.fadeDuration);
148      } else {
149        this.$elm.css('display', 'inline-block');
150      }
151      this.$elm.trigger($.modalmm.OPEN, [this._ctx()]);
152    },
153
154    hide: function() {
155      this.$elm.trigger($.modalmm.BEFORE_CLOSE, [this._ctx()]);
156      if (this.closeButton) this.closeButton.remove();
157      var _this = this;
158      if(this.options.doFade) {
159        this.$elm.fadeOut(this.options.fadeDuration, function () {
160          _this.$elm.trigger($.modalmm.AFTER_CLOSE, [_this._ctx()]);
161        });
162      } else {
163        this.$elm.hide(0, function () {
164          _this.$elm.trigger($.modalmm.AFTER_CLOSE, [_this._ctx()]);
165        });
166      }
167      this.$elm.trigger($.modalmm.CLOSE, [this._ctx()]);
168    },
169
170    showSpinner: function() {
171      if (!this.options.showSpinner) return;
172      this.spinner = this.spinner || $('<div class="' + this.options.modalmmClass + '-spinner"></div>')
173        .append(this.options.spinnerHtml);
174      this.$body.append(this.spinner);
175      this.spinner.show();
176    },
177
178    hideSpinner: function() {
179      if (this.spinner) this.spinner.remove();
180    },
181
182    //Return context for custom events
183    _ctx: function() {
184      return { elm: this.$elm, $elm: this.$elm, $blocker: this.$blocker, options: this.options };
185    }
186  };
187
188  $.modalmm.close = function(event) {
189    if (!$.modalmm.isActive()) return;
190    if (event) event.preventDefault();
191    var current = getCurrent();
192    current.close();
193    return current.$elm;
194  };
195
196  // Returns if there currently is an active modalmm
197  $.modalmm.isActive = function () {
198    return modalmms.length > 0;
199  };
200
201  $.modalmm.getCurrent = getCurrent;
202
203  $.modalmm.defaults = {
204    closeExisting: true,
205    escapeClose: true,
206    clickClose: true,
207    closeText: 'Close',
208    closeClass: '',
209    modalmmClass: "modalmm",
210    blockerClass: "jquery-modalmm",
211    spinnerHtml: '<div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div>',
212    showSpinner: true,
213    showClose: true,
214    fadeDuration: null,   // Number of milliseconds the fade animation takes.
215    fadeDelay: 1.0        // Point during the overlay's fade-in that the modalmm begins to fade in (.5 = 50%, 1.5 = 150%, etc.)
216  };
217
218  // Event constants
219  $.modalmm.BEFORE_BLOCK = 'modalmm:before-block';
220  $.modalmm.BLOCK = 'modalmm:block';
221  $.modalmm.BEFORE_OPEN = 'modalmm:before-open';
222  $.modalmm.OPEN = 'modalmm:open';
223  $.modalmm.BEFORE_CLOSE = 'modalmm:before-close';
224  $.modalmm.CLOSE = 'modalmm:close';
225  $.modalmm.AFTER_CLOSE = 'modalmm:after-close';
226  $.modalmm.AJAX_SEND = 'modalmm:ajax:send';
227  $.modalmm.AJAX_SUCCESS = 'modalmm:ajax:success';
228  $.modalmm.AJAX_FAIL = 'modalmm:ajax:fail';
229  $.modalmm.AJAX_COMPLETE = 'modalmm:ajax:complete';
230
231  $.fn.modalmm = function(options){
232    if (this.length === 1) {
233      new $.modalmm(this, options);
234    }
235    return this;
236  };
237
238  // Automatically bind links with rel="modalmm:close" to, well, close the modalmm.
239  $(document).on('click.modalmm', 'a[rel~="modalmm:close"]', $.modalmm.close);
240  $(document).on('click.modalmm', 'a[rel~="modalmm:open"]', function(event) {
241    event.preventDefault();
242    $(this).modalmm();
243  });
244}));

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.