From 25f57ee1fe9773b08d95d5f7d6ba93e2db048f8f Mon Sep 17 00:00:00 2001 From: Thomas Park Date: Thu, 22 Jan 2015 22:36:20 -0500 Subject: update bootstrap to 3.3.2 --- .../assets/javascripts/bootstrap.js | 2160 ++++++++++---------- .../assets/javascripts/bootstrap.min.js | 7 + .../assets/javascripts/bootstrap/affix.js | 8 +- .../assets/javascripts/bootstrap/alert.js | 6 +- .../assets/javascripts/bootstrap/button.js | 6 +- .../assets/javascripts/bootstrap/carousel.js | 17 +- .../assets/javascripts/bootstrap/collapse.js | 8 +- .../assets/javascripts/bootstrap/dropdown.js | 6 +- .../assets/javascripts/bootstrap/modal.js | 6 +- .../assets/javascripts/bootstrap/popover.js | 20 +- .../assets/javascripts/bootstrap/scrollspy.js | 6 +- .../assets/javascripts/bootstrap/tab.js | 6 +- .../assets/javascripts/bootstrap/tooltip.js | 26 +- .../assets/javascripts/bootstrap/transition.js | 4 +- 14 files changed, 1140 insertions(+), 1146 deletions(-) create mode 100644 bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.min.js (limited to 'bower_components/bootstrap-sass-official/assets/javascripts') diff --git a/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js b/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js index 485f5f96..4139b6fc 100644 --- a/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js +++ b/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js @@ -1,171 +1,86 @@ -/* ======================================================================== - * Bootstrap: affix.js v3.3.1 - * http://getbootstrap.com/javascript/#affix - * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. +/*! + * Bootstrap v3.3.2 (http://getbootstrap.com) + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ + */ +if (typeof jQuery === 'undefined') { + throw new Error('Bootstrap\'s JavaScript requires jQuery') +} +function ($) { 'use strict'; - - // AFFIX CLASS DEFINITION - // ====================== - - var Affix = function (element, options) { - this.options = $.extend({}, Affix.DEFAULTS, options) - - this.$target = $(this.options.target) - .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) - .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) - - this.$element = $(element) - this.affixed = - this.unpin = - this.pinnedOffset = null - - this.checkPosition() - } - - Affix.VERSION = '3.3.1' - - Affix.RESET = 'affix affix-top affix-bottom' - - Affix.DEFAULTS = { - offset: 0, - target: window - } - - Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { - var scrollTop = this.$target.scrollTop() - var position = this.$element.offset() - var targetHeight = this.$target.height() - - if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false - - if (this.affixed == 'bottom') { - if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' - return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' - } - - var initializing = this.affixed == null - var colliderTop = initializing ? scrollTop : position.top - var colliderHeight = initializing ? targetHeight : height - - if (offsetTop != null && colliderTop <= offsetTop) return 'top' - if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' - - return false - } - - Affix.prototype.getPinnedOffset = function () { - if (this.pinnedOffset) return this.pinnedOffset - this.$element.removeClass(Affix.RESET).addClass('affix') - var scrollTop = this.$target.scrollTop() - var position = this.$element.offset() - return (this.pinnedOffset = position.top - scrollTop) - } - - Affix.prototype.checkPositionWithEventLoop = function () { - setTimeout($.proxy(this.checkPosition, this), 1) + var version = $.fn.jquery.split(' ')[0].split('.') + if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1)) { + throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher') } +}(jQuery); - Affix.prototype.checkPosition = function () { - if (!this.$element.is(':visible')) return - - var height = this.$element.height() - var offset = this.options.offset - var offsetTop = offset.top - var offsetBottom = offset.bottom - var scrollHeight = $('body').height() - - if (typeof offset != 'object') offsetBottom = offsetTop = offset - if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) - if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) - - var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) - - if (this.affixed != affix) { - if (this.unpin != null) this.$element.css('top', '') +/* ======================================================================== + * Bootstrap: transition.js v3.3.2 + * http://getbootstrap.com/javascript/#transitions + * ======================================================================== + * Copyright 2011-2015 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * ======================================================================== */ - var affixType = 'affix' + (affix ? '-' + affix : '') - var e = $.Event(affixType + '.bs.affix') - this.$element.trigger(e) ++function ($) { + 'use strict'; - if (e.isDefaultPrevented()) return + // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) + // ============================================================ - this.affixed = affix - this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null + function transitionEnd() { + var el = document.createElement('bootstrap') - this.$element - .removeClass(Affix.RESET) - .addClass(affixType) - .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') + var transEndEventNames = { + WebkitTransition : 'webkitTransitionEnd', + MozTransition : 'transitionend', + OTransition : 'oTransitionEnd otransitionend', + transition : 'transitionend' } - if (affix == 'bottom') { - this.$element.offset({ - top: scrollHeight - height - offsetBottom - }) + for (var name in transEndEventNames) { + if (el.style[name] !== undefined) { + return { end: transEndEventNames[name] } + } } - } - - - // AFFIX PLUGIN DEFINITION - // ======================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.affix') - var options = typeof option == 'object' && option - if (!data) $this.data('bs.affix', (data = new Affix(this, options))) - if (typeof option == 'string') data[option]() - }) + return false // explicit for ie8 ( ._.) } - var old = $.fn.affix - - $.fn.affix = Plugin - $.fn.affix.Constructor = Affix - - - // AFFIX NO CONFLICT - // ================= - - $.fn.affix.noConflict = function () { - $.fn.affix = old + // http://blog.alexmaccaw.com/css-transitions + $.fn.emulateTransitionEnd = function (duration) { + var called = false + var $el = this + $(this).one('bsTransitionEnd', function () { called = true }) + var callback = function () { if (!called) $($el).trigger($.support.transition.end) } + setTimeout(callback, duration) return this } + $(function () { + $.support.transition = transitionEnd() - // AFFIX DATA-API - // ============== - - $(window).on('load', function () { - $('[data-spy="affix"]').each(function () { - var $spy = $(this) - var data = $spy.data() - - data.offset = data.offset || {} - - if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom - if (data.offsetTop != null) data.offset.top = data.offsetTop + if (!$.support.transition) return - Plugin.call($spy, data) - }) + $.event.special.bsTransitionEnd = { + bindType: $.support.transition.end, + delegateType: $.support.transition.end, + handle: function (e) { + if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) + } + } }) }(jQuery); /* ======================================================================== - * Bootstrap: alert.js v3.3.1 + * Bootstrap: alert.js v3.3.2 * http://getbootstrap.com/javascript/#alerts * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -181,7 +96,7 @@ $(el).on('click', dismiss, this.close) } - Alert.VERSION = '3.3.1' + Alert.VERSION = '3.3.2' Alert.TRANSITION_DURATION = 150 @@ -257,10 +172,10 @@ }(jQuery); /* ======================================================================== - * Bootstrap: button.js v3.3.1 + * Bootstrap: button.js v3.3.2 * http://getbootstrap.com/javascript/#buttons * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -277,7 +192,7 @@ this.isLoading = false } - Button.VERSION = '3.3.1' + Button.VERSION = '3.3.2' Button.DEFAULTS = { loadingText: 'loading...' @@ -374,10 +289,10 @@ }(jQuery); /* ======================================================================== - * Bootstrap: carousel.js v3.3.1 + * Bootstrap: carousel.js v3.3.2 * http://getbootstrap.com/javascript/#carousel * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -405,7 +320,7 @@ .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) } - Carousel.VERSION = '3.3.1' + Carousel.VERSION = '3.3.2' Carousel.TRANSITION_DURATION = 600 @@ -445,8 +360,11 @@ } Carousel.prototype.getItemForDirection = function (direction, active) { - var delta = direction == 'prev' ? -1 : 1 var activeIndex = this.getItemIndex(active) + var willWrap = (direction == 'prev' && activeIndex === 0) + || (direction == 'next' && activeIndex == (this.$items.length - 1)) + if (willWrap && !this.options.wrap) return active + var delta = direction == 'prev' ? -1 : 1 var itemIndex = (activeIndex + delta) % this.$items.length return this.$items.eq(itemIndex) } @@ -491,14 +409,8 @@ var $next = next || this.getItemForDirection(type, $active) var isCycling = this.interval var direction = type == 'next' ? 'left' : 'right' - var fallback = type == 'next' ? 'first' : 'last' var that = this - if (!$next.length) { - if (!this.options.wrap) return - $next = this.$element.find('.item')[fallback]() - } - if ($next.hasClass('active')) return (this.sliding = false) var relatedTarget = $next[0] @@ -615,10 +527,10 @@ }(jQuery); /* ======================================================================== - * Bootstrap: collapse.js v3.3.1 + * Bootstrap: collapse.js v3.3.2 * http://getbootstrap.com/javascript/#collapse * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -644,7 +556,7 @@ if (this.options.toggle) this.toggle() } - Collapse.VERSION = '3.3.1' + Collapse.VERSION = '3.3.2' Collapse.TRANSITION_DURATION = 350 @@ -662,7 +574,7 @@ if (this.transitioning || this.$element.hasClass('in')) return 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) { activesData = actives.data('bs.collapse') @@ -827,10 +739,10 @@ }(jQuery); /* ======================================================================== - * Bootstrap: dropdown.js v3.3.1 + * Bootstrap: dropdown.js v3.3.2 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -847,7 +759,7 @@ $(element).on('click.bs.dropdown', this.toggle) } - Dropdown.VERSION = '3.3.1' + Dropdown.VERSION = '3.3.2' Dropdown.prototype.toggle = function (e) { var $this = $(this) @@ -989,10 +901,10 @@ }(jQuery); /* ======================================================================== - * Bootstrap: tab.js v3.3.1 - * http://getbootstrap.com/javascript/#tabs + * Bootstrap: modal.js v3.3.2 + * http://getbootstrap.com/javascript/#modals * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. + * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ @@ -1000,213 +912,325 @@ +function ($) { 'use strict'; - // TAB CLASS DEFINITION - // ==================== + // MODAL CLASS DEFINITION + // ====================== - var Tab = function (element) { - this.element = $(element) + var Modal = function (element, options) { + this.options = options + this.$body = $(document.body) + this.$element = $(element) + this.$backdrop = + this.isShown = null + this.scrollbarWidth = 0 + + if (this.options.remote) { + this.$element + .find('.modal-content') + .load(this.options.remote, $.proxy(function () { + this.$element.trigger('loaded.bs.modal') + }, this)) + } } - Tab.VERSION = '3.3.1' + Modal.VERSION = '3.3.2' - Tab.TRANSITION_DURATION = 150 + Modal.TRANSITION_DURATION = 300 + Modal.BACKDROP_TRANSITION_DURATION = 150 - Tab.prototype.show = function () { - var $this = this.element - var $ul = $this.closest('ul:not(.dropdown-menu)') - var selector = $this.data('target') + Modal.DEFAULTS = { + backdrop: true, + keyboard: true, + show: true + } - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } + Modal.prototype.toggle = function (_relatedTarget) { + return this.isShown ? this.hide() : this.show(_relatedTarget) + } - if ($this.parent('li').hasClass('active')) return + Modal.prototype.show = function (_relatedTarget) { + var that = this + var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) - var $previous = $ul.find('.active:last a') - var hideEvent = $.Event('hide.bs.tab', { - relatedTarget: $this[0] - }) - var showEvent = $.Event('show.bs.tab', { - relatedTarget: $previous[0] - }) + this.$element.trigger(e) - $previous.trigger(hideEvent) - $this.trigger(showEvent) + if (this.isShown || e.isDefaultPrevented()) return - if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return + this.isShown = true - var $target = $(selector) + this.checkScrollbar() + this.setScrollbar() + this.$body.addClass('modal-open') - this.activate($this.closest('li'), $ul) - this.activate($target, $target.parent(), function () { - $previous.trigger({ - type: 'hidden.bs.tab', - relatedTarget: $this[0] - }) - $this.trigger({ - type: 'shown.bs.tab', - relatedTarget: $previous[0] - }) - }) - } + this.escape() + this.resize() - Tab.prototype.activate = function (element, container, callback) { - var $active = container.find('> .active') - var transition = callback - && $.support.transition - && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length) + this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) - function next() { - $active - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') - .end() - .find('[data-toggle="tab"]') - .attr('aria-expanded', false) + this.backdrop(function () { + var transition = $.support.transition && that.$element.hasClass('fade') - element - .addClass('active') - .find('[data-toggle="tab"]') - .attr('aria-expanded', true) + if (!that.$element.parent().length) { + that.$element.appendTo(that.$body) // don't move modals dom position + } + + that.$element + .show() + .scrollTop(0) + + if (that.options.backdrop) that.adjustBackdrop() + that.adjustDialog() if (transition) { - element[0].offsetWidth // reflow for transition - element.addClass('in') - } else { - element.removeClass('fade') + that.$element[0].offsetWidth // force reflow } - if (element.parent('.dropdown-menu')) { - element - .closest('li.dropdown') - .addClass('active') - .end() - .find('[data-toggle="tab"]') - .attr('aria-expanded', true) - } + that.$element + .addClass('in') + .attr('aria-hidden', false) - callback && callback() - } + that.enforceFocus() - $active.length && transition ? - $active - .one('bsTransitionEnd', next) - .emulateTransitionEnd(Tab.TRANSITION_DURATION) : - next() + var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) - $active.removeClass('in') + transition ? + that.$element.find('.modal-dialog') // wait for modal to slide in + .one('bsTransitionEnd', function () { + that.$element.trigger('focus').trigger(e) + }) + .emulateTransitionEnd(Modal.TRANSITION_DURATION) : + that.$element.trigger('focus').trigger(e) + }) } + Modal.prototype.hide = function (e) { + if (e) e.preventDefault() - // TAB PLUGIN DEFINITION - // ===================== + e = $.Event('hide.bs.modal') - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tab') + this.$element.trigger(e) - if (!data) $this.data('bs.tab', (data = new Tab(this))) - if (typeof option == 'string') data[option]() - }) - } + if (!this.isShown || e.isDefaultPrevented()) return - var old = $.fn.tab + this.isShown = false - $.fn.tab = Plugin - $.fn.tab.Constructor = Tab + this.escape() + this.resize() + $(document).off('focusin.bs.modal') - // TAB NO CONFLICT - // =============== + this.$element + .removeClass('in') + .attr('aria-hidden', true) + .off('click.dismiss.bs.modal') - $.fn.tab.noConflict = function () { - $.fn.tab = old - return this + $.support.transition && this.$element.hasClass('fade') ? + this.$element + .one('bsTransitionEnd', $.proxy(this.hideModal, this)) + .emulateTransitionEnd(Modal.TRANSITION_DURATION) : + this.hideModal() } + Modal.prototype.enforceFocus = function () { + $(document) + .off('focusin.bs.modal') // guard against infinite focus loop + .on('focusin.bs.modal', $.proxy(function (e) { + if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { + this.$element.trigger('focus') + } + }, this)) + } - // TAB DATA-API - // ============ + Modal.prototype.escape = function () { + if (this.isShown && this.options.keyboard) { + this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { + e.which == 27 && this.hide() + }, this)) + } else if (!this.isShown) { + this.$element.off('keydown.dismiss.bs.modal') + } + } - var clickHandler = function (e) { - e.preventDefault() - Plugin.call($(this), 'show') + Modal.prototype.resize = function () { + if (this.isShown) { + $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) + } else { + $(window).off('resize.bs.modal') + } } - $(document) - .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) - .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) + Modal.prototype.hideModal = function () { + var that = this + this.$element.hide() + this.backdrop(function () { + that.$body.removeClass('modal-open') + that.resetAdjustments() + that.resetScrollbar() + that.$element.trigger('hidden.bs.modal') + }) + } -}(jQuery); + Modal.prototype.removeBackdrop = function () { + this.$backdrop && this.$backdrop.remove() + this.$backdrop = null + } -/* ======================================================================== - * Bootstrap: transition.js v3.3.1 - * http://getbootstrap.com/javascript/#transitions - * ======================================================================== - * Copyright 2011-2014 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ + Modal.prototype.backdrop = function (callback) { + var that = this + var animate = this.$element.hasClass('fade') ? 'fade' : '' + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate -+function ($) { - 'use strict'; + this.$backdrop = $('