PageSourceSearch

https://www.smg.hu/wp-content/plugins/modal-for-elementor/js/bootstrap.js

js smg.hu collected 2026-09-25 11:24:57 UTC 11,494 bytes, 387 lines download raw bytes

vendor: 11,494 bytes, lines 1-387
1/*!
2 * Bootstrap v3.3.6 (http://getbootstrap.com)
3 * Copyright 2011-2015 Twitter, Inc.
4 * Licensed under the MIT license
5 */
6// Code extracted from Bootstrap and refactored for our needs
7
8+function ($) {
9  'use strict';
10
11  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
12  // ============================================================
13
14  function transitionEnd() {
15    var el = document.createElement('bootstrap')
16
17    var transEndEventNames = {
18      WebkitTransition : 'webkitTransitionEnd',
19      MozTransition    : 'transitionend',
20      OTransition      : 'oTransitionEnd otransitionend',
21      transition       : 'transitionend'
22    }
23
24    for (var name in transEndEventNames) {
25      if (el.style[name] !== undefined) {
26        return { end: transEndEventNames[name] }
27      }
28    }
29
30    return false // explicit for ie8 (  ._.)
31  }
32
33  // http://blog.alexmaccaw.com/css-transitions
34  $.fn.emulateTransitionEnd = function (duration) {
35    var called = false
36    var $el = this
37    $(this).one('bsTransitionEnd', function () { called = true })
38    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
39    setTimeout(callback, duration)
40    return this
41  }
42
43  $(function () {
44    $.support.transition = transitionEnd()
45
46    if (!$.support.transition) return
47
48    $.event.special.bsTransitionEnd = {
49      bindType: $.support.transition.end,
50      delegateType: $.support.transition.end,
51      handle: function (e) {
52        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
53      }
54    }
55  })
56
57}(jQuery);
58
59
60+function ($) {
61  'use strict';
62
63  // MODAL CLASS DEFINITION
64  // ======================
65
66  var Modal = function (element, options) {
67    this.options             = options
68    this.$body               = $(document.body)
69    this.$element            = $(element)
70    this.$dialog             = this.$element.find('.modal-dialog')
71    this.$backdrop           = null
72    this.isShown             = null
73    this.originalBodyPad     = null
74    this.scrollbarWidth      = 0
75    this.ignoreBackdropClick = false
76
77    if (this.options.remote) {
78      this.$element
79        .find('.modal-content')
80        .load(this.options.remote, $.proxy(function () {
81          this.$element.trigger('loaded.bs.modal')
82        }, this))
83    }
84  }
85
86  Modal.VERSION  = '3.3.6'
87
88  Modal.TRANSITION_DURATION = 300
89  Modal.BACKDROP_TRANSITION_DURATION = 150
90
91  Modal.DEFAULTS = {
92    backdrop: true,
93    keyboard: true,
94    show: true
95  }
96
97  Modal.prototype.toggle = function (_relatedTarget) {
98    return this.isShown ? this.hide() : this.show(_relatedTarget)
99  }
100
101  Modal.prototype.show = function (_relatedTarget) {
102    var that = this
103    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
104
105    this.$element.trigger(e)
106
107    if (this.isShown || e.isDefaultPrevented()) return
108
109    this.isShown = true
110
111    this.checkScrollbar()
112    this.setScrollbar()
113    this.$body.addClass('modal-open')
114
115    this.escape()
116    this.resize()
117
118    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
119
120    this.$dialog.on('mousedown.dismiss.bs.modal', function () {
121      that.$element.one('mouseup.dismiss.bs.modal', function (e) {
122        if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
123      })
124    })
125
126    this.backdrop(function () {
127      var transition = $.support.transition && that.$element.hasClass('fade')
128
129      if (!that.$element.parent().length) {
130        that.$element.appendTo(that.$body) // don't move modals dom position
131      }
132
133      that.$element
134        .show()
135        .scrollTop(0)
136
137      that.adjustDialog()
138
139      if (transition) {
140        that.$element[0].offsetWidth // force reflow
141      }
142
143      that.$element.addClass('in')
144
145      that.enforceFocus()
146
147      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
148
149      transition ?
150        that.$dialog // wait for modal to slide in
151          .one('bsTransitionEnd', function () {
152            that.$element.trigger('focus').trigger(e)
153          })
154          .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
155        that.$element.trigger('focus').trigger(e)
156    })
157  }
158
159  Modal.prototype.hide = function (e) {
160    if (e) e.preventDefault()
161
162    e = $.Event('hide.bs.modal')
163
164    this.$element.trigger(e)
165
166    if (!this.isShown || e.isDefaultPrevented()) return
167
168    this.isShown = false
169
170    this.escape()
171    this.resize()
172
173    $(document).off('focusin.bs.modal')
174
175    this.$element
176      .removeClass('in')
177      .off('click.dismiss.bs.modal')
178      .off('mouseup.dismiss.bs.modal')
179
180    this.$dialog.off('mousedown.dismiss.bs.modal')
181
182    $.support.transition && this.$element.hasClass('fade') ?
183      this.$element
184        .one('bsTransitionEnd', $.proxy(this.hideModal, this))
185        .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
186      this.hideModal()
187  }
188
189  Modal.prototype.enforceFocus = function () {
190    $(document)
191      .off('focusin.bs.modal') // guard against infinite focus loop
192      .on('focusin.bs.modal', $.proxy(function (e) {
193        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
194          this.$element.trigger('focus')
195        }
196      }, this))
197  }
198
199  Modal.prototype.escape = function () {
200    if (this.isShown && this.options.keyboard) {
201      this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
202        e.which == 27 && this.hide()
203      }, this))
204    } else if (!this.isShown) {
205      this.$element.off('keydown.dismiss.bs.modal')
206    }
207  }
208
209  Modal.prototype.resize = function () {
210    if (this.isShown) {
211      $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
212    } else {
213      $(window).off('resize.bs.modal')
214    }
215  }
216
217  Modal.prototype.hideModal = function () {
218    var that = this
219    this.$element.hide()
220    this.backdrop(function () {
221      that.$body.removeClass('modal-open')
222      that.resetAdjustments()
223      that.resetScrollbar()
224      that.$element.trigger('hidden.bs.modal')
225    })
226  }
227
228  Modal.prototype.removeBackdrop = function () {
229    this.$backdrop && this.$backdrop.remove()
230    this.$backdrop = null
231  }
232
233  Modal.prototype.backdrop = function (callback) {
234    var that = this
235    var animate = this.$element.hasClass('fade') ? 'fade' : ''
236
237    if (this.isShown && this.options.backdrop) {
238      var doAnimate = $.support.transition && animate
239
240      this.$backdrop = $(document.createElement('div'))
241        .addClass('modal-backdrop ' + animate)
242        .appendTo(this.$body)
243
244      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
245        if (this.ignoreBackdropClick) {
246          this.ignoreBackdropClick = false
247          return
248        }
249        if (e.target !== e.currentTarget) return
250        this.options.backdrop == 'static'
251          ? this.$element[0].focus()
252          : this.hide()
253      }, this))
254
255      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
256
257      this.$backdrop.addClass('in')
258
259      if (!callback) return
260
261      doAnimate ?
262        this.$backdrop
263          .one('bsTransitionEnd', callback)
264          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
265        callback()
266
267    } else if (!this.isShown && this.$backdrop) {
268      this.$backdrop.removeClass('in')
269
270      var callbackRemove = function () {
271        that.removeBackdrop()
272        callback && callback()
273      }
274      $.support.transition && this.$element.hasClass('fade') ?
275        this.$backdrop
276          .one('bsTransitionEnd', callbackRemove)
277          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
278        callbackRemove()
279
280    } else if (callback) {
281      callback()
282    }
283  }
284
285  // these following methods are used to handle overflowing modals
286
287  Modal.prototype.handleUpdate = function () {
288    this.adjustDialog()
289  }
290
291  Modal.prototype.adjustDialog = function () {
292    var lmmodalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight
293
294    this.$element.css({
295      paddingLeft:  !this.bodyIsOverflowing && lmmodalIsOverflowing ? this.scrollbarWidth : '',
296      paddingRight: this.bodyIsOverflowing && !lmmodalIsOverflowing ? this.scrollbarWidth : ''
297    })
298  }
299
300  Modal.prototype.resetAdjustments = function () {
301    this.$element.css({
302      paddingLeft: '',
303      paddingRight: ''
304    })
305  }
306
307  Modal.prototype.checkScrollbar = function () {
308    var fullWindowWidth = window.innerWidth
309    if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
310      var documentElementRect = document.documentElement.getBoundingClientRect()
311      fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
312    }
313    this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
314    this.scrollbarWidth = this.measureScrollbar()
315  }
316
317  Modal.prototype.setScrollbar = function () {
318    var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
319    this.originalBodyPad = document.body.style.paddingRight || ''
320    if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
321  }
322
323  Modal.prototype.resetScrollbar = function () {
324    this.$body.css('padding-right', this.originalBodyPad)
325  }
326
327  Modal.prototype.measureScrollbar = function () { // thx walsh
328    var scrollDiv = document.createElement('div')
329    scrollDiv.className = 'modal-scrollbar-measure'
330    this.$body.append(scrollDiv)
331    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
332    this.$body[0].removeChild(scrollDiv)
333    return scrollbarWidth
334  }
335
336
337  // MODAL PLUGIN DEFINITION
338  // =======================
339
340  function Plugin(option, _relatedTarget) {
341    return this.each(function () {
342      var $this   = $(this)
343      var data    = $this.data('bs.modal')
344      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
345
346      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
347      if (typeof option == 'string') data[option](_relatedTarget)
348      else if (options.show) data.show(_relatedTarget)
349    })
350  }
351
352  var old = $.fn.modal
353
354  $.fn.modal             = Plugin
355  $.fn.modal.Constructor = Modal
356
357
358  // MODAL NO CONFLICT
359  // =================
360
361  $.fn.modal.noConflict = function () {
362    $.fn.modal = old
363    return this
364  }
365
366
367  // MODAL DATA-API
368  // ==============
369
370  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
371    var $this   = $(this)
372    var href    = $this.attr('href')
373    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
374    var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
375
376    if ($this.is('a')) e.preventDefault()
377
378    $target.one('show.bs.modal', function (showEvent) {
379      if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
380      $target.one('hidden.bs.modal', function () {
381        $this.is(':visible') && $this.trigger('focus')
382      })
383    })
384    Plugin.call($target, option, this)
385  })
386
387}(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.