|
|
|
@ -50,9 +50,10 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
// http://blog.alexmaccaw.com/css-transitions
|
|
|
|
|
$.fn.emulateTransitionEnd = function (duration) { |
|
|
|
|
var called = false, $el = this |
|
|
|
|
$(this).one('webkitTransitionEnd', function () { called = true }) |
|
|
|
|
var callback = function () { if (!called) $($el).trigger('webkitTransitionEnd') } |
|
|
|
|
$(this).one($.support.transition.end, function () { called = true }) |
|
|
|
|
var callback = function () { if (!called) $($el).trigger($.support.transition.end) } |
|
|
|
|
setTimeout(callback, duration) |
|
|
|
|
return this |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$(function () { |
|
|
|
@ -218,7 +219,9 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
var $parent = this.$element.closest('[data-toggle="buttons"]') |
|
|
|
|
|
|
|
|
|
if ($parent.length) { |
|
|
|
|
var $input = this.$element.find('input').prop('checked', !this.$element.hasClass('active')) |
|
|
|
|
var $input = this.$element.find('input') |
|
|
|
|
.prop('checked', !this.$element.hasClass('active')) |
|
|
|
|
.trigger('change') |
|
|
|
|
if ($input.prop('type') === 'radio') $parent.find('.active').removeClass('active') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -234,7 +237,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
$.fn.button = function (option) { |
|
|
|
|
return this.each(function () { |
|
|
|
|
var $this = $(this) |
|
|
|
|
var data = $this.data('button') |
|
|
|
|
var data = $this.data('bs.button') |
|
|
|
|
var options = typeof option == 'object' && option |
|
|
|
|
|
|
|
|
|
if (!data) $this.data('bs.button', (data = new Button(this, options))) |
|
|
|
@ -532,9 +535,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
this.$element.trigger(startEvent) |
|
|
|
|
if (startEvent.isDefaultPrevented()) return |
|
|
|
|
|
|
|
|
|
var dimension = this.dimension() |
|
|
|
|
var scroll = $.camelCase(['scroll', dimension].join('-')) |
|
|
|
|
var actives = this.$parent && this.$parent.find('> .accordion-group > .in') |
|
|
|
|
var actives = this.$parent && this.$parent.find('> .accordion-group > .in') |
|
|
|
|
|
|
|
|
|
if (actives && actives.length) { |
|
|
|
|
var hasData = actives.data('bs.collapse') |
|
|
|
@ -543,10 +544,32 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
hasData || actives.data('bs.collapse', null) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.$element[dimension](0) |
|
|
|
|
this.transition('addClass', 'shown.bs.collapse') |
|
|
|
|
var dimension = this.dimension() |
|
|
|
|
|
|
|
|
|
this.$element |
|
|
|
|
.removeClass('collapse') |
|
|
|
|
.addClass('collapsing') |
|
|
|
|
[dimension](0) |
|
|
|
|
|
|
|
|
|
this.transitioning = 1 |
|
|
|
|
|
|
|
|
|
var complete = function () { |
|
|
|
|
this.$element |
|
|
|
|
.removeClass('collapsing') |
|
|
|
|
.addClass('in') |
|
|
|
|
[dimension]('auto') |
|
|
|
|
this.transitioning = 0 |
|
|
|
|
this.$element.trigger('shown.bs.collapse') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$.support.transition) return complete.call(this) |
|
|
|
|
|
|
|
|
|
var scrollSize = $.camelCase(['scroll', dimension].join('-')) |
|
|
|
|
|
|
|
|
|
if ($.support.transition) this.$element[dimension](this.$element[0][scroll]) |
|
|
|
|
this.$element |
|
|
|
|
.one($.support.transition.end, $.proxy(complete, this)) |
|
|
|
|
.emulateTransitionEnd(350) |
|
|
|
|
[dimension](this.$element[0][scrollSize]) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Collapse.prototype.hide = function () { |
|
|
|
@ -557,41 +580,32 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
if (startEvent.isDefaultPrevented()) return |
|
|
|
|
|
|
|
|
|
var dimension = this.dimension() |
|
|
|
|
this.reset(this.$element[dimension]()) |
|
|
|
|
this.transition('removeClass', 'hidden.bs.collapse') |
|
|
|
|
this.$element[dimension](0) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Collapse.prototype.reset = function (size) { |
|
|
|
|
var dimension = this.dimension() |
|
|
|
|
this.$element |
|
|
|
|
[dimension](this.$element[dimension]()) |
|
|
|
|
[0].offsetHeight |
|
|
|
|
|
|
|
|
|
this.$element |
|
|
|
|
.addClass('collapsing') |
|
|
|
|
.removeClass('collapse') |
|
|
|
|
[dimension](size || 'auto') |
|
|
|
|
[0].offsetWidth |
|
|
|
|
|
|
|
|
|
this.$element[size != null ? 'addClass' : 'removeClass']('collapse') |
|
|
|
|
.removeClass('in') |
|
|
|
|
|
|
|
|
|
return this |
|
|
|
|
} |
|
|
|
|
this.transitioning = 1 |
|
|
|
|
|
|
|
|
|
Collapse.prototype.transition = function (method, completeEvent) { |
|
|
|
|
var that = this |
|
|
|
|
var complete = function () { |
|
|
|
|
if (completeEvent == 'shown.bs.collapse') that.reset() |
|
|
|
|
that.transitioning = 0 |
|
|
|
|
that.$element.trigger(completeEvent) |
|
|
|
|
this.transitioning = 0 |
|
|
|
|
this.$element |
|
|
|
|
.trigger('hidden.bs.collapse') |
|
|
|
|
.removeClass('collapsing') |
|
|
|
|
.addClass('collapse') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.transitioning = 1 |
|
|
|
|
|
|
|
|
|
this.$element[method]('in') |
|
|
|
|
if (!$.support.transition) return complete.call(this) |
|
|
|
|
|
|
|
|
|
$.support.transition && this.$element.hasClass('collapse') ? |
|
|
|
|
this.$element |
|
|
|
|
.one($.support.transition.end, complete) |
|
|
|
|
.emulateTransitionEnd(350) : |
|
|
|
|
complete() |
|
|
|
|
this.$element |
|
|
|
|
[dimension](0) |
|
|
|
|
.one($.support.transition.end, $.proxy(complete, this)) |
|
|
|
|
.emulateTransitionEnd(350) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Collapse.prototype.toggle = function () { |
|
|
|
@ -1042,9 +1056,11 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
var $body = $(document.body) |
|
|
|
|
.on('shown.bs.modal', '.modal', function () { $body.addClass('modal-open') }) |
|
|
|
|
.on('hidden.bs.modal', '.modal', function () { $body.removeClass('modal-open') }) |
|
|
|
|
$(function () { |
|
|
|
|
var $body = $(document.body) |
|
|
|
|
.on('shown.bs.modal', '.modal', function () { $body.addClass('modal-open') }) |
|
|
|
|
.on('hidden.bs.modal', '.modal', function () { $body.removeClass('modal-open') }) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}(window.jQuery); |
|
|
|
|
|
|
|
|
@ -1229,12 +1245,9 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
.addClass(placement) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var tp = 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 == '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 } |
|
|
|
|
var calculatedOffset = this.getCalcuatedOffset(placement, pos, actualWidth, actualHeight) |
|
|
|
|
|
|
|
|
|
this.applyPlacement(tp, placement) |
|
|
|
|
this.applyPlacement(calculatedOffset, placement) |
|
|
|
|
this.$element.trigger('shown.bs.' + this.type) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1246,25 +1259,33 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
var height = $tip[0].offsetHeight |
|
|
|
|
|
|
|
|
|
// manually read margins because getBoundingClientRect includes difference
|
|
|
|
|
offset.top = offset.top + parseInt($tip.css('margin-top'), 10) |
|
|
|
|
offset.left = offset.left + parseInt($tip.css('margin-left'), 10) |
|
|
|
|
var marginTop = parseInt($tip.css('margin-top'), 10) |
|
|
|
|
var marginLeft = parseInt($tip.css('margin-left'), 10) |
|
|
|
|
|
|
|
|
|
// we must check for NaN for ie 8/9
|
|
|
|
|
if (isNaN(marginTop)) marginTop = 0 |
|
|
|
|
if (isNaN(marginLeft)) marginLeft = 0 |
|
|
|
|
|
|
|
|
|
offset.top = offset.top + marginTop |
|
|
|
|
offset.left = offset.left + marginLeft |
|
|
|
|
|
|
|
|
|
$tip |
|
|
|
|
.offset(offset) |
|
|
|
|
.addClass('in') |
|
|
|
|
|
|
|
|
|
// check to see if placing tip in new offset caused the tip to resize itself
|
|
|
|
|
var actualWidth = $tip[0].offsetWidth |
|
|
|
|
var actualHeight = $tip[0].offsetHeight |
|
|
|
|
|
|
|
|
|
if (placement == 'top' && actualHeight != height) { |
|
|
|
|
replace = true |
|
|
|
|
offset.top = offset.top + height - actualHeight |
|
|
|
|
offset.top = offset.top + height - actualHeight |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (placement == 'bottom' || placement == 'top') { |
|
|
|
|
if (/bottom|top/.test(placement)) { |
|
|
|
|
var delta = 0 |
|
|
|
|
|
|
|
|
|
if (offset.left < 0){ |
|
|
|
|
if (offset.left < 0) { |
|
|
|
|
delta = offset.left * -2 |
|
|
|
|
offset.left = 0 |
|
|
|
|
|
|
|
|
@ -1299,6 +1320,8 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
var $tip = this.tip() |
|
|
|
|
var e = $.Event('hide.bs.' + this.type) |
|
|
|
|
|
|
|
|
|
function complete() { $tip.detach() } |
|
|
|
|
|
|
|
|
|
this.$element.trigger(e) |
|
|
|
|
|
|
|
|
|
if (e.isDefaultPrevented()) return |
|
|
|
@ -1307,9 +1330,9 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
|
|
|
|
|
$.support.transition && this.$tip.hasClass('fade') ? |
|
|
|
|
$tip |
|
|
|
|
.one($.support.transition.end, $tip.detach) |
|
|
|
|
.one($.support.transition.end, complete) |
|
|
|
|
.emulateTransitionEnd(150) : |
|
|
|
|
$tip.detach() |
|
|
|
|
complete() |
|
|
|
|
|
|
|
|
|
this.$element.trigger('hidden.bs.' + this.type) |
|
|
|
|
|
|
|
|
@ -1335,6 +1358,13 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
}, this.$element.offset()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Tooltip.prototype.getCalcuatedOffset = function (placement, pos, actualWidth, actualHeight) { |
|
|
|
|
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 == '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 } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Tooltip.prototype.getTitle = function () { |
|
|
|
|
var title |
|
|
|
|
var $e = this.$element |
|
|
|
@ -1350,8 +1380,8 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
return this.$tip = this.$tip || $(this.options.template) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Tooltip.prototype.arrow =function(){ |
|
|
|
|
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") |
|
|
|
|
Tooltip.prototype.arrow = function () { |
|
|
|
|
return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Tooltip.prototype.validate = function () { |
|
|
|
@ -1442,6 +1472,8 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
this.init('popover', element, options) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') |
|
|
|
|
|
|
|
|
|
Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, { |
|
|
|
|
placement: 'right' |
|
|
|
|
, trigger: 'click' |
|
|
|
@ -1471,7 +1503,13 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
|
|
|
|
|
$tip.removeClass('fade top bottom left right in') |
|
|
|
|
|
|
|
|
|
$tip.find('.popover-title:empty').hide() |
|
|
|
|
// Hide empty titles
|
|
|
|
|
//
|
|
|
|
|
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
|
|
|
|
|
// this manually by checking the contents.
|
|
|
|
|
if ($tip.find('.popover-title').html() === '') { |
|
|
|
|
$tip.find('.popover-title').hide(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Popover.prototype.hasContent = function () { |
|
|
|
@ -1488,15 +1526,15 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
o.content) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Popover.prototype.arrow =function () { |
|
|
|
|
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.prototype.destroy = function () { |
|
|
|
|
this.hide().$element.off('.' + this.type).removeData(this.type) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// POPOVER PLUGIN DEFINITION
|
|
|
|
|
// =========================
|
|
|
|
@ -1555,10 +1593,10 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
function ScrollSpy(element, options) { |
|
|
|
|
var href |
|
|
|
|
var process = $.proxy(this.process, this) |
|
|
|
|
var $element = $(element).is('body') ? $(window) : $(element) |
|
|
|
|
|
|
|
|
|
this.$element = $(element).is('body') ? $(window) : $(element) |
|
|
|
|
this.$body = $('body') |
|
|
|
|
this.$scrollElement = $element.on('scroll.bs.scroll-spy.data-api', process) |
|
|
|
|
this.$scrollElement = this.$element.on('scroll.bs.scroll-spy.data-api', process) |
|
|
|
|
this.options = $.extend({}, ScrollSpy.DEFAULTS, options) |
|
|
|
|
this.selector = (this.options.target |
|
|
|
|
|| ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
|
|
|
@ -1576,6 +1614,8 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ScrollSpy.prototype.refresh = function () { |
|
|
|
|
var offsetMethod = this.$element[0] == window ? 'offset' : 'position' |
|
|
|
|
|
|
|
|
|
this.offsets = $([]) |
|
|
|
|
this.targets = $([]) |
|
|
|
|
|
|
|
|
@ -1589,7 +1629,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|
|
|
|
|
|
|
|
|
return ($href |
|
|
|
|
&& $href.length |
|
|
|
|
&& [[ $href.offset().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null |
|
|
|
|
&& [[ $href[offsetMethod]().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]]) || null |
|
|
|
|
}) |
|
|
|
|
.sort(function (a, b) { return a[0] - b[0] }) |
|
|
|
|
.each(function () { |
|
|
|
|