PageSourceSearch

https://www.nakivo.com/blog/wp-content/themes/nakivo/js/bootstrap.js

js nakivo.com collected 2026-09-24 15:21:00 UTC 12,746 bytes, 383 lines download raw bytes

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