Maintenance : Bump bootstrap to 3.4.1

This commit is contained in:
Bola Ahmed Buari 2022-02-08 19:27:15 +01:00
parent ac3e020ef9
commit ffb958d22d
8 changed files with 469 additions and 223 deletions

View file

@ -1,8 +1,8 @@
/* ======================================================================== /* ========================================================================
* Bootstrap: button.js v3.3.1 * Bootstrap: button.js v3.4.1
* http://getbootstrap.com/javascript/#buttons * https://getbootstrap.com/docs/3.4/javascript/#buttons
* ======================================================================== * ========================================================================
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */ * ======================================================================== */
@ -19,7 +19,7 @@
this.isLoading = false this.isLoading = false
} }
Button.VERSION = '3.3.1' Button.VERSION = '3.4.1'
Button.DEFAULTS = { Button.DEFAULTS = {
loadingText: 'loading...' loadingText: 'loading...'
@ -31,7 +31,7 @@
var val = $el.is('input') ? 'val' : 'html' var val = $el.is('input') ? 'val' : 'html'
var data = $el.data() var data = $el.data()
state = state + 'Text' state += 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]()) if (data.resetText == null) $el.data('resetText', $el[val]())
@ -41,10 +41,10 @@
if (state == 'loadingText') { if (state == 'loadingText') {
this.isLoading = true this.isLoading = true
$el.addClass(d).attr(d, d) $el.addClass(d).attr(d, d).prop(d, true)
} else if (this.isLoading) { } else if (this.isLoading) {
this.isLoading = false this.isLoading = false
$el.removeClass(d).removeAttr(d) $el.removeClass(d).removeAttr(d).prop(d, false)
} }
}, this), 0) }, this), 0)
} }
@ -56,12 +56,18 @@
if ($parent.length) { if ($parent.length) {
var $input = this.$element.find('input') var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') { if ($input.prop('type') == 'radio') {
if ($input.prop('checked') && this.$element.hasClass('active')) changed = false if ($input.prop('checked')) changed = false
else $parent.find('.active').removeClass('active') $parent.find('.active').removeClass('active')
this.$element.addClass('active')
} else if ($input.prop('type') == 'checkbox') {
if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
this.$element.toggleClass('active')
} }
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') $input.prop('checked', this.$element.hasClass('active'))
if (changed) $input.trigger('change')
} else { } else {
this.$element.attr('aria-pressed', !this.$element.hasClass('active')) this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
this.$element.toggleClass('active')
} }
if (changed) this.$element.toggleClass('active') if (changed) this.$element.toggleClass('active')
@ -104,10 +110,15 @@
$(document) $(document)
.on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target) var $btn = $(e.target).closest('.btn')
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle') Plugin.call($btn, 'toggle')
e.preventDefault() if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
// Prevent double click on radios, and the double selections (so cancellation) on checkboxes
e.preventDefault()
// The target component still receive the focus
if ($btn.is('input,button')) $btn.trigger('focus')
else $btn.find('input:visible,button:visible').first().trigger('focus')
}
}) })
.on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
$(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))

View file

@ -1,11 +1,12 @@
/* ======================================================================== /* ========================================================================
* Bootstrap: collapse.js v3.3.1 * Bootstrap: collapse.js v3.4.1
* http://getbootstrap.com/javascript/#collapse * https://getbootstrap.com/docs/3.4/javascript/#collapse
* ======================================================================== * ========================================================================
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */ * ======================================================================== */
/* jshint latedef: false */
+function ($) { +function ($) {
'use strict'; 'use strict';
@ -16,7 +17,8 @@
var Collapse = function (element, options) { var Collapse = function (element, options) {
this.$element = $(element) this.$element = $(element)
this.options = $.extend({}, Collapse.DEFAULTS, options) this.options = $.extend({}, Collapse.DEFAULTS, options)
this.$trigger = $(this.options.trigger).filter('[href="#' + element.id + '"], [data-target="#' + element.id + '"]') this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
'[data-toggle="collapse"][data-target="#' + element.id + '"]')
this.transitioning = null this.transitioning = null
if (this.options.parent) { if (this.options.parent) {
@ -28,13 +30,12 @@
if (this.options.toggle) this.toggle() if (this.options.toggle) this.toggle()
} }
Collapse.VERSION = '3.3.1' Collapse.VERSION = '3.4.1'
Collapse.TRANSITION_DURATION = 350 Collapse.TRANSITION_DURATION = 350
Collapse.DEFAULTS = { Collapse.DEFAULTS = {
toggle: true, toggle: true
trigger: '[data-toggle="collapse"]'
} }
Collapse.prototype.dimension = function () { Collapse.prototype.dimension = function () {
@ -46,7 +47,7 @@
if (this.transitioning || this.$element.hasClass('in')) return if (this.transitioning || this.$element.hasClass('in')) return
var activesData var activesData
var actives = this.$parent && this.$parent.find('> .panel').children('.in, .collapsing') var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
if (actives && actives.length) { if (actives && actives.length) {
activesData = actives.data('bs.collapse') activesData = actives.data('bs.collapse')
@ -136,7 +137,7 @@
} }
Collapse.prototype.getParent = function () { Collapse.prototype.getParent = function () {
return $(this.options.parent) return $(document).find(this.options.parent)
.find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
.each($.proxy(function (i, element) { .each($.proxy(function (i, element) {
var $element = $(element) var $element = $(element)
@ -159,7 +160,7 @@
var target = $trigger.attr('data-target') var target = $trigger.attr('data-target')
|| (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
return $(target) return $(document).find(target)
} }
@ -172,7 +173,7 @@
var data = $this.data('bs.collapse') var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && option == 'show') options.toggle = false if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]() if (typeof option == 'string') data[option]()
}) })
@ -203,7 +204,7 @@
var $target = getTargetFromTrigger($this) var $target = getTargetFromTrigger($this)
var data = $target.data('bs.collapse') var data = $target.data('bs.collapse')
var option = data ? 'toggle' : $.extend({}, $this.data(), { trigger: this }) var option = data ? 'toggle' : $this.data()
Plugin.call($target, option) Plugin.call($target, option)
}) })

View file

@ -1,8 +1,8 @@
/* ======================================================================== /* ========================================================================
* Bootstrap: dropdown.js v3.3.1 * Bootstrap: dropdown.js v3.4.1
* http://getbootstrap.com/javascript/#dropdowns * https://getbootstrap.com/docs/3.4/javascript/#dropdowns
* ======================================================================== * ========================================================================
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */ * ======================================================================== */
@ -19,7 +19,41 @@
$(element).on('click.bs.dropdown', this.toggle) $(element).on('click.bs.dropdown', this.toggle)
} }
Dropdown.VERSION = '3.3.1' Dropdown.VERSION = '3.4.1'
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = selector !== '#' ? $(document).find(selector) : null
return $parent && $parent.length ? $parent : $this.parent()
}
function clearMenus(e) {
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
var $this = $(this)
var $parent = getParent($this)
var relatedTarget = { relatedTarget: this }
if (!$parent.hasClass('open')) return
if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
})
}
Dropdown.prototype.toggle = function (e) { Dropdown.prototype.toggle = function (e) {
var $this = $(this) var $this = $(this)
@ -34,7 +68,10 @@
if (!isActive) { if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we use a backdrop because click events don't delegate // if mobile we use a backdrop because click events don't delegate
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus) $(document.createElement('div'))
.addClass('dropdown-backdrop')
.insertAfter($(this))
.on('click', clearMenus)
} }
var relatedTarget = { relatedTarget: this } var relatedTarget = { relatedTarget: this }
@ -48,7 +85,7 @@
$parent $parent
.toggleClass('open') .toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget) .trigger($.Event('shown.bs.dropdown', relatedTarget))
} }
return false return false
@ -67,57 +104,25 @@
var $parent = getParent($this) var $parent = getParent($this)
var isActive = $parent.hasClass('open') var isActive = $parent.hasClass('open')
if ((!isActive && e.which != 27) || (isActive && e.which == 27)) { if (!isActive && e.which != 27 || isActive && e.which == 27) {
if (e.which == 27) $parent.find(toggle).trigger('focus') if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.trigger('click') return $this.trigger('click')
} }
var desc = ' li:not(.divider):visible a' var desc = ' li:not(.disabled):visible a'
var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc) var $items = $parent.find('.dropdown-menu' + desc)
if (!$items.length) return if (!$items.length) return
var index = $items.index(e.target) var index = $items.index(e.target)
if (e.which == 38 && index > 0) index-- // up if (e.which == 38 && index > 0) index-- // up
if (e.which == 40 && index < $items.length - 1) index++ // down if (e.which == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0 if (!~index) index = 0
$items.eq(index).trigger('focus') $items.eq(index).trigger('focus')
} }
function clearMenus(e) {
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
var $this = $(this)
var $parent = getParent($this)
var relatedTarget = { relatedTarget: this }
if (!$parent.hasClass('open')) return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this.attr('aria-expanded', 'false')
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = selector && $(selector)
return $parent && $parent.length ? $parent : $this.parent()
}
// DROPDOWN PLUGIN DEFINITION // DROPDOWN PLUGIN DEFINITION
// ========================== // ==========================
@ -155,7 +160,6 @@
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)
.on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown)
}(jQuery); }(jQuery);

View file

@ -1,8 +1,8 @@
/* ======================================================================== /* ========================================================================
* Bootstrap: modal.js v3.3.1 * Bootstrap: modal.js v3.4.1
* http://getbootstrap.com/javascript/#modals * https://getbootstrap.com/docs/3.4/javascript/#modals
* ======================================================================== * ========================================================================
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */ * ======================================================================== */
@ -23,12 +23,16 @@
// ====================== // ======================
var Modal = function (element, options) { var Modal = function (element, options) {
this.options = options this.options = options
this.$body = $(options.container || document.body) this.$body = $(options.container || document.body)
this.$element = $(element) this.$element = $(element)
this.$backdrop = this.$dialog = this.$element.find('.modal-dialog')
this.isShown = null this.$backdrop = null
this.isShown = null
this.originalBodyPad = null
this.scrollbarWidth = 0 this.scrollbarWidth = 0
this.ignoreBackdropClick = false
this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom'
if (this.options.remote) { if (this.options.remote) {
this.$element this.$element
@ -39,7 +43,7 @@
} }
} }
Modal.VERSION = '3.3.1' Modal.VERSION = '3.4.1'
Modal.TRANSITION_DURATION = 300 Modal.TRANSITION_DURATION = 300
Modal.BACKDROP_TRANSITION_DURATION = 150 Modal.BACKDROP_TRANSITION_DURATION = 150
@ -56,7 +60,7 @@
Modal.prototype.show = function (_relatedTarget) { Modal.prototype.show = function (_relatedTarget) {
var that = this var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e) this.$element.trigger(e)
@ -74,6 +78,12 @@
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.$dialog.on('mousedown.dismiss.bs.modal', function () {
that.$element.one('mouseup.dismiss.bs.modal', function (e) {
if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
})
})
this.backdrop(function () { this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade') var transition = $.support.transition && that.$element.hasClass('fade')
@ -86,22 +96,19 @@
.scrollTop(0) .scrollTop(0)
that.adjustDialog() that.adjustDialog()
if (that.options.backdrop) that.adjustBackdrop()
if (transition) { if (transition) {
that.$element[0].offsetWidth // force reflow that.$element[0].offsetWidth // force reflow
} }
that.$element that.$element.addClass('in')
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus() that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ? transition ?
that.$element.find('.modal-dialog') // wait for modal to slide in that.$dialog // wait for modal to slide in
.one('bsTransitionEnd', function () { .one('bsTransitionEnd', function () {
that.$element.trigger('focus').trigger(e) that.$element.trigger('focus').trigger(e)
}) })
@ -128,8 +135,10 @@
this.$element this.$element
.removeClass('in') .removeClass('in')
.attr('aria-hidden', true)
.off('click.dismiss.bs.modal') .off('click.dismiss.bs.modal')
.off('mouseup.dismiss.bs.modal')
this.$dialog.off('mousedown.dismiss.bs.modal')
$.support.transition && this.$element.hasClass('fade') ? $.support.transition && this.$element.hasClass('fade') ?
this.$element this.$element
@ -142,7 +151,9 @@
$(document) $(document)
.off('focusin.bs.modal') // guard against infinite focus loop .off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) { .on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { if (document !== e.target &&
this.$element[0] !== e.target &&
!this.$element.has(e.target).length) {
this.$element.trigger('focus') this.$element.trigger('focus')
} }
}, this)) }, this))
@ -201,14 +212,20 @@
if (this.isShown && this.options.backdrop) { if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') this.$backdrop = $(document.createElement('div'))
.prependTo(this.$element) .addClass('modal-backdrop ' + animate)
.on('click.dismiss.bs.modal', $.proxy(function (e) { .appendTo(this.$body)
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static' this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
? this.$element[0].focus.call(this.$element[0]) if (this.ignoreBackdropClick) {
: this.hide.call(this) this.ignoreBackdropClick = false
}, this)) return
}
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus()
: this.hide()
}, this))
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
@ -244,13 +261,6 @@
Modal.prototype.handleUpdate = function () { Modal.prototype.handleUpdate = function () {
this.adjustDialog() this.adjustDialog()
if (this.options.backdrop) this.adjustBackdrop()
}
Modal.prototype.adjustBackdrop = function () {
this.$backdrop
.css('height', 0)
.css('height', this.$element[0].scrollHeight)
} }
Modal.prototype.adjustDialog = function () { Modal.prototype.adjustDialog = function () {
@ -259,7 +269,7 @@
left: this.$body.offset().left, left: this.$body.offset().left,
top: Math.max(0, this.$body.offset().top), top: Math.max(0, this.$body.offset().top),
width: this.$body.width(), width: this.$body.width(),
paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing && this.scrollbarWidth > 0 ? this.scrollbarWidth : '', paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing && this.scrollbarWidth > 0 ? this.scrollbarWidth : '',
paddingRight: this.bodyIsOverflowing && !modalIsOverflowing && this.scrollbarWidth > 0 ? this.scrollbarWidth : '' paddingRight: this.bodyIsOverflowing && !modalIsOverflowing && this.scrollbarWidth > 0 ? this.scrollbarWidth : ''
} }
@ -281,17 +291,38 @@
} }
Modal.prototype.checkScrollbar = function () { Modal.prototype.checkScrollbar = function () {
this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight var fullWindowWidth = window.innerWidth
if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
var documentElementRect = document.documentElement.getBoundingClientRect()
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
}
this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
this.scrollbarWidth = this.measureScrollbar() this.scrollbarWidth = this.measureScrollbar()
} }
Modal.prototype.setScrollbar = function () { Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) this.originalBodyPad = document.body.style.paddingRight || ''
var scrollbarWidth = this.scrollbarWidth
if (this.bodyIsOverflowing) {
this.$body.css('padding-right', bodyPad + scrollbarWidth)
$(this.fixedContent).each(function (index, element) {
var actualPadding = element.style.paddingRight
var calculatedPadding = $(element).css('padding-right')
$(element)
.data('padding-right', actualPadding)
.css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px')
})
}
} }
Modal.prototype.resetScrollbar = function () { Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', '') this.$body.css('padding-right', this.originalBodyPad)
$(this.fixedContent).each(function (index, element) {
var padding = $(element).data('padding-right')
$(element).removeData('padding-right')
element.style.paddingRight = padding ? padding : ''
})
} }
Modal.prototype.measureScrollbar = function () { // thx walsh Modal.prototype.measureScrollbar = function () { // thx walsh
@ -309,8 +340,8 @@
function Plugin(option, _relatedTarget) { function Plugin(option, _relatedTarget) {
return this.each(function () { return this.each(function () {
var $this = $(this) var $this = $(this)
var data = $this.data('bs.modal') var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options))) if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
@ -321,7 +352,7 @@
var old = $.fn.modal var old = $.fn.modal
$.fn.modal = Plugin $.fn.modal = Plugin
$.fn.modal.Constructor = Modal $.fn.modal.Constructor = Modal
@ -338,10 +369,13 @@
// ============== // ==============
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this) var $this = $(this)
var href = $this.attr('href') var href = $this.attr('href')
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 var target = $this.attr('data-target') ||
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
var $target = $(document).find(target)
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault() if ($this.is('a')) e.preventDefault()

View file

@ -1,8 +1,8 @@
/* ======================================================================== /* ========================================================================
* Bootstrap: popover.js v3.3.1 * Bootstrap: popover.js v3.4.1
* http://getbootstrap.com/javascript/#popovers * https://getbootstrap.com/docs/3.4/javascript/#popovers
* ======================================================================== * ========================================================================
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */ * ======================================================================== */
@ -19,13 +19,13 @@
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.3.1' Popover.VERSION = '3.4.1'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right', placement: 'right',
trigger: 'click', trigger: 'click',
content: '', content: '',
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h2 class="popover-title"></h2><div class="popover-content"></div></div>' template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
}) })
@ -45,10 +45,25 @@
var title = this.getTitle() var title = this.getTitle()
var content = this.getContent() var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) if (this.options.html) {
$tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events var typeContent = typeof content
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
](content) if (this.options.sanitize) {
title = this.sanitizeHtml(title)
if (typeContent === 'string') {
content = this.sanitizeHtml(content)
}
}
$tip.find('.popover-title').html(title)
$tip.find('.popover-content').children().detach().end()[
typeContent === 'string' ? 'html' : 'append'
](content)
} else {
$tip.find('.popover-title').text(title)
$tip.find('.popover-content').children().detach().end().text(content)
}
$tip.removeClass('fade top bottom left right in') $tip.removeClass('fade top bottom left right in')
@ -67,37 +82,26 @@
return $e.attr('data-content') return $e.attr('data-content')
|| (typeof o.content == 'function' ? || (typeof o.content == 'function' ?
o.content.call($e[0]) : o.content.call($e[0]) :
o.content) o.content)
} }
Popover.prototype.arrow = function () { Popover.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.arrow')) return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
} }
Popover.prototype.tip = function () {
if (!this.$tip) this.$tip = $(this.options.template)
return this.$tip
}
// POPOVER PLUGIN DEFINITION // POPOVER PLUGIN DEFINITION
// ========================= // =========================
function Plugin(option) { function Plugin(option) {
return this.each(function () { return this.each(function () {
var $this = $(this) var $this = $(this)
var data = $this.data('bs.popover') var data = $this.data('bs.popover')
var options = typeof option == 'object' && option var options = typeof option == 'object' && option
var selector = options && options.selector
if (!data && option == 'destroy') return if (!data && /destroy|hide/.test(option)) return
if (selector) { if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (!data) $this.data('bs.popover', (data = {}))
if (!data[selector]) data[selector] = new Popover(this, options)
} else {
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
}
if (typeof option == 'string') data[option]() if (typeof option == 'string') data[option]()
}) })
} }

View file

@ -1,8 +1,8 @@
/* ======================================================================== /* ========================================================================
* Bootstrap: tab.js v3.3.1 * Bootstrap: tab.js v3.4.1
* http://getbootstrap.com/javascript/#tabs * https://getbootstrap.com/docs/3.4/javascript/#tabs
* ======================================================================== * ========================================================================
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */ * ======================================================================== */
@ -14,10 +14,12 @@
// ==================== // ====================
var Tab = function (element) { var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element) this.element = $(element)
// jscs:enable requireDollarBeforejQueryAssignment
} }
Tab.VERSION = '3.3.1' Tab.VERSION = '3.4.1'
Tab.TRANSITION_DURATION = 150 Tab.TRANSITION_DURATION = 150
@ -46,7 +48,7 @@
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
var $target = $(selector) var $target = $(document).find(selector)
this.activate($this.closest('li'), $ul) this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () { this.activate($target, $target.parent(), function () {
@ -65,21 +67,21 @@
var $active = container.find('> .active') var $active = container.find('> .active')
var transition = callback var transition = callback
&& $.support.transition && $.support.transition
&& (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length) && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
function next() { function next() {
$active $active
.removeClass('active') .removeClass('active')
.find('> .dropdown-menu > .active') .find('> .dropdown-menu > .active')
.removeClass('active') .removeClass('active')
.end() .end()
.find('[data-toggle="tab"]') .find('[data-toggle="tab"]')
.attr('aria-expanded', false) .attr('aria-expanded', false)
element element
.addClass('active') .addClass('active')
.find('[data-toggle="tab"]') .find('[data-toggle="tab"]')
.attr('aria-expanded', true) .attr('aria-expanded', true)
if (transition) { if (transition) {
element[0].offsetWidth // reflow for transition element[0].offsetWidth // reflow for transition
@ -88,13 +90,13 @@
element.removeClass('fade') element.removeClass('fade')
} }
if (element.parent('.dropdown-menu')) { if (element.parent('.dropdown-menu').length) {
element element
.closest('li.dropdown') .closest('li.dropdown')
.addClass('active') .addClass('active')
.end() .end()
.find('[data-toggle="tab"]') .find('[data-toggle="tab"]')
.attr('aria-expanded', true) .attr('aria-expanded', true)
} }
callback && callback() callback && callback()

View file

@ -1,9 +1,9 @@
/* ======================================================================== /* ========================================================================
* Bootstrap: tooltip.js v3.3.1 * Bootstrap: tooltip.js v3.4.1
* http://getbootstrap.com/javascript/#tooltip * https://getbootstrap.com/docs/3.4/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame * Inspired by the original jQuery.tipsy by Jason Frame
* ======================================================================== * ========================================================================
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */ * ======================================================================== */
@ -11,21 +11,153 @@
+function ($) { +function ($) {
'use strict'; 'use strict';
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']
var uriAttrs = [
'background',
'cite',
'href',
'itemtype',
'longdesc',
'poster',
'src',
'xlink:href'
]
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
var DefaultWhitelist = {
// Global attributes allowed on any supplied element below.
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
a: ['target', 'href', 'title', 'rel'],
area: [],
b: [],
br: [],
col: [],
code: [],
div: [],
em: [],
hr: [],
h1: [],
h2: [],
h3: [],
h4: [],
h5: [],
h6: [],
i: [],
img: ['src', 'alt', 'title', 'width', 'height'],
li: [],
ol: [],
p: [],
pre: [],
s: [],
small: [],
span: [],
sub: [],
sup: [],
strong: [],
u: [],
ul: []
}
/**
* A pattern that recognizes a commonly useful subset of URLs that are safe.
*
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
*/
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi
/**
* A pattern that matches safe data URLs. Only matches image, video and audio types.
*
* Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
*/
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i
function allowedAttribute(attr, allowedAttributeList) {
var attrName = attr.nodeName.toLowerCase()
if ($.inArray(attrName, allowedAttributeList) !== -1) {
if ($.inArray(attrName, uriAttrs) !== -1) {
return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
}
return true
}
var regExp = $(allowedAttributeList).filter(function (index, value) {
return value instanceof RegExp
})
// Check if a regular expression validates the attribute.
for (var i = 0, l = regExp.length; i < l; i++) {
if (attrName.match(regExp[i])) {
return true
}
}
return false
}
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
if (unsafeHtml.length === 0) {
return unsafeHtml
}
if (sanitizeFn && typeof sanitizeFn === 'function') {
return sanitizeFn(unsafeHtml)
}
// IE 8 and below don't support createHTMLDocument
if (!document.implementation || !document.implementation.createHTMLDocument) {
return unsafeHtml
}
var createdDocument = document.implementation.createHTMLDocument('sanitization')
createdDocument.body.innerHTML = unsafeHtml
var whitelistKeys = $.map(whiteList, function (el, i) { return i })
var elements = $(createdDocument.body).find('*')
for (var i = 0, len = elements.length; i < len; i++) {
var el = elements[i]
var elName = el.nodeName.toLowerCase()
if ($.inArray(elName, whitelistKeys) === -1) {
el.parentNode.removeChild(el)
continue
}
var attributeList = $.map(el.attributes, function (el) { return el })
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])
for (var j = 0, len2 = attributeList.length; j < len2; j++) {
if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
el.removeAttribute(attributeList[j].nodeName)
}
}
}
return createdDocument.body.innerHTML
}
// TOOLTIP PUBLIC CLASS DEFINITION // TOOLTIP PUBLIC CLASS DEFINITION
// =============================== // ===============================
var Tooltip = function (element, options) { var Tooltip = function (element, options) {
this.type = this.type = null
this.options = this.options = null
this.enabled = this.enabled = null
this.timeout = this.timeout = null
this.hoverState = this.hoverState = null
this.$element = null this.$element = null
this.inState = null
this.init('tooltip', element, options) this.init('tooltip', element, options)
} }
Tooltip.VERSION = '3.3.1' Tooltip.VERSION = '3.4.1'
Tooltip.TRANSITION_DURATION = 150 Tooltip.TRANSITION_DURATION = 150
@ -33,18 +165,19 @@
animation: true, animation: true,
placement: 'top', placement: 'top',
selector: false, selector: false,
backdrop: false,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: 'hover focus', trigger: 'hover focus',
title: '', title: '',
delay: 0, delay: 0,
html: false, html: false,
container: false, container: false,
theme: 'light',
viewport: { viewport: {
selector: 'body', selector: 'body',
padding: 0 padding: 0
} },
sanitize : true,
sanitizeFn : null,
whiteList : DefaultWhitelist
} }
Tooltip.prototype.init = function (type, element, options) { Tooltip.prototype.init = function (type, element, options) {
@ -52,7 +185,12 @@
this.type = type this.type = type
this.$element = $(element) this.$element = $(element)
this.options = this.getOptions(options) this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport) this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.inState = { click: false, hover: false, focus: false }
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
}
var triggers = this.options.trigger.split(' ') var triggers = this.options.trigger.split(' ')
@ -80,7 +218,15 @@
} }
Tooltip.prototype.getOptions = function (options) { Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options) var dataAttributes = this.$element.data()
for (var dataAttr in dataAttributes) {
if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
delete dataAttributes[dataAttr]
}
}
options = $.extend({}, this.getDefaults(), dataAttributes, options)
if (options.delay && typeof options.delay == 'number') { if (options.delay && typeof options.delay == 'number') {
options.delay = { options.delay = {
@ -89,6 +235,10 @@
} }
} }
if (options.sanitize) {
options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
}
return options return options
} }
@ -107,16 +257,20 @@
var self = obj instanceof this.constructor ? var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type) obj : $(obj.currentTarget).data('bs.' + this.type)
if (self && self.$tip && self.$tip.is(':visible')) {
self.hoverState = 'in'
return
}
if (!self) { if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self) $(obj.currentTarget).data('bs.' + this.type, self)
} }
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
}
if (self.tip().hasClass('in') || self.hoverState == 'in') {
self.hoverState = 'in'
return
}
clearTimeout(self.timeout) clearTimeout(self.timeout)
self.hoverState = 'in' self.hoverState = 'in'
@ -128,6 +282,14 @@
}, self.options.delay.show) }, self.options.delay.show)
} }
Tooltip.prototype.isInStateTrue = function () {
for (var key in this.inState) {
if (this.inState[key]) return true
}
return false
}
Tooltip.prototype.leave = function (obj) { Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ? var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type) obj : $(obj.currentTarget).data('bs.' + this.type)
@ -137,6 +299,12 @@
$(obj.currentTarget).data('bs.' + this.type, self) $(obj.currentTarget).data('bs.' + this.type, self)
} }
if (obj instanceof $.Event) {
self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
}
if (self.isInStateTrue()) return
clearTimeout(self.timeout) clearTimeout(self.timeout)
self.hoverState = 'out' self.hoverState = 'out'
@ -163,12 +331,9 @@
var tipId = this.getUID(this.type) var tipId = this.getUID(this.type)
this.setContent() this.setContent()
$tip.attr('id', tipId).attr('data-theme', this.options.theme) $tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId) this.$element.attr('aria-describedby', tipId)
if(this.options.backdrop)
this.$tip.on('click.bs.tooltip.stopPropagation', function(event){ event.stopPropagation() })
if (this.options.animation) $tip.addClass('fade') if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ? var placement = typeof this.options.placement == 'function' ?
@ -185,7 +350,8 @@
.addClass(placement) .addClass(placement)
.data('bs.' + this.type, this) .data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
this.$element.trigger('inserted.bs.' + this.type)
var pos = this.getPosition() var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth var actualWidth = $tip[0].offsetWidth
@ -193,13 +359,12 @@
if (autoPlace) { if (autoPlace) {
var orgPlacement = placement var orgPlacement = placement
var $container = this.options.container ? $(this.options.container) : this.$element.parent() var viewportDim = this.getPosition(this.$viewport)
var containerDim = this.getPosition($container)
placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' : placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :
placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' : placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :
placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' : placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' : placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :
placement placement
$tip $tip
@ -215,8 +380,6 @@
var prevHoverState = that.hoverState var prevHoverState = that.hoverState
that.$element.trigger('shown.bs.' + that.type) that.$element.trigger('shown.bs.' + that.type)
that.hoverState = null that.hoverState = null
if(that.options.backdrop)
$(document).one('click.bs.tooltip', function(){ that.hide() })
if (prevHoverState == 'out') that.leave(that) if (prevHoverState == 'out') that.leave(that)
} }
@ -242,8 +405,8 @@
if (isNaN(marginTop)) marginTop = 0 if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0 if (isNaN(marginLeft)) marginLeft = 0
offset.top = offset.top + marginTop offset.top += marginTop
offset.left = offset.left + marginLeft offset.left += marginLeft
// $.fn.offset doesn't round pixel values // $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0 // so we use setOffset directly with our own function B-0
@ -279,30 +442,41 @@
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
} }
Tooltip.prototype.replaceArrow = function (delta, dimension, isHorizontal) { Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
this.arrow() this.arrow()
.css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
.css(isHorizontal ? 'top' : 'left', '') .css(isVertical ? 'top' : 'left', '')
} }
Tooltip.prototype.setContent = function () { Tooltip.prototype.setContent = function () {
var $tip = this.tip() var $tip = this.tip()
var title = this.getTitle() var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) if (this.options.html) {
if (this.options.sanitize) {
title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)
}
$tip.find('.tooltip-inner').html(title)
} else {
$tip.find('.tooltip-inner').text(title)
}
$tip.removeClass('fade in top bottom left right') $tip.removeClass('fade in top bottom left right')
} }
Tooltip.prototype.hide = function (callback) { Tooltip.prototype.hide = function (callback) {
var that = this var that = this
var $tip = this.tip() var $tip = $(this.$tip)
var e = $.Event('hide.bs.' + this.type) var e = $.Event('hide.bs.' + this.type)
function complete() { function complete() {
if (that.hoverState != 'in') $tip.detach() if (that.hoverState != 'in') $tip.detach()
that.$element if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
.removeAttr('aria-describedby') that.$element
.trigger('hidden.bs.' + that.type) .removeAttr('aria-describedby')
.trigger('hidden.bs.' + that.type)
}
callback && callback() callback && callback()
} }
@ -312,7 +486,7 @@
$tip.removeClass('in') $tip.removeClass('in')
$.support.transition && this.$tip.hasClass('fade') ? $.support.transition && $tip.hasClass('fade') ?
$tip $tip
.one('bsTransitionEnd', complete) .one('bsTransitionEnd', complete)
.emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
@ -325,7 +499,7 @@
Tooltip.prototype.fixTitle = function () { Tooltip.prototype.fixTitle = function () {
var $e = this.$element var $e = this.$element
if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') { if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '') $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
} }
} }
@ -345,7 +519,10 @@
// width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
} }
var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() var isSvg = window.SVGElement && el instanceof window.SVGElement
// Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
// See https://github.com/twbs/bootstrap/issues/20280
var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null
@ -353,10 +530,10 @@
} }
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
} }
@ -380,7 +557,7 @@
var rightEdgeOffset = pos.left + viewportPadding + actualWidth var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) { // left overflow if (leftEdgeOffset < viewportDimensions.left) { // left overflow
delta.left = viewportDimensions.left - leftEdgeOffset delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.width) { // right overflow } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
} }
} }
@ -406,7 +583,13 @@
} }
Tooltip.prototype.tip = function () { Tooltip.prototype.tip = function () {
return (this.$tip = this.$tip || $(this.options.template)) if (!this.$tip) {
this.$tip = $(this.options.template)
if (this.$tip.length != 1) {
throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
}
}
return this.$tip
} }
Tooltip.prototype.arrow = function () { Tooltip.prototype.arrow = function () {
@ -435,7 +618,13 @@
} }
} }
self.tip().hasClass('in') ? self.leave(self) : self.enter(self) if (e) {
self.inState.click = !self.inState.click
if (self.isInStateTrue()) self.enter(self)
else self.leave(self)
} else {
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
} }
Tooltip.prototype.destroy = function () { Tooltip.prototype.destroy = function () {
@ -443,30 +632,31 @@
clearTimeout(this.timeout) clearTimeout(this.timeout)
this.hide(function () { this.hide(function () {
that.$element.off('.' + that.type).removeData('bs.' + that.type) that.$element.off('.' + that.type).removeData('bs.' + that.type)
if (that.$tip) {
if(that.options.backdrop) that.$tip.detach()
that.$tip.off('click.bs.tooltip.stopPropagation') }
that.$tip = null
that.$arrow = null
that.$viewport = null
that.$element = null
}) })
} }
Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {
return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)
}
// TOOLTIP PLUGIN DEFINITION // TOOLTIP PLUGIN DEFINITION
// ========================= // =========================
function Plugin(option) { function Plugin(option) {
return this.each(function () { return this.each(function () {
var $this = $(this) var $this = $(this)
var data = $this.data('bs.tooltip') var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option var options = typeof option == 'object' && option
var selector = options && options.selector
if (!data && option == 'destroy') return if (!data && /destroy|hide/.test(option)) return
if (selector) { if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (!data) $this.data('bs.tooltip', (data = {}))
if (!data[selector]) data[selector] = new Tooltip(this, options)
} else {
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
}
if (typeof option == 'string') data[option]() if (typeof option == 'string') data[option]()
}) })
} }

View file

@ -1,8 +1,8 @@
/* ======================================================================== /* ========================================================================
* Bootstrap: transition.js v3.3.1 * Bootstrap: transition.js v3.4.1
* http://getbootstrap.com/javascript/#transitions * https://getbootstrap.com/docs/3.4/javascript/#transitions
* ======================================================================== * ========================================================================
* Copyright 2011-2014 Twitter, Inc. * Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */ * ======================================================================== */
@ -10,7 +10,7 @@
+function ($) { +function ($) {
'use strict'; 'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/)
// ============================================================ // ============================================================
function transitionEnd() { function transitionEnd() {
@ -32,7 +32,7 @@
return false // explicit for ie8 ( ._.) return false // explicit for ie8 ( ._.)
} }
// http://blog.alexmaccaw.com/css-transitions // https://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) { $.fn.emulateTransitionEnd = function (duration) {
var called = false var called = false
var $el = this var $el = this