From afd171105704c314bf699810875c72a612988a72 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 22 Oct 2016 07:20:53 +0100 Subject: rake update[v4.0.0-alpha.5] --- assets/javascripts/bootstrap/alert.js | 179 ++++---- assets/javascripts/bootstrap/button.js | 129 +++--- assets/javascripts/bootstrap/carousel.js | 520 ++++++++++++------------ assets/javascripts/bootstrap/collapse.js | 366 ++++++++--------- assets/javascripts/bootstrap/dropdown.js | 298 +++++++------- assets/javascripts/bootstrap/modal.js | 596 +++++++++++++-------------- assets/javascripts/bootstrap/popover.js | 130 +++--- assets/javascripts/bootstrap/scrollspy.js | 302 +++++++------- assets/javascripts/bootstrap/tab.js | 254 ++++++------ assets/javascripts/bootstrap/tooltip.js | 654 ++++++++++++++---------------- assets/javascripts/bootstrap/util.js | 25 +- 11 files changed, 1649 insertions(+), 1804 deletions(-) (limited to 'assets/javascripts/bootstrap') diff --git a/assets/javascripts/bootstrap/alert.js b/assets/javascripts/bootstrap/alert.js index 985be8c..159afee 100644 --- a/assets/javascripts/bootstrap/alert.js +++ b/assets/javascripts/bootstrap/alert.js @@ -1,17 +1,15 @@ -'use strict'; +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): alert.js + * Bootstrap (v4.0.0-alpha.5): alert.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Alert = (function ($) { +var Alert = function ($) { /** * ------------------------------------------------------------------------ @@ -20,7 +18,7 @@ var Alert = (function ($) { */ var NAME = 'alert'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.alert'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -49,120 +47,103 @@ var Alert = (function ($) { * ------------------------------------------------------------------------ */ - var Alert = (function () { + var Alert = function () { function Alert(element) { _classCallCheck(this, Alert); this._element = element; } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Alert, [{ - key: 'close', + // public - // public + Alert.prototype.close = function close(element) { + element = element || this._element; - value: function close(element) { - element = element || this._element; + var rootElement = this._getRootElement(element); + var customEvent = this._triggerCloseEvent(rootElement); - var rootElement = this._getRootElement(element); - var customEvent = this._triggerCloseEvent(rootElement); + if (customEvent.isDefaultPrevented()) { + return; + } - if (customEvent.isDefaultPrevented()) { - return; - } + this._removeElement(rootElement); + }; + + Alert.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + this._element = null; + }; + + // private + + Alert.prototype._getRootElement = function _getRootElement(element) { + var selector = Util.getSelectorFromElement(element); + var parent = false; - this._removeElement(rootElement); + if (selector) { + parent = $(selector)[0]; } - }, { - key: 'dispose', - value: function dispose() { - $.removeData(this._element, DATA_KEY); - this._element = null; + + if (!parent) { + parent = $(element).closest('.' + ClassName.ALERT)[0]; } - // private + return parent; + }; - }, { - key: '_getRootElement', - value: function _getRootElement(element) { - var selector = Util.getSelectorFromElement(element); - var parent = false; + Alert.prototype._triggerCloseEvent = function _triggerCloseEvent(element) { + var closeEvent = $.Event(Event.CLOSE); - if (selector) { - parent = $(selector)[0]; - } + $(element).trigger(closeEvent); + return closeEvent; + }; - if (!parent) { - parent = $(element).closest('.' + ClassName.ALERT)[0]; - } + Alert.prototype._removeElement = function _removeElement(element) { + $(element).removeClass(ClassName.IN); - return parent; + if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) { + this._destroyElement(element); + return; } - }, { - key: '_triggerCloseEvent', - value: function _triggerCloseEvent(element) { - var closeEvent = $.Event(Event.CLOSE); - $(element).trigger(closeEvent); - return closeEvent; - } - }, { - key: '_removeElement', - value: function _removeElement(element) { - $(element).removeClass(ClassName.IN); - - if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) { - this._destroyElement(element); - return; - } + $(element).one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element)).emulateTransitionEnd(TRANSITION_DURATION); + }; - $(element).one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element)).emulateTransitionEnd(TRANSITION_DURATION); - } - }, { - key: '_destroyElement', - value: function _destroyElement(element) { - $(element).detach().trigger(Event.CLOSED).remove(); - } + Alert.prototype._destroyElement = function _destroyElement(element) { + $(element).detach().trigger(Event.CLOSED).remove(); + }; - // static + // static - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var $element = $(this); - var data = $element.data(DATA_KEY); + Alert._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var $element = $(this); + var data = $element.data(DATA_KEY); - if (!data) { - data = new Alert(this); - $element.data(DATA_KEY, data); - } + if (!data) { + data = new Alert(this); + $element.data(DATA_KEY, data); + } - if (config === 'close') { - data[config](this); - } - }); - } - }, { - key: '_handleDismiss', - value: function _handleDismiss(alertInstance) { - return function (event) { - if (event) { - event.preventDefault(); - } - - alertInstance.close(this); - }; - } - }, { + if (config === 'close') { + data[config](this); + } + }); + }; + + Alert._handleDismiss = function _handleDismiss(alertInstance) { + return function (event) { + if (event) { + event.preventDefault(); + } + + alertInstance.close(this); + }; + }; + + _createClass(Alert, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -170,7 +151,13 @@ var Alert = (function ($) { }]); return Alert; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); @@ -188,4 +175,4 @@ var Alert = (function ($) { }; return Alert; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/button.js b/assets/javascripts/bootstrap/button.js index 910b093..932c68f 100644 --- a/assets/javascripts/bootstrap/button.js +++ b/assets/javascripts/bootstrap/button.js @@ -1,17 +1,15 @@ +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): button.js + * Bootstrap (v4.0.0-alpha.5): button.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -'use strict'; - -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } - -var Button = (function ($) { +var Button = function ($) { /** * ------------------------------------------------------------------------ @@ -20,7 +18,7 @@ var Button = (function ($) { */ var NAME = 'button'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.button'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -51,87 +49,76 @@ var Button = (function ($) { * ------------------------------------------------------------------------ */ - var Button = (function () { + var Button = function () { function Button(element) { _classCallCheck(this, Button); this._element = element; } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Button, [{ - key: 'toggle', + // public - // public + Button.prototype.toggle = function toggle() { + var triggerChangeEvent = true; + var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0]; - value: function toggle() { - var triggerChangeEvent = true; - var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0]; + if (rootElement) { + var input = $(this._element).find(Selector.INPUT)[0]; - if (rootElement) { - var input = $(this._element).find(Selector.INPUT)[0]; + if (input) { + if (input.type === 'radio') { + if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) { + triggerChangeEvent = false; + } else { + var activeElement = $(rootElement).find(Selector.ACTIVE)[0]; - if (input) { - if (input.type === 'radio') { - if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) { - triggerChangeEvent = false; - } else { - var activeElement = $(rootElement).find(Selector.ACTIVE)[0]; - - if (activeElement) { - $(activeElement).removeClass(ClassName.ACTIVE); - } + if (activeElement) { + $(activeElement).removeClass(ClassName.ACTIVE); } } + } - if (triggerChangeEvent) { - input.checked = !$(this._element).hasClass(ClassName.ACTIVE); - $(this._element).trigger('change'); - } - - input.focus(); + if (triggerChangeEvent) { + input.checked = !$(this._element).hasClass(ClassName.ACTIVE); + $(this._element).trigger('change'); } - } else { - this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE)); - } - if (triggerChangeEvent) { - $(this._element).toggleClass(ClassName.ACTIVE); + input.focus(); } + } else { + this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE)); } - }, { - key: 'dispose', - value: function dispose() { - $.removeData(this._element, DATA_KEY); - this._element = null; + + if (triggerChangeEvent) { + $(this._element).toggleClass(ClassName.ACTIVE); } + }; - // static + Button.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + this._element = null; + }; - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); + // static - if (!data) { - data = new Button(this); - $(this).data(DATA_KEY, data); - } + Button._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); - if (config === 'toggle') { - data[config](); - } - }); - } - }, { + if (!data) { + data = new Button(this); + $(this).data(DATA_KEY, data); + } + + if (config === 'toggle') { + data[config](); + } + }); + }; + + _createClass(Button, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -139,7 +126,13 @@ var Button = (function ($) { }]); return Button; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { event.preventDefault(); @@ -170,4 +163,4 @@ var Button = (function ($) { }; return Button; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/carousel.js b/assets/javascripts/bootstrap/carousel.js index 8bacf79..cfe5ce3 100644 --- a/assets/javascripts/bootstrap/carousel.js +++ b/assets/javascripts/bootstrap/carousel.js @@ -1,17 +1,17 @@ -'use strict'; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): carousel.js + * Bootstrap (v4.0.0-alpha.5): carousel.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Carousel = (function ($) { +var Carousel = function ($) { /** * ------------------------------------------------------------------------ @@ -20,7 +20,7 @@ var Carousel = (function ($) { */ var NAME = 'carousel'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.carousel'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -85,7 +85,7 @@ var Carousel = (function ($) { * ------------------------------------------------------------------------ */ - var Carousel = (function () { + var Carousel = function () { function Carousel(element, config) { _classCallCheck(this, Carousel); @@ -103,344 +103,318 @@ var Carousel = (function ($) { this._addEventListeners(); } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Carousel, [{ - key: 'next', + // public - // public + Carousel.prototype.next = function next() { + if (!this._isSliding) { + this._slide(Direction.NEXT); + } + }; - value: function next() { - if (!this._isSliding) { - this._slide(Direction.NEXT); - } + Carousel.prototype.nextWhenVisible = function nextWhenVisible() { + // Don't call next when the page isn't visible + if (!document.hidden) { + this.next(); } - }, { - key: 'nextWhenVisible', - value: function nextWhenVisible() { - // Don't call next when the page isn't visible - if (!document.hidden) { - this.next(); - } + }; + + Carousel.prototype.prev = function prev() { + if (!this._isSliding) { + this._slide(Direction.PREVIOUS); } - }, { - key: 'prev', - value: function prev() { - if (!this._isSliding) { - this._slide(Direction.PREVIOUS); - } + }; + + Carousel.prototype.pause = function pause(event) { + if (!event) { + this._isPaused = true; } - }, { - key: 'pause', - value: function pause(event) { - if (!event) { - this._isPaused = true; - } - if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) { - Util.triggerTransitionEnd(this._element); - this.cycle(true); - } + if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) { + Util.triggerTransitionEnd(this._element); + this.cycle(true); + } + clearInterval(this._interval); + this._interval = null; + }; + + Carousel.prototype.cycle = function cycle(event) { + if (!event) { + this._isPaused = false; + } + + if (this._interval) { clearInterval(this._interval); this._interval = null; } - }, { - key: 'cycle', - value: function cycle(event) { - if (!event) { - this._isPaused = false; - } - if (this._interval) { - clearInterval(this._interval); - this._interval = null; - } + if (this._config.interval && !this._isPaused) { + this._interval = setInterval($.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval); + } + }; - if (this._config.interval && !this._isPaused) { - this._interval = setInterval($.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval); - } + Carousel.prototype.to = function to(index) { + var _this = this; + + this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; + + var activeIndex = this._getItemIndex(this._activeElement); + + if (index > this._items.length - 1 || index < 0) { + return; } - }, { - key: 'to', - value: function to(index) { - var _this = this; - this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; + if (this._isSliding) { + $(this._element).one(Event.SLID, function () { + return _this.to(index); + }); + return; + } - var activeIndex = this._getItemIndex(this._activeElement); + if (activeIndex === index) { + this.pause(); + this.cycle(); + return; + } - if (index > this._items.length - 1 || index < 0) { - return; - } + var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS; - if (this._isSliding) { - $(this._element).one(Event.SLID, function () { - return _this.to(index); - }); - return; - } + this._slide(direction, this._items[index]); + }; - if (activeIndex === index) { - this.pause(); - this.cycle(); - return; - } + Carousel.prototype.dispose = function dispose() { + $(this._element).off(EVENT_KEY); + $.removeData(this._element, DATA_KEY); - var direction = index > activeIndex ? Direction.NEXT : Direction.PREVIOUS; + this._items = null; + this._config = null; + this._element = null; + this._interval = null; + this._isPaused = null; + this._isSliding = null; + this._activeElement = null; + this._indicatorsElement = null; + }; - this._slide(direction, this._items[index]); - } - }, { - key: 'dispose', - value: function dispose() { - $(this._element).off(EVENT_KEY); - $.removeData(this._element, DATA_KEY); - - this._items = null; - this._config = null; - this._element = null; - this._interval = null; - this._isPaused = null; - this._isSliding = null; - this._activeElement = null; - this._indicatorsElement = null; - } + // private - // private + Carousel.prototype._getConfig = function _getConfig(config) { + config = $.extend({}, Default, config); + Util.typeCheckConfig(NAME, config, DefaultType); + return config; + }; - }, { - key: '_getConfig', - value: function _getConfig(config) { - config = $.extend({}, Default, config); - Util.typeCheckConfig(NAME, config, DefaultType); - return config; + Carousel.prototype._addEventListeners = function _addEventListeners() { + if (this._config.keyboard) { + $(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this)); } - }, { - key: '_addEventListeners', - value: function _addEventListeners() { - if (this._config.keyboard) { - $(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this)); - } - if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) { - $(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this)); - } + if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) { + $(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this)); } - }, { - key: '_keydown', - value: function _keydown(event) { - event.preventDefault(); + }; - if (/input|textarea/i.test(event.target.tagName)) { - return; - } + Carousel.prototype._keydown = function _keydown(event) { + event.preventDefault(); - switch (event.which) { - case ARROW_LEFT_KEYCODE: - this.prev(); - break; - case ARROW_RIGHT_KEYCODE: - this.next(); - break; - default: - return; - } + if (/input|textarea/i.test(event.target.tagName)) { + return; } - }, { - key: '_getItemIndex', - value: function _getItemIndex(element) { - this._items = $.makeArray($(element).parent().find(Selector.ITEM)); - return this._items.indexOf(element); + + switch (event.which) { + case ARROW_LEFT_KEYCODE: + this.prev(); + break; + case ARROW_RIGHT_KEYCODE: + this.next(); + break; + default: + return; + } + }; + + Carousel.prototype._getItemIndex = function _getItemIndex(element) { + this._items = $.makeArray($(element).parent().find(Selector.ITEM)); + return this._items.indexOf(element); + }; + + Carousel.prototype._getItemByDirection = function _getItemByDirection(direction, activeElement) { + var isNextDirection = direction === Direction.NEXT; + var isPrevDirection = direction === Direction.PREVIOUS; + var activeIndex = this._getItemIndex(activeElement); + var lastItemIndex = this._items.length - 1; + var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; + + if (isGoingToWrap && !this._config.wrap) { + return activeElement; } - }, { - key: '_getItemByDirection', - value: function _getItemByDirection(direction, activeElement) { - var isNextDirection = direction === Direction.NEXT; - var isPrevDirection = direction === Direction.PREVIOUS; - var activeIndex = this._getItemIndex(activeElement); - var lastItemIndex = this._items.length - 1; - var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; - - if (isGoingToWrap && !this._config.wrap) { - return activeElement; - } - var delta = direction === Direction.PREVIOUS ? -1 : 1; - var itemIndex = (activeIndex + delta) % this._items.length; + var delta = direction === Direction.PREVIOUS ? -1 : 1; + var itemIndex = (activeIndex + delta) % this._items.length; - return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; - } - }, { - key: '_triggerSlideEvent', - value: function _triggerSlideEvent(relatedTarget, directionalClassname) { - var slideEvent = $.Event(Event.SLIDE, { - relatedTarget: relatedTarget, - direction: directionalClassname - }); + return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; + }; - $(this._element).trigger(slideEvent); + Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, directionalClassname) { + var slideEvent = $.Event(Event.SLIDE, { + relatedTarget: relatedTarget, + direction: directionalClassname + }); - return slideEvent; - } - }, { - key: '_setActiveIndicatorElement', - value: function _setActiveIndicatorElement(element) { - if (this._indicatorsElement) { - $(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE); + $(this._element).trigger(slideEvent); - var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; + return slideEvent; + }; - if (nextIndicator) { - $(nextIndicator).addClass(ClassName.ACTIVE); - } + Carousel.prototype._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { + if (this._indicatorsElement) { + $(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE); + + var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; + + if (nextIndicator) { + $(nextIndicator).addClass(ClassName.ACTIVE); } } - }, { - key: '_slide', - value: function _slide(direction, element) { - var _this2 = this; + }; - var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; - var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); + Carousel.prototype._slide = function _slide(direction, element) { + var _this2 = this; - var isCycling = Boolean(this._interval); + var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; + var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); - var directionalClassName = direction === Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT; + var isCycling = Boolean(this._interval); - if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) { - this._isSliding = false; - return; - } + var directionalClassName = direction === Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT; - var slideEvent = this._triggerSlideEvent(nextElement, directionalClassName); - if (slideEvent.isDefaultPrevented()) { - return; - } + if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) { + this._isSliding = false; + return; + } - if (!activeElement || !nextElement) { - // some weirdness is happening, so we bail - return; - } + var slideEvent = this._triggerSlideEvent(nextElement, directionalClassName); + if (slideEvent.isDefaultPrevented()) { + return; + } - this._isSliding = true; + if (!activeElement || !nextElement) { + // some weirdness is happening, so we bail + return; + } - if (isCycling) { - this.pause(); - } + this._isSliding = true; - this._setActiveIndicatorElement(nextElement); + if (isCycling) { + this.pause(); + } - var slidEvent = $.Event(Event.SLID, { - relatedTarget: nextElement, - direction: directionalClassName - }); + this._setActiveIndicatorElement(nextElement); - if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) { + var slidEvent = $.Event(Event.SLID, { + relatedTarget: nextElement, + direction: directionalClassName + }); - $(nextElement).addClass(direction); + if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) { - Util.reflow(nextElement); + $(nextElement).addClass(direction); - $(activeElement).addClass(directionalClassName); - $(nextElement).addClass(directionalClassName); + Util.reflow(nextElement); - $(activeElement).one(Util.TRANSITION_END, function () { - $(nextElement).removeClass(directionalClassName).removeClass(direction); + $(activeElement).addClass(directionalClassName); + $(nextElement).addClass(directionalClassName); - $(nextElement).addClass(ClassName.ACTIVE); + $(activeElement).one(Util.TRANSITION_END, function () { + $(nextElement).removeClass(directionalClassName).removeClass(direction); - $(activeElement).removeClass(ClassName.ACTIVE).removeClass(direction).removeClass(directionalClassName); + $(nextElement).addClass(ClassName.ACTIVE); - _this2._isSliding = false; + $(activeElement).removeClass(ClassName.ACTIVE).removeClass(direction).removeClass(directionalClassName); - setTimeout(function () { - return $(_this2._element).trigger(slidEvent); - }, 0); - }).emulateTransitionEnd(TRANSITION_DURATION); - } else { - $(activeElement).removeClass(ClassName.ACTIVE); - $(nextElement).addClass(ClassName.ACTIVE); + _this2._isSliding = false; - this._isSliding = false; - $(this._element).trigger(slidEvent); - } + setTimeout(function () { + return $(_this2._element).trigger(slidEvent); + }, 0); + }).emulateTransitionEnd(TRANSITION_DURATION); + } else { + $(activeElement).removeClass(ClassName.ACTIVE); + $(nextElement).addClass(ClassName.ACTIVE); - if (isCycling) { - this.cycle(); - } + this._isSliding = false; + $(this._element).trigger(slidEvent); } - // static + if (isCycling) { + this.cycle(); + } + }; - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - var _config = $.extend({}, Default, $(this).data()); + // static - if (typeof config === 'object') { - $.extend(_config, config); - } + Carousel._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); + var _config = $.extend({}, Default, $(this).data()); - var action = typeof config === 'string' ? config : _config.slide; + if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object') { + $.extend(_config, config); + } - if (!data) { - data = new Carousel(this, _config); - $(this).data(DATA_KEY, data); - } + var action = typeof config === 'string' ? config : _config.slide; - if (typeof config === 'number') { - data.to(config); - } else if (typeof action === 'string') { - if (data[action] === undefined) { - throw new Error('No method named "' + action + '"'); - } - data[action](); - } else if (_config.interval) { - data.pause(); - data.cycle(); - } - }); - } - }, { - key: '_dataApiClickHandler', - value: function _dataApiClickHandler(event) { - var selector = Util.getSelectorFromElement(this); + if (!data) { + data = new Carousel(this, _config); + $(this).data(DATA_KEY, data); + } - if (!selector) { - return; + if (typeof config === 'number') { + data.to(config); + } else if (typeof action === 'string') { + if (data[action] === undefined) { + throw new Error('No method named "' + action + '"'); + } + data[action](); + } else if (_config.interval) { + data.pause(); + data.cycle(); } + }); + }; - var target = $(selector)[0]; + Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { + var selector = Util.getSelectorFromElement(this); - if (!target || !$(target).hasClass(ClassName.CAROUSEL)) { - return; - } + if (!selector) { + return; + } - var config = $.extend({}, $(target).data(), $(this).data()); - var slideIndex = this.getAttribute('data-slide-to'); + var target = $(selector)[0]; - if (slideIndex) { - config.interval = false; - } + if (!target || !$(target).hasClass(ClassName.CAROUSEL)) { + return; + } - Carousel._jQueryInterface.call($(target), config); + var config = $.extend({}, $(target).data(), $(this).data()); + var slideIndex = this.getAttribute('data-slide-to'); - if (slideIndex) { - $(target).data(DATA_KEY).to(slideIndex); - } + if (slideIndex) { + config.interval = false; + } - event.preventDefault(); + Carousel._jQueryInterface.call($(target), config); + + if (slideIndex) { + $(target).data(DATA_KEY).to(slideIndex); } - }, { + + event.preventDefault(); + }; + + _createClass(Carousel, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -453,7 +427,13 @@ var Carousel = (function ($) { }]); return Carousel; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); @@ -478,4 +458,4 @@ var Carousel = (function ($) { }; return Carousel; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/collapse.js b/assets/javascripts/bootstrap/collapse.js index 60b953a..cd3caa7 100644 --- a/assets/javascripts/bootstrap/collapse.js +++ b/assets/javascripts/bootstrap/collapse.js @@ -1,17 +1,17 @@ -'use strict'; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): collapse.js + * Bootstrap (v4.0.0-alpha.5): collapse.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Collapse = (function ($) { +var Collapse = function ($) { /** * ------------------------------------------------------------------------ @@ -20,7 +20,7 @@ var Collapse = (function ($) { */ var NAME = 'collapse'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.collapse'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -58,7 +58,7 @@ var Collapse = (function ($) { }; var Selector = { - ACTIVES: '.panel > .in, .panel > .collapsing', + ACTIVES: '.card > .in, .card > .collapsing', DATA_TOGGLE: '[data-toggle="collapse"]' }; @@ -68,7 +68,7 @@ var Collapse = (function ($) { * ------------------------------------------------------------------------ */ - var Collapse = (function () { + var Collapse = function () { function Collapse(element, config) { _classCallCheck(this, Collapse); @@ -88,240 +88,220 @@ var Collapse = (function ($) { } } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Collapse, [{ - key: 'toggle', + // public + + Collapse.prototype.toggle = function toggle() { + if ($(this._element).hasClass(ClassName.IN)) { + this.hide(); + } else { + this.show(); + } + }; - // public + Collapse.prototype.show = function show() { + var _this = this; + + if (this._isTransitioning || $(this._element).hasClass(ClassName.IN)) { + return; + } - value: function toggle() { - if ($(this._element).hasClass(ClassName.IN)) { - this.hide(); - } else { - this.show(); + var actives = void 0; + var activesData = void 0; + + if (this._parent) { + actives = $.makeArray($(Selector.ACTIVES)); + if (!actives.length) { + actives = null; } } - }, { - key: 'show', - value: function show() { - var _this = this; - if (this._isTransitioning || $(this._element).hasClass(ClassName.IN)) { + if (actives) { + activesData = $(actives).data(DATA_KEY); + if (activesData && activesData._isTransitioning) { return; } + } - var actives = undefined; - var activesData = undefined; + var startEvent = $.Event(Event.SHOW); + $(this._element).trigger(startEvent); + if (startEvent.isDefaultPrevented()) { + return; + } - if (this._parent) { - actives = $.makeArray($(Selector.ACTIVES)); - if (!actives.length) { - actives = null; - } + if (actives) { + Collapse._jQueryInterface.call($(actives), 'hide'); + if (!activesData) { + $(actives).data(DATA_KEY, null); } + } - if (actives) { - activesData = $(actives).data(DATA_KEY); - if (activesData && activesData._isTransitioning) { - return; - } - } + var dimension = this._getDimension(); - var startEvent = $.Event(Event.SHOW); - $(this._element).trigger(startEvent); - if (startEvent.isDefaultPrevented()) { - return; - } + $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); - if (actives) { - Collapse._jQueryInterface.call($(actives), 'hide'); - if (!activesData) { - $(actives).data(DATA_KEY, null); - } - } + this._element.style[dimension] = 0; + this._element.setAttribute('aria-expanded', true); - var dimension = this._getDimension(); + if (this._triggerArray.length) { + $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); + } - $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); + this.setTransitioning(true); - this._element.style[dimension] = 0; - this._element.setAttribute('aria-expanded', true); + var complete = function complete() { + $(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.IN); - if (this._triggerArray.length) { - $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); - } + _this._element.style[dimension] = ''; - this.setTransitioning(true); + _this.setTransitioning(false); - var complete = function complete() { - $(_this._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.IN); + $(_this._element).trigger(Event.SHOWN); + }; - _this._element.style[dimension] = ''; + if (!Util.supportsTransitionEnd()) { + complete(); + return; + } - _this.setTransitioning(false); + var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); + var scrollSize = 'scroll' + capitalizedDimension; - $(_this._element).trigger(Event.SHOWN); - }; + $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); - if (!Util.supportsTransitionEnd()) { - complete(); - return; - } + this._element.style[dimension] = this._element[scrollSize] + 'px'; + }; - var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); - var scrollSize = 'scroll' + capitalizedDimension; + Collapse.prototype.hide = function hide() { + var _this2 = this; - $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); + if (this._isTransitioning || !$(this._element).hasClass(ClassName.IN)) { + return; + } - this._element.style[dimension] = this._element[scrollSize] + 'px'; + var startEvent = $.Event(Event.HIDE); + $(this._element).trigger(startEvent); + if (startEvent.isDefaultPrevented()) { + return; } - }, { - key: 'hide', - value: function hide() { - var _this2 = this; - if (this._isTransitioning || !$(this._element).hasClass(ClassName.IN)) { - return; - } + var dimension = this._getDimension(); + var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight'; - var startEvent = $.Event(Event.HIDE); - $(this._element).trigger(startEvent); - if (startEvent.isDefaultPrevented()) { - return; - } + this._element.style[dimension] = this._element[offsetDimension] + 'px'; - var dimension = this._getDimension(); - var offsetDimension = dimension === Dimension.WIDTH ? 'offsetWidth' : 'offsetHeight'; + Util.reflow(this._element); - this._element.style[dimension] = this._element[offsetDimension] + 'px'; + $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.IN); - Util.reflow(this._element); + this._element.setAttribute('aria-expanded', false); - $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.IN); + if (this._triggerArray.length) { + $(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); + } - this._element.setAttribute('aria-expanded', false); + this.setTransitioning(true); - if (this._triggerArray.length) { - $(this._triggerArray).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); - } + var complete = function complete() { + _this2.setTransitioning(false); + $(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN); + }; - this.setTransitioning(true); + this._element.style[dimension] = ''; - var complete = function complete() { - _this2.setTransitioning(false); - $(_this2._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN); - }; + if (!Util.supportsTransitionEnd()) { + complete(); + return; + } - this._element.style[dimension] = 0; + $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); + }; - if (!Util.supportsTransitionEnd()) { - complete(); - return; - } + Collapse.prototype.setTransitioning = function setTransitioning(isTransitioning) { + this._isTransitioning = isTransitioning; + }; - $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); - } - }, { - key: 'setTransitioning', - value: function setTransitioning(isTransitioning) { - this._isTransitioning = isTransitioning; - } - }, { - key: 'dispose', - value: function dispose() { - $.removeData(this._element, DATA_KEY); - - this._config = null; - this._parent = null; - this._element = null; - this._triggerArray = null; - this._isTransitioning = null; - } + Collapse.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); - // private + this._config = null; + this._parent = null; + this._element = null; + this._triggerArray = null; + this._isTransitioning = null; + }; - }, { - key: '_getConfig', - value: function _getConfig(config) { - config = $.extend({}, Default, config); - config.toggle = Boolean(config.toggle); // coerce string values - Util.typeCheckConfig(NAME, config, DefaultType); - return config; - } - }, { - key: '_getDimension', - value: function _getDimension() { - var hasWidth = $(this._element).hasClass(Dimension.WIDTH); - return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; - } - }, { - key: '_getParent', - value: function _getParent() { - var _this3 = this; + // private - var parent = $(this._config.parent)[0]; - var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]'; + Collapse.prototype._getConfig = function _getConfig(config) { + config = $.extend({}, Default, config); + config.toggle = Boolean(config.toggle); // coerce string values + Util.typeCheckConfig(NAME, config, DefaultType); + return config; + }; - $(parent).find(selector).each(function (i, element) { - _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); - }); + Collapse.prototype._getDimension = function _getDimension() { + var hasWidth = $(this._element).hasClass(Dimension.WIDTH); + return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; + }; - return parent; - } - }, { - key: '_addAriaAndCollapsedClass', - value: function _addAriaAndCollapsedClass(element, triggerArray) { - if (element) { - var isOpen = $(element).hasClass(ClassName.IN); - element.setAttribute('aria-expanded', isOpen); - - if (triggerArray.length) { - $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); - } + Collapse.prototype._getParent = function _getParent() { + var _this3 = this; + + var parent = $(this._config.parent)[0]; + var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]'; + + $(parent).find(selector).each(function (i, element) { + _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); + }); + + return parent; + }; + + Collapse.prototype._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { + if (element) { + var isOpen = $(element).hasClass(ClassName.IN); + element.setAttribute('aria-expanded', isOpen); + + if (triggerArray.length) { + $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); } } + }; - // static + // static - }], [{ - key: '_getTargetFromElement', - value: function _getTargetFromElement(element) { - var selector = Util.getSelectorFromElement(element); - return selector ? $(selector)[0] : null; - } - }, { - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var $this = $(this); - var data = $this.data(DATA_KEY); - var _config = $.extend({}, Default, $this.data(), typeof config === 'object' && config); - - if (!data && _config.toggle && /show|hide/.test(config)) { - _config.toggle = false; - } + Collapse._getTargetFromElement = function _getTargetFromElement(element) { + var selector = Util.getSelectorFromElement(element); + return selector ? $(selector)[0] : null; + }; - if (!data) { - data = new Collapse(this, _config); - $this.data(DATA_KEY, data); - } + Collapse._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var $this = $(this); + var data = $this.data(DATA_KEY); + var _config = $.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config); - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config](); + if (!data && _config.toggle && /show|hide/.test(config)) { + _config.toggle = false; + } + + if (!data) { + data = new Collapse(this, _config); + $this.data(DATA_KEY, data); + } + + if (typeof config === 'string') { + if (data[config] === undefined) { + throw new Error('No method named "' + config + '"'); } - }); - } - }, { + data[config](); + } + }); + }; + + _createClass(Collapse, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -334,7 +314,13 @@ var Collapse = (function ($) { }]); return Collapse; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { event.preventDefault(); @@ -360,4 +346,4 @@ var Collapse = (function ($) { }; return Collapse; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/dropdown.js b/assets/javascripts/bootstrap/dropdown.js index 242ac91..0f53f14 100644 --- a/assets/javascripts/bootstrap/dropdown.js +++ b/assets/javascripts/bootstrap/dropdown.js @@ -1,17 +1,15 @@ -'use strict'; +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): dropdown.js + * Bootstrap (v4.0.0-alpha.5): dropdown.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Dropdown = (function ($) { +var Dropdown = function ($) { /** * ------------------------------------------------------------------------ @@ -20,7 +18,7 @@ var Dropdown = (function ($) { */ var NAME = 'dropdown'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.dropdown'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -62,7 +60,7 @@ var Dropdown = (function ($) { * ------------------------------------------------------------------------ */ - var Dropdown = (function () { + var Dropdown = function () { function Dropdown(element) { _classCallCheck(this, Dropdown); @@ -71,201 +69,185 @@ var Dropdown = (function ($) { this._addEventListeners(); } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Dropdown, [{ - key: 'toggle', + // public - // public + Dropdown.prototype.toggle = function toggle() { + if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { + return false; + } - value: function toggle() { - if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { - return false; - } + var parent = Dropdown._getParentFromElement(this); + var isActive = $(parent).hasClass(ClassName.OPEN); - var parent = Dropdown._getParentFromElement(this); - var isActive = $(parent).hasClass(ClassName.OPEN); + Dropdown._clearMenus(); - Dropdown._clearMenus(); + if (isActive) { + return false; + } - if (isActive) { - return false; - } + if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) { - if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) { + // if mobile we use a backdrop because click events don't delegate + var dropdown = document.createElement('div'); + dropdown.className = ClassName.BACKDROP; + $(dropdown).insertBefore(this); + $(dropdown).on('click', Dropdown._clearMenus); + } - // if mobile we use a backdrop because click events don't delegate - var dropdown = document.createElement('div'); - dropdown.className = ClassName.BACKDROP; - $(dropdown).insertBefore(this); - $(dropdown).on('click', Dropdown._clearMenus); - } + var relatedTarget = { relatedTarget: this }; + var showEvent = $.Event(Event.SHOW, relatedTarget); - var relatedTarget = { relatedTarget: this }; - var showEvent = $.Event(Event.SHOW, relatedTarget); + $(parent).trigger(showEvent); - $(parent).trigger(showEvent); + if (showEvent.isDefaultPrevented()) { + return false; + } - if (showEvent.isDefaultPrevented()) { - return false; - } + this.focus(); + this.setAttribute('aria-expanded', 'true'); - this.focus(); - this.setAttribute('aria-expanded', 'true'); + $(parent).toggleClass(ClassName.OPEN); + $(parent).trigger($.Event(Event.SHOWN, relatedTarget)); - $(parent).toggleClass(ClassName.OPEN); - $(parent).trigger($.Event(Event.SHOWN, relatedTarget)); + return false; + }; - return false; - } - }, { - key: 'dispose', - value: function dispose() { - $.removeData(this._element, DATA_KEY); - $(this._element).off(EVENT_KEY); - this._element = null; - } + Dropdown.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + $(this._element).off(EVENT_KEY); + this._element = null; + }; - // private + // private - }, { - key: '_addEventListeners', - value: function _addEventListeners() { - $(this._element).on(Event.CLICK, this.toggle); - } + Dropdown.prototype._addEventListeners = function _addEventListeners() { + $(this._element).on(Event.CLICK, this.toggle); + }; - // static + // static - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); + Dropdown._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); - if (!data) { - $(this).data(DATA_KEY, data = new Dropdown(this)); - } - - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config].call(this); - } - }); - } - }, { - key: '_clearMenus', - value: function _clearMenus(event) { - if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) { - return; + if (!data) { + $(this).data(DATA_KEY, data = new Dropdown(this)); } - var backdrop = $(Selector.BACKDROP)[0]; - if (backdrop) { - backdrop.parentNode.removeChild(backdrop); + if (typeof config === 'string') { + if (data[config] === undefined) { + throw new Error('No method named "' + config + '"'); + } + data[config].call(this); } + }); + }; - var toggles = $.makeArray($(Selector.DATA_TOGGLE)); + Dropdown._clearMenus = function _clearMenus(event) { + if (event && event.which === RIGHT_MOUSE_BUTTON_WHICH) { + return; + } - for (var i = 0; i < toggles.length; i++) { - var _parent = Dropdown._getParentFromElement(toggles[i]); - var relatedTarget = { relatedTarget: toggles[i] }; + var backdrop = $(Selector.BACKDROP)[0]; + if (backdrop) { + backdrop.parentNode.removeChild(backdrop); + } - if (!$(_parent).hasClass(ClassName.OPEN)) { - continue; - } + var toggles = $.makeArray($(Selector.DATA_TOGGLE)); - if (event && event.type === 'click' && /input|textarea/i.test(event.target.tagName) && $.contains(_parent, event.target)) { - continue; - } + for (var i = 0; i < toggles.length; i++) { + var parent = Dropdown._getParentFromElement(toggles[i]); + var relatedTarget = { relatedTarget: toggles[i] }; - var hideEvent = $.Event(Event.HIDE, relatedTarget); - $(_parent).trigger(hideEvent); - if (hideEvent.isDefaultPrevented()) { - continue; - } + if (!$(parent).hasClass(ClassName.OPEN)) { + continue; + } - toggles[i].setAttribute('aria-expanded', 'false'); + if (event && event.type === 'click' && /input|textarea/i.test(event.target.tagName) && $.contains(parent, event.target)) { + continue; + } - $(_parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget)); + var hideEvent = $.Event(Event.HIDE, relatedTarget); + $(parent).trigger(hideEvent); + if (hideEvent.isDefaultPrevented()) { + continue; } + + toggles[i].setAttribute('aria-expanded', 'false'); + + $(parent).removeClass(ClassName.OPEN).trigger($.Event(Event.HIDDEN, relatedTarget)); } - }, { - key: '_getParentFromElement', - value: function _getParentFromElement(element) { - var parent = undefined; - var selector = Util.getSelectorFromElement(element); - - if (selector) { - parent = $(selector)[0]; - } + }; + + Dropdown._getParentFromElement = function _getParentFromElement(element) { + var parent = void 0; + var selector = Util.getSelectorFromElement(element); - return parent || element.parentNode; + if (selector) { + parent = $(selector)[0]; } - }, { - key: '_dataApiKeydownHandler', - value: function _dataApiKeydownHandler(event) { - if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) { - return; - } - event.preventDefault(); - event.stopPropagation(); + return parent || element.parentNode; + }; - if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { - return; - } + Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { + if (!/(38|40|27|32)/.test(event.which) || /input|textarea/i.test(event.target.tagName)) { + return; + } - var parent = Dropdown._getParentFromElement(this); - var isActive = $(parent).hasClass(ClassName.OPEN); + event.preventDefault(); + event.stopPropagation(); - if (!isActive && event.which !== ESCAPE_KEYCODE || isActive && event.which === ESCAPE_KEYCODE) { + if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { + return; + } - if (event.which === ESCAPE_KEYCODE) { - var toggle = $(parent).find(Selector.DATA_TOGGLE)[0]; - $(toggle).trigger('focus'); - } + var parent = Dropdown._getParentFromElement(this); + var isActive = $(parent).hasClass(ClassName.OPEN); - $(this).trigger('click'); - return; + if (!isActive && event.which !== ESCAPE_KEYCODE || isActive && event.which === ESCAPE_KEYCODE) { + + if (event.which === ESCAPE_KEYCODE) { + var toggle = $(parent).find(Selector.DATA_TOGGLE)[0]; + $(toggle).trigger('focus'); } - var items = $.makeArray($(Selector.VISIBLE_ITEMS)); + $(this).trigger('click'); + return; + } - items = items.filter(function (item) { - return item.offsetWidth || item.offsetHeight; - }); + var items = $.makeArray($(Selector.VISIBLE_ITEMS)); - if (!items.length) { - return; - } + items = items.filter(function (item) { + return item.offsetWidth || item.offsetHeight; + }); - var index = items.indexOf(event.target); + if (!items.length) { + return; + } - if (event.which === ARROW_UP_KEYCODE && index > 0) { - // up - index--; - } + var index = items.indexOf(event.target); - if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { - // down - index++; - } + if (event.which === ARROW_UP_KEYCODE && index > 0) { + // up + index--; + } - if (index < 0) { - index = 0; - } + if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { + // down + index++; + } - items[index].focus(); + if (index < 0) { + index = 0; } - }, { + + items[index].focus(); + }; + + _createClass(Dropdown, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -273,7 +255,13 @@ var Dropdown = (function ($) { }]); return Dropdown; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_MENU, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.ROLE_LISTBOX, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, Dropdown.prototype.toggle).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) { e.stopPropagation(); @@ -293,4 +281,4 @@ var Dropdown = (function ($) { }; return Dropdown; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/modal.js b/assets/javascripts/bootstrap/modal.js index 8d1b82d..f2e2f74 100644 --- a/assets/javascripts/bootstrap/modal.js +++ b/assets/javascripts/bootstrap/modal.js @@ -1,17 +1,17 @@ -'use strict'; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): modal.js + * Bootstrap (v4.0.0-alpha.5): modal.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Modal = (function ($) { +var Modal = function ($) { /** * ------------------------------------------------------------------------ @@ -20,7 +20,7 @@ var Modal = (function ($) { */ var NAME = 'modal'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.modal'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -78,7 +78,7 @@ var Modal = (function ($) { * ------------------------------------------------------------------------ */ - var Modal = (function () { + var Modal = function () { function Modal(element, config) { _classCallCheck(this, Modal); @@ -93,382 +93,352 @@ var Modal = (function ($) { this._scrollbarWidth = 0; } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Modal, [{ - key: 'toggle', + // public - // public + Modal.prototype.toggle = function toggle(relatedTarget) { + return this._isShown ? this.hide() : this.show(relatedTarget); + }; - value: function toggle(relatedTarget) { - return this._isShown ? this.hide() : this.show(relatedTarget); - } - }, { - key: 'show', - value: function show(relatedTarget) { - var _this = this; + Modal.prototype.show = function show(relatedTarget) { + var _this = this; - var showEvent = $.Event(Event.SHOW, { - relatedTarget: relatedTarget - }); + var showEvent = $.Event(Event.SHOW, { + relatedTarget: relatedTarget + }); - $(this._element).trigger(showEvent); + $(this._element).trigger(showEvent); - if (this._isShown || showEvent.isDefaultPrevented()) { - return; - } + if (this._isShown || showEvent.isDefaultPrevented()) { + return; + } - this._isShown = true; + this._isShown = true; - this._checkScrollbar(); - this._setScrollbar(); + this._checkScrollbar(); + this._setScrollbar(); - $(document.body).addClass(ClassName.OPEN); + $(document.body).addClass(ClassName.OPEN); - this._setEscapeEvent(); - this._setResizeEvent(); + this._setEscapeEvent(); + this._setResizeEvent(); - $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this)); + $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this)); - $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () { - $(_this._element).one(Event.MOUSEUP_DISMISS, function (event) { - if ($(event.target).is(_this._element)) { - _this._ignoreBackdropClick = true; - } - }); + $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () { + $(_this._element).one(Event.MOUSEUP_DISMISS, function (event) { + if ($(event.target).is(_this._element)) { + _this._ignoreBackdropClick = true; + } }); + }); + + this._showBackdrop($.proxy(this._showElement, this, relatedTarget)); + }; - this._showBackdrop($.proxy(this._showElement, this, relatedTarget)); + Modal.prototype.hide = function hide(event) { + if (event) { + event.preventDefault(); } - }, { - key: 'hide', - value: function hide(event) { - if (event) { - event.preventDefault(); - } - var hideEvent = $.Event(Event.HIDE); + var hideEvent = $.Event(Event.HIDE); - $(this._element).trigger(hideEvent); + $(this._element).trigger(hideEvent); - if (!this._isShown || hideEvent.isDefaultPrevented()) { - return; - } + if (!this._isShown || hideEvent.isDefaultPrevented()) { + return; + } - this._isShown = false; + this._isShown = false; - this._setEscapeEvent(); - this._setResizeEvent(); + this._setEscapeEvent(); + this._setResizeEvent(); - $(document).off(Event.FOCUSIN); + $(document).off(Event.FOCUSIN); - $(this._element).removeClass(ClassName.IN); + $(this._element).removeClass(ClassName.IN); - $(this._element).off(Event.CLICK_DISMISS); - $(this._dialog).off(Event.MOUSEDOWN_DISMISS); + $(this._element).off(Event.CLICK_DISMISS); + $(this._dialog).off(Event.MOUSEDOWN_DISMISS); - if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { + if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { - $(this._element).one(Util.TRANSITION_END, $.proxy(this._hideModal, this)).emulateTransitionEnd(TRANSITION_DURATION); - } else { - this._hideModal(); - } - } - }, { - key: 'dispose', - value: function dispose() { - $.removeData(this._element, DATA_KEY); - - $(window).off(EVENT_KEY); - $(document).off(EVENT_KEY); - $(this._element).off(EVENT_KEY); - $(this._backdrop).off(EVENT_KEY); - - this._config = null; - this._element = null; - this._dialog = null; - this._backdrop = null; - this._isShown = null; - this._isBodyOverflowing = null; - this._ignoreBackdropClick = null; - this._originalBodyPadding = null; - this._scrollbarWidth = null; + $(this._element).one(Util.TRANSITION_END, $.proxy(this._hideModal, this)).emulateTransitionEnd(TRANSITION_DURATION); + } else { + this._hideModal(); } + }; - // private + Modal.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); - }, { - key: '_getConfig', - value: function _getConfig(config) { - config = $.extend({}, Default, config); - Util.typeCheckConfig(NAME, config, DefaultType); - return config; + $(window).off(EVENT_KEY); + $(document).off(EVENT_KEY); + $(this._element).off(EVENT_KEY); + $(this._backdrop).off(EVENT_KEY); + + this._config = null; + this._element = null; + this._dialog = null; + this._backdrop = null; + this._isShown = null; + this._isBodyOverflowing = null; + this._ignoreBackdropClick = null; + this._originalBodyPadding = null; + this._scrollbarWidth = null; + }; + + // private + + Modal.prototype._getConfig = function _getConfig(config) { + config = $.extend({}, Default, config); + Util.typeCheckConfig(NAME, config, DefaultType); + return config; + }; + + Modal.prototype._showElement = function _showElement(relatedTarget) { + var _this2 = this; + + var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE); + + if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { + // don't move modals dom position + document.body.appendChild(this._element); } - }, { - key: '_showElement', - value: function _showElement(relatedTarget) { - var _this2 = this; - var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE); + this._element.style.display = 'block'; + this._element.removeAttribute('aria-hidden'); + this._element.scrollTop = 0; - if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { - // don't move modals dom position - document.body.appendChild(this._element); - } + if (transition) { + Util.reflow(this._element); + } - this._element.style.display = 'block'; - this._element.removeAttribute('aria-hidden'); - this._element.scrollTop = 0; + $(this._element).addClass(ClassName.IN); - if (transition) { - Util.reflow(this._element); - } + if (this._config.focus) { + this._enforceFocus(); + } - $(this._element).addClass(ClassName.IN); + var shownEvent = $.Event(Event.SHOWN, { + relatedTarget: relatedTarget + }); - if (this._config.focus) { - this._enforceFocus(); + var transitionComplete = function transitionComplete() { + if (_this2._config.focus) { + _this2._element.focus(); } + $(_this2._element).trigger(shownEvent); + }; - var shownEvent = $.Event(Event.SHOWN, { - relatedTarget: relatedTarget - }); + if (transition) { + $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION); + } else { + transitionComplete(); + } + }; - var transitionComplete = function transitionComplete() { - if (_this2._config.focus) { - _this2._element.focus(); - } - $(_this2._element).trigger(shownEvent); - }; + Modal.prototype._enforceFocus = function _enforceFocus() { + var _this3 = this; - if (transition) { - $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION); - } else { - transitionComplete(); + $(document).off(Event.FOCUSIN) // guard against infinite focus loop + .on(Event.FOCUSIN, function (event) { + if (document !== event.target && _this3._element !== event.target && !$(_this3._element).has(event.target).length) { + _this3._element.focus(); } - } - }, { - key: '_enforceFocus', - value: function _enforceFocus() { - var _this3 = this; - - $(document).off(Event.FOCUSIN) // guard against infinite focus loop - .on(Event.FOCUSIN, function (event) { - if (document !== event.target && _this3._element !== event.target && !$(_this3._element).has(event.target).length) { - _this3._element.focus(); + }); + }; + + Modal.prototype._setEscapeEvent = function _setEscapeEvent() { + var _this4 = this; + + if (this._isShown && this._config.keyboard) { + $(this._element).on(Event.KEYDOWN_DISMISS, function (event) { + if (event.which === ESCAPE_KEYCODE) { + _this4.hide(); } }); + } else if (!this._isShown) { + $(this._element).off(Event.KEYDOWN_DISMISS); } - }, { - key: '_setEscapeEvent', - value: function _setEscapeEvent() { - var _this4 = this; - - if (this._isShown && this._config.keyboard) { - $(this._element).on(Event.KEYDOWN_DISMISS, function (event) { - if (event.which === ESCAPE_KEYCODE) { - _this4.hide(); - } - }); - } else if (!this._isShown) { - $(this._element).off(Event.KEYDOWN_DISMISS); - } - } - }, { - key: '_setResizeEvent', - value: function _setResizeEvent() { - if (this._isShown) { - $(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this)); - } else { - $(window).off(Event.RESIZE); - } - } - }, { - key: '_hideModal', - value: function _hideModal() { - var _this5 = this; - - this._element.style.display = 'none'; - this._element.setAttribute('aria-hidden', 'true'); - this._showBackdrop(function () { - $(document.body).removeClass(ClassName.OPEN); - _this5._resetAdjustments(); - _this5._resetScrollbar(); - $(_this5._element).trigger(Event.HIDDEN); - }); + }; + + Modal.prototype._setResizeEvent = function _setResizeEvent() { + if (this._isShown) { + $(window).on(Event.RESIZE, $.proxy(this._handleUpdate, this)); + } else { + $(window).off(Event.RESIZE); } - }, { - key: '_removeBackdrop', - value: function _removeBackdrop() { - if (this._backdrop) { - $(this._backdrop).remove(); - this._backdrop = null; - } + }; + + Modal.prototype._hideModal = function _hideModal() { + var _this5 = this; + + this._element.style.display = 'none'; + this._element.setAttribute('aria-hidden', 'true'); + this._showBackdrop(function () { + $(document.body).removeClass(ClassName.OPEN); + _this5._resetAdjustments(); + _this5._resetScrollbar(); + $(_this5._element).trigger(Event.HIDDEN); + }); + }; + + Modal.prototype._removeBackdrop = function _removeBackdrop() { + if (this._backdrop) { + $(this._backdrop).remove(); + this._backdrop = null; } - }, { - key: '_showBackdrop', - value: function _showBackdrop(callback) { - var _this6 = this; + }; - var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : ''; + Modal.prototype._showBackdrop = function _showBackdrop(callback) { + var _this6 = this; - if (this._isShown && this._config.backdrop) { - var doAnimate = Util.supportsTransitionEnd() && animate; + var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : ''; - this._backdrop = document.createElement('div'); - this._backdrop.className = ClassName.BACKDROP; + if (this._isShown && this._config.backdrop) { + var doAnimate = Util.supportsTransitionEnd() && animate; - if (animate) { - $(this._backdrop).addClass(animate); - } + this._backdrop = document.createElement('div'); + this._backdrop.className = ClassName.BACKDROP; - $(this._backdrop).appendTo(document.body); - - $(this._element).on(Event.CLICK_DISMISS, function (event) { - if (_this6._ignoreBackdropClick) { - _this6._ignoreBackdropClick = false; - return; - } - if (event.target !== event.currentTarget) { - return; - } - if (_this6._config.backdrop === 'static') { - _this6._element.focus(); - } else { - _this6.hide(); - } - }); - - if (doAnimate) { - Util.reflow(this._backdrop); - } + if (animate) { + $(this._backdrop).addClass(animate); + } - $(this._backdrop).addClass(ClassName.IN); + $(this._backdrop).appendTo(document.body); - if (!callback) { + $(this._element).on(Event.CLICK_DISMISS, function (event) { + if (_this6._ignoreBackdropClick) { + _this6._ignoreBackdropClick = false; return; } - - if (!doAnimate) { - callback(); + if (event.target !== event.currentTarget) { return; } - - $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); - } else if (!this._isShown && this._backdrop) { - $(this._backdrop).removeClass(ClassName.IN); - - var callbackRemove = function callbackRemove() { - _this6._removeBackdrop(); - if (callback) { - callback(); - } - }; - - if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { - $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); + if (_this6._config.backdrop === 'static') { + _this6._element.focus(); } else { - callbackRemove(); + _this6.hide(); } - } else if (callback) { - callback(); - } - } + }); - // ---------------------------------------------------------------------- - // the following methods are used to handle overflowing modals - // todo (fat): these should probably be refactored out of modal.js - // ---------------------------------------------------------------------- + if (doAnimate) { + Util.reflow(this._backdrop); + } - }, { - key: '_handleUpdate', - value: function _handleUpdate() { - this._adjustDialog(); - } - }, { - key: '_adjustDialog', - value: function _adjustDialog() { - var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; + $(this._backdrop).addClass(ClassName.IN); - if (!this._isBodyOverflowing && isModalOverflowing) { - this._element.style.paddingLeft = this._scrollbarWidth + 'px'; + if (!callback) { + return; } - if (this._isBodyOverflowing && !isModalOverflowing) { - this._element.style.paddingRight = this._scrollbarWidth + 'px'; + if (!doAnimate) { + callback(); + return; } - } - }, { - key: '_resetAdjustments', - value: function _resetAdjustments() { - this._element.style.paddingLeft = ''; - this._element.style.paddingRight = ''; - } - }, { - key: '_checkScrollbar', - value: function _checkScrollbar() { - this._isBodyOverflowing = document.body.clientWidth < window.innerWidth; - this._scrollbarWidth = this._getScrollbarWidth(); - } - }, { - key: '_setScrollbar', - value: function _setScrollbar() { - var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10); - this._originalBodyPadding = document.body.style.paddingRight || ''; + $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); + } else if (!this._isShown && this._backdrop) { + $(this._backdrop).removeClass(ClassName.IN); - if (this._isBodyOverflowing) { - document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px'; + var callbackRemove = function callbackRemove() { + _this6._removeBackdrop(); + if (callback) { + callback(); + } + }; + + if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { + $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); + } else { + callbackRemove(); } + } else if (callback) { + callback(); } - }, { - key: '_resetScrollbar', - value: function _resetScrollbar() { - document.body.style.paddingRight = this._originalBodyPadding; + }; + + // ---------------------------------------------------------------------- + // the following methods are used to handle overflowing modals + // todo (fat): these should probably be refactored out of modal.js + // ---------------------------------------------------------------------- + + Modal.prototype._handleUpdate = function _handleUpdate() { + this._adjustDialog(); + }; + + Modal.prototype._adjustDialog = function _adjustDialog() { + var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; + + if (!this._isBodyOverflowing && isModalOverflowing) { + this._element.style.paddingLeft = this._scrollbarWidth + 'px'; } - }, { - key: '_getScrollbarWidth', - value: function _getScrollbarWidth() { - // thx d.walsh - var scrollDiv = document.createElement('div'); - scrollDiv.className = ClassName.SCROLLBAR_MEASURER; - document.body.appendChild(scrollDiv); - var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - return scrollbarWidth; + + if (this._isBodyOverflowing && !isModalOverflowing) { + this._element.style.paddingRight = this._scrollbarWidth + 'px'; } + }; - // static + Modal.prototype._resetAdjustments = function _resetAdjustments() { + this._element.style.paddingLeft = ''; + this._element.style.paddingRight = ''; + }; - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config, relatedTarget) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - var _config = $.extend({}, Modal.Default, $(this).data(), typeof config === 'object' && config); + Modal.prototype._checkScrollbar = function _checkScrollbar() { + this._isBodyOverflowing = document.body.clientWidth < window.innerWidth; + this._scrollbarWidth = this._getScrollbarWidth(); + }; - if (!data) { - data = new Modal(this, _config); - $(this).data(DATA_KEY, data); - } + Modal.prototype._setScrollbar = function _setScrollbar() { + var bodyPadding = parseInt($(Selector.FIXED_CONTENT).css('padding-right') || 0, 10); - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config](relatedTarget); - } else if (_config.show) { - data.show(relatedTarget); - } - }); + this._originalBodyPadding = document.body.style.paddingRight || ''; + + if (this._isBodyOverflowing) { + document.body.style.paddingRight = bodyPadding + this._scrollbarWidth + 'px'; } - }, { + }; + + Modal.prototype._resetScrollbar = function _resetScrollbar() { + document.body.style.paddingRight = this._originalBodyPadding; + }; + + Modal.prototype._getScrollbarWidth = function _getScrollbarWidth() { + // thx d.walsh + var scrollDiv = document.createElement('div'); + scrollDiv.className = ClassName.SCROLLBAR_MEASURER; + document.body.appendChild(scrollDiv); + var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; + document.body.removeChild(scrollDiv); + return scrollbarWidth; + }; + + // static + + Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { + return this.each(function () { + var data = $(this).data(DATA_KEY); + var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config); + + if (!data) { + data = new Modal(this, _config); + $(this).data(DATA_KEY, data); + } + + if (typeof config === 'string') { + if (data[config] === undefined) { + throw new Error('No method named "' + config + '"'); + } + data[config](relatedTarget); + } else if (_config.show) { + data.show(relatedTarget); + } + }); + }; + + _createClass(Modal, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -481,12 +451,18 @@ var Modal = (function ($) { }]); return Modal; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { var _this7 = this; - var target = undefined; + var target = void 0; var selector = Util.getSelectorFromElement(this); if (selector) { @@ -529,4 +505,4 @@ var Modal = (function ($) { }; return Modal; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/popover.js b/assets/javascripts/bootstrap/popover.js index 19b3327..84efc68 100644 --- a/assets/javascripts/bootstrap/popover.js +++ b/assets/javascripts/bootstrap/popover.js @@ -1,21 +1,21 @@ -'use strict'; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } -function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): popover.js + * Bootstrap (v4.0.0-alpha.5): popover.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Popover = (function ($) { +var Popover = function ($) { /** * ------------------------------------------------------------------------ @@ -24,7 +24,7 @@ var Popover = (function ($) { */ var NAME = 'popover'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.popover'; var EVENT_KEY = '.' + DATA_KEY; var JQUERY_NO_CONFLICT = $.fn[NAME]; @@ -33,7 +33,7 @@ var Popover = (function ($) { placement: 'right', trigger: 'click', content: '', - template: '' + template: '' }); var DefaultType = $.extend({}, Tooltip.DefaultType, { @@ -47,8 +47,7 @@ var Popover = (function ($) { var Selector = { TITLE: '.popover-title', - CONTENT: '.popover-content', - ARROW: '.popover-arrow' + CONTENT: '.popover-content' }; var Event = { @@ -70,85 +69,72 @@ var Popover = (function ($) { * ------------------------------------------------------------------------ */ - var Popover = (function (_Tooltip) { + var Popover = function (_Tooltip) { _inherits(Popover, _Tooltip); function Popover() { _classCallCheck(this, Popover); - _get(Object.getPrototypeOf(Popover.prototype), 'constructor', this).apply(this, arguments); + return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments)); } - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ + // overrides - _createClass(Popover, [{ - key: 'isWithContent', + Popover.prototype.isWithContent = function isWithContent() { + return this.getTitle() || this._getContent(); + }; - // overrides + Popover.prototype.getTipElement = function getTipElement() { + return this.tip = this.tip || $(this.config.template)[0]; + }; - value: function isWithContent() { - return this.getTitle() || this._getContent(); - } - }, { - key: 'getTipElement', - value: function getTipElement() { - return this.tip = this.tip || $(this.config.template)[0]; - } - }, { - key: 'setContent', - value: function setContent() { - var $tip = $(this.getTipElement()); + Popover.prototype.setContent = function setContent() { + var $tip = $(this.getTipElement()); - // we use append for html objects to maintain js events - this.setElementContent($tip.find(Selector.TITLE), this.getTitle()); - this.setElementContent($tip.find(Selector.CONTENT), this._getContent()); + // we use append for html objects to maintain js events + this.setElementContent($tip.find(Selector.TITLE), this.getTitle()); + this.setElementContent($tip.find(Selector.CONTENT), this._getContent()); - $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN); + $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN); - this.cleanupTether(); - } + this.cleanupTether(); + }; - // private + // private - }, { - key: '_getContent', - value: function _getContent() { - return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content); - } + Popover.prototype._getContent = function _getContent() { + return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content); + }; - // static + // static - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - var _config = typeof config === 'object' ? config : null; + Popover._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); + var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null; - if (!data && /destroy|hide/.test(config)) { - return; - } + if (!data && /destroy|hide/.test(config)) { + return; + } - if (!data) { - data = new Popover(this, _config); - $(this).data(DATA_KEY, data); - } + if (!data) { + data = new Popover(this, _config); + $(this).data(DATA_KEY, data); + } - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config](); + if (typeof config === 'string') { + if (data[config] === undefined) { + throw new Error('No method named "' + config + '"'); } - }); - } - }, { + data[config](); + } + }); + }; + + _createClass(Popover, null, [{ key: 'VERSION', + // getters get: function get() { @@ -187,7 +173,13 @@ var Popover = (function ($) { }]); return Popover; - })(Tooltip); + }(Tooltip); + + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ $.fn[NAME] = Popover._jQueryInterface; $.fn[NAME].Constructor = Popover; @@ -197,4 +189,4 @@ var Popover = (function ($) { }; return Popover; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/scrollspy.js b/assets/javascripts/bootstrap/scrollspy.js index 1dd9361..d5e4588 100644 --- a/assets/javascripts/bootstrap/scrollspy.js +++ b/assets/javascripts/bootstrap/scrollspy.js @@ -1,17 +1,17 @@ -'use strict'; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): scrollspy.js + * Bootstrap (v4.0.0-alpha.5): scrollspy.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var ScrollSpy = (function ($) { +var ScrollSpy = function ($) { /** * ------------------------------------------------------------------------ @@ -20,7 +20,7 @@ var ScrollSpy = (function ($) { */ var NAME = 'scrollspy'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.scrollspy'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -75,7 +75,7 @@ var ScrollSpy = (function ($) { * ------------------------------------------------------------------------ */ - var ScrollSpy = (function () { + var ScrollSpy = function () { function ScrollSpy(element, config) { _classCallCheck(this, ScrollSpy); @@ -94,192 +94,174 @@ var ScrollSpy = (function ($) { this._process(); } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(ScrollSpy, [{ - key: 'refresh', + // public - // public + ScrollSpy.prototype.refresh = function refresh() { + var _this = this; - value: function refresh() { - var _this = this; + var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET; - var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET; + var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; - var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; + var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; - var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; + this._offsets = []; + this._targets = []; - this._offsets = []; - this._targets = []; + this._scrollHeight = this._getScrollHeight(); - this._scrollHeight = this._getScrollHeight(); + var targets = $.makeArray($(this._selector)); - var targets = $.makeArray($(this._selector)); + targets.map(function (element) { + var target = void 0; + var targetSelector = Util.getSelectorFromElement(element); - targets.map(function (element) { - var target = undefined; - var targetSelector = Util.getSelectorFromElement(element); + if (targetSelector) { + target = $(targetSelector)[0]; + } - if (targetSelector) { - target = $(targetSelector)[0]; - } + if (target && (target.offsetWidth || target.offsetHeight)) { + // todo (fat): remove sketch reliance on jQuery position/offset + return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; + } + return null; + }).filter(function (item) { + return item; + }).sort(function (a, b) { + return a[0] - b[0]; + }).forEach(function (item) { + _this._offsets.push(item[0]); + _this._targets.push(item[1]); + }); + }; + + ScrollSpy.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + $(this._scrollElement).off(EVENT_KEY); + + this._element = null; + this._scrollElement = null; + this._config = null; + this._selector = null; + this._offsets = null; + this._targets = null; + this._activeTarget = null; + this._scrollHeight = null; + }; - if (target && (target.offsetWidth || target.offsetHeight)) { - // todo (fat): remove sketch reliance on jQuery position/offset - return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; - } - return null; - }).filter(function (item) { - return item; - }).sort(function (a, b) { - return a[0] - b[0]; - }).forEach(function (item) { - _this._offsets.push(item[0]); - _this._targets.push(item[1]); - }); - } - }, { - key: 'dispose', - value: function dispose() { - $.removeData(this._element, DATA_KEY); - $(this._scrollElement).off(EVENT_KEY); - - this._element = null; - this._scrollElement = null; - this._config = null; - this._selector = null; - this._offsets = null; - this._targets = null; - this._activeTarget = null; - this._scrollHeight = null; - } + // private - // private + ScrollSpy.prototype._getConfig = function _getConfig(config) { + config = $.extend({}, Default, config); - }, { - key: '_getConfig', - value: function _getConfig(config) { - config = $.extend({}, Default, config); - - if (typeof config.target !== 'string') { - var id = $(config.target).attr('id'); - if (!id) { - id = Util.getUID(NAME); - $(config.target).attr('id', id); - } - config.target = '#' + id; + if (typeof config.target !== 'string') { + var id = $(config.target).attr('id'); + if (!id) { + id = Util.getUID(NAME); + $(config.target).attr('id', id); } + config.target = '#' + id; + } - Util.typeCheckConfig(NAME, config, DefaultType); + Util.typeCheckConfig(NAME, config, DefaultType); - return config; - } - }, { - key: '_getScrollTop', - value: function _getScrollTop() { - return this._scrollElement === window ? this._scrollElement.scrollY : this._scrollElement.scrollTop; - } - }, { - key: '_getScrollHeight', - value: function _getScrollHeight() { - return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); + return config; + }; + + ScrollSpy.prototype._getScrollTop = function _getScrollTop() { + return this._scrollElement === window ? this._scrollElement.scrollY : this._scrollElement.scrollTop; + }; + + ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() { + return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); + }; + + ScrollSpy.prototype._process = function _process() { + var scrollTop = this._getScrollTop() + this._config.offset; + var scrollHeight = this._getScrollHeight(); + var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight; + + if (this._scrollHeight !== scrollHeight) { + this.refresh(); } - }, { - key: '_process', - value: function _process() { - var scrollTop = this._getScrollTop() + this._config.offset; - var scrollHeight = this._getScrollHeight(); - var maxScroll = this._config.offset + scrollHeight - this._scrollElement.offsetHeight; - - if (this._scrollHeight !== scrollHeight) { - this.refresh(); - } - if (scrollTop >= maxScroll) { - var target = this._targets[this._targets.length - 1]; + if (scrollTop >= maxScroll) { + var target = this._targets[this._targets.length - 1]; - if (this._activeTarget !== target) { - this._activate(target); - } + if (this._activeTarget !== target) { + this._activate(target); } + } - if (this._activeTarget && scrollTop < this._offsets[0]) { - this._activeTarget = null; - this._clear(); - return; - } + if (this._activeTarget && scrollTop < this._offsets[0]) { + this._activeTarget = null; + this._clear(); + return; + } - for (var i = this._offsets.length; i--;) { - var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]); + for (var i = this._offsets.length; i--;) { + var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]); - if (isActiveTarget) { - this._activate(this._targets[i]); - } + if (isActiveTarget) { + this._activate(this._targets[i]); } } - }, { - key: '_activate', - value: function _activate(target) { - this._activeTarget = target; + }; - this._clear(); + ScrollSpy.prototype._activate = function _activate(target) { + this._activeTarget = target; - var queries = this._selector.split(','); - queries = queries.map(function (selector) { - return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]'); - }); + this._clear(); - var $link = $(queries.join(',')); + var queries = this._selector.split(','); + queries = queries.map(function (selector) { + return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]'); + }); - if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { - $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); - $link.addClass(ClassName.ACTIVE); - } else { - // todo (fat) this is kinda sus... - // recursively add actives to tested nav-links - $link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE); - } + var $link = $(queries.join(',')); - $(this._scrollElement).trigger(Event.ACTIVATE, { - relatedTarget: target - }); - } - }, { - key: '_clear', - value: function _clear() { - $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); + if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { + $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); + $link.addClass(ClassName.ACTIVE); + } else { + // todo (fat) this is kinda sus... + // recursively add actives to tested nav-links + $link.parents(Selector.LI).find(Selector.NAV_LINKS).addClass(ClassName.ACTIVE); } - // static + $(this._scrollElement).trigger(Event.ACTIVATE, { + relatedTarget: target + }); + }; - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - var _config = typeof config === 'object' && config || null; + ScrollSpy.prototype._clear = function _clear() { + $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); + }; - if (!data) { - data = new ScrollSpy(this, _config); - $(this).data(DATA_KEY, data); - } + // static - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config](); + ScrollSpy._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); + var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config || null; + + if (!data) { + data = new ScrollSpy(this, _config); + $(this).data(DATA_KEY, data); + } + + if (typeof config === 'string') { + if (data[config] === undefined) { + throw new Error('No method named "' + config + '"'); } - }); - } - }, { + data[config](); + } + }); + }; + + _createClass(ScrollSpy, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -292,7 +274,13 @@ var ScrollSpy = (function ($) { }]); return ScrollSpy; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(window).on(Event.LOAD_DATA_API, function () { var scrollSpys = $.makeArray($(Selector.DATA_SPY)); @@ -317,4 +305,4 @@ var ScrollSpy = (function ($) { }; return ScrollSpy; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/tab.js b/assets/javascripts/bootstrap/tab.js index 507a4af..a38f48b 100644 --- a/assets/javascripts/bootstrap/tab.js +++ b/assets/javascripts/bootstrap/tab.js @@ -1,17 +1,15 @@ -'use strict'; +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): tab.js + * Bootstrap (v4.0.0-alpha.5): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Tab = (function ($) { +var Tab = function ($) { /** * ------------------------------------------------------------------------ @@ -20,7 +18,7 @@ var Tab = (function ($) { */ var NAME = 'tab'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.tab'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -61,176 +59,162 @@ var Tab = (function ($) { * ------------------------------------------------------------------------ */ - var Tab = (function () { + var Tab = function () { function Tab(element) { _classCallCheck(this, Tab); this._element = element; } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Tab, [{ - key: 'show', - - // public + // public - value: function show() { - var _this = this; + Tab.prototype.show = function show() { + var _this = this; - if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) { - return; - } + if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE)) { + return; + } - var target = undefined; - var previous = undefined; - var ulElement = $(this._element).closest(Selector.UL)[0]; - var selector = Util.getSelectorFromElement(this._element); + var target = void 0; + var previous = void 0; + var ulElement = $(this._element).closest(Selector.UL)[0]; + var selector = Util.getSelectorFromElement(this._element); - if (ulElement) { - previous = $.makeArray($(ulElement).find(Selector.ACTIVE)); - previous = previous[previous.length - 1]; - } + if (ulElement) { + previous = $.makeArray($(ulElement).find(Selector.ACTIVE)); + previous = previous[previous.length - 1]; + } - var hideEvent = $.Event(Event.HIDE, { - relatedTarget: this._element - }); + var hideEvent = $.Event(Event.HIDE, { + relatedTarget: this._element + }); - var showEvent = $.Event(Event.SHOW, { - relatedTarget: previous - }); + var showEvent = $.Event(Event.SHOW, { + relatedTarget: previous + }); - if (previous) { - $(previous).trigger(hideEvent); - } + if (previous) { + $(previous).trigger(hideEvent); + } - $(this._element).trigger(showEvent); + $(this._element).trigger(showEvent); - if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { - return; - } + if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { + return; + } - if (selector) { - target = $(selector)[0]; - } + if (selector) { + target = $(selector)[0]; + } - this._activate(this._element, ulElement); + this._activate(this._element, ulElement); - var complete = function complete() { - var hiddenEvent = $.Event(Event.HIDDEN, { - relatedTarget: _this._element - }); + var complete = function complete() { + var hiddenEvent = $.Event(Event.HIDDEN, { + relatedTarget: _this._element + }); - var shownEvent = $.Event(Event.SHOWN, { - relatedTarget: previous - }); + var shownEvent = $.Event(Event.SHOWN, { + relatedTarget: previous + }); - $(previous).trigger(hiddenEvent); - $(_this._element).trigger(shownEvent); - }; + $(previous).trigger(hiddenEvent); + $(_this._element).trigger(shownEvent); + }; - if (target) { - this._activate(target, target.parentNode, complete); - } else { - complete(); - } - } - }, { - key: 'dispose', - value: function dispose() { - $.removeClass(this._element, DATA_KEY); - this._element = null; + if (target) { + this._activate(target, target.parentNode, complete); + } else { + complete(); } + }; - // private + Tab.prototype.dispose = function dispose() { + $.removeClass(this._element, DATA_KEY); + this._element = null; + }; - }, { - key: '_activate', - value: function _activate(element, container, callback) { - var active = $(container).find(Selector.ACTIVE_CHILD)[0]; - var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0])); + // private - var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback); + Tab.prototype._activate = function _activate(element, container, callback) { + var active = $(container).find(Selector.ACTIVE_CHILD)[0]; + var isTransitioning = callback && Util.supportsTransitionEnd() && (active && $(active).hasClass(ClassName.FADE) || Boolean($(container).find(Selector.FADE_CHILD)[0])); - if (active && isTransitioning) { - $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); - } else { - complete(); - } + var complete = $.proxy(this._transitionComplete, this, element, active, isTransitioning, callback); - if (active) { - $(active).removeClass(ClassName.IN); - } + if (active && isTransitioning) { + $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); + } else { + complete(); } - }, { - key: '_transitionComplete', - value: function _transitionComplete(element, active, isTransitioning, callback) { - if (active) { - $(active).removeClass(ClassName.ACTIVE); - var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; + if (active) { + $(active).removeClass(ClassName.IN); + } + }; - if (dropdownChild) { - $(dropdownChild).removeClass(ClassName.ACTIVE); - } + Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) { + if (active) { + $(active).removeClass(ClassName.ACTIVE); + + var dropdownChild = $(active).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; - active.setAttribute('aria-expanded', false); + if (dropdownChild) { + $(dropdownChild).removeClass(ClassName.ACTIVE); } - $(element).addClass(ClassName.ACTIVE); - element.setAttribute('aria-expanded', true); + active.setAttribute('aria-expanded', false); + } - if (isTransitioning) { - Util.reflow(element); - $(element).addClass(ClassName.IN); - } else { - $(element).removeClass(ClassName.FADE); - } + $(element).addClass(ClassName.ACTIVE); + element.setAttribute('aria-expanded', true); - if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { + if (isTransitioning) { + Util.reflow(element); + $(element).addClass(ClassName.IN); + } else { + $(element).removeClass(ClassName.FADE); + } - var dropdownElement = $(element).closest(Selector.DROPDOWN)[0]; - if (dropdownElement) { - $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); - } + if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { - element.setAttribute('aria-expanded', true); + var dropdownElement = $(element).closest(Selector.DROPDOWN)[0]; + if (dropdownElement) { + $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); } - if (callback) { - callback(); - } + element.setAttribute('aria-expanded', true); } - // static + if (callback) { + callback(); + } + }; - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var $this = $(this); - var data = $this.data(DATA_KEY); + // static - if (!data) { - data = data = new Tab(this); - $this.data(DATA_KEY, data); - } + Tab._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var $this = $(this); + var data = $this.data(DATA_KEY); - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config](); + if (!data) { + data = data = new Tab(this); + $this.data(DATA_KEY, data); + } + + if (typeof config === 'string') { + if (data[config] === undefined) { + throw new Error('No method named "' + config + '"'); } - }); - } - }, { + data[config](); + } + }); + }; + + _createClass(Tab, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -238,7 +222,13 @@ var Tab = (function ($) { }]); return Tab; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { event.preventDefault(); @@ -259,4 +249,4 @@ var Tab = (function ($) { }; return Tab; -})(jQuery); +}(jQuery); diff --git a/assets/javascripts/bootstrap/tooltip.js b/assets/javascripts/bootstrap/tooltip.js index 4aca818..2d3f6b4 100644 --- a/assets/javascripts/bootstrap/tooltip.js +++ b/assets/javascripts/bootstrap/tooltip.js @@ -1,26 +1,24 @@ -/* global Tether */ +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -'use strict'; +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); -var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): tooltip.js + * Bootstrap (v4.0.0-alpha.5): tooltip.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -var Tooltip = (function ($) { +var Tooltip = function ($) { /** * Check for Tether dependency - * Tether - http://github.hubspot.com/tether/ + * Tether - http://tether.io/ */ if (window.Tether === undefined) { - throw new Error('Bootstrap tooltips require Tether (http://github.hubspot.com/tether/)'); + throw new Error('Bootstrap tooltips require Tether (http://tether.io/)'); } /** @@ -30,7 +28,7 @@ var Tooltip = (function ($) { */ var NAME = 'tooltip'; - var VERSION = '4.0.0-alpha.4'; + var VERSION = '4.0.0-alpha.5'; var DATA_KEY = 'bs.tooltip'; var EVENT_KEY = '.' + DATA_KEY; var JQUERY_NO_CONFLICT = $.fn[NAME]; @@ -39,7 +37,7 @@ var Tooltip = (function ($) { var Default = { animation: true, - template: '', + template: '', trigger: 'hover focus', title: '', delay: 0, @@ -116,7 +114,7 @@ var Tooltip = (function ($) { * ------------------------------------------------------------------------ */ - var Tooltip = (function () { + var Tooltip = function () { function Tooltip(element, config) { _classCallCheck(this, Tooltip); @@ -135,439 +133,407 @@ var Tooltip = (function ($) { this._setListeners(); } - /** - * ------------------------------------------------------------------------ - * jQuery - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Tooltip, [{ - key: 'enable', - - // public + // public - value: function enable() { - this._isEnabled = true; - } - }, { - key: 'disable', - value: function disable() { - this._isEnabled = false; - } - }, { - key: 'toggleEnabled', - value: function toggleEnabled() { - this._isEnabled = !this._isEnabled; - } - }, { - key: 'toggle', - value: function toggle(event) { - if (event) { - var dataKey = this.constructor.DATA_KEY; - var context = $(event.currentTarget).data(dataKey); - - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); - } + Tooltip.prototype.enable = function enable() { + this._isEnabled = true; + }; - context._activeTrigger.click = !context._activeTrigger.click; + Tooltip.prototype.disable = function disable() { + this._isEnabled = false; + }; - if (context._isWithActiveTrigger()) { - context._enter(null, context); - } else { - context._leave(null, context); - } - } else { + Tooltip.prototype.toggleEnabled = function toggleEnabled() { + this._isEnabled = !this._isEnabled; + }; - if ($(this.getTipElement()).hasClass(ClassName.IN)) { - this._leave(null, this); - return; - } + Tooltip.prototype.toggle = function toggle(event) { + if (event) { + var dataKey = this.constructor.DATA_KEY; + var context = $(event.currentTarget).data(dataKey); - this._enter(null, this); + if (!context) { + context = new this.constructor(event.currentTarget, this._getDelegateConfig()); + $(event.currentTarget).data(dataKey, context); } - } - }, { - key: 'dispose', - value: function dispose() { - clearTimeout(this._timeout); - this.cleanupTether(); + context._activeTrigger.click = !context._activeTrigger.click; - $.removeData(this.element, this.constructor.DATA_KEY); - - $(this.element).off(this.constructor.EVENT_KEY); - - if (this.tip) { - $(this.tip).remove(); + if (context._isWithActiveTrigger()) { + context._enter(null, context); + } else { + context._leave(null, context); } + } else { - this._isEnabled = null; - this._timeout = null; - this._hoverState = null; - this._activeTrigger = null; - this._tether = null; + if ($(this.getTipElement()).hasClass(ClassName.IN)) { + this._leave(null, this); + return; + } - this.element = null; - this.config = null; - this.tip = null; + this._enter(null, this); } - }, { - key: 'show', - value: function show() { - var _this = this; + }; - var showEvent = $.Event(this.constructor.Event.SHOW); + Tooltip.prototype.dispose = function dispose() { + clearTimeout(this._timeout); - if (this.isWithContent() && this._isEnabled) { - $(this.element).trigger(showEvent); + this.cleanupTether(); - var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element); + $.removeData(this.element, this.constructor.DATA_KEY); - if (showEvent.isDefaultPrevented() || !isInTheDom) { - return; - } + $(this.element).off(this.constructor.EVENT_KEY); - var tip = this.getTipElement(); - var tipId = Util.getUID(this.constructor.NAME); + if (this.tip) { + $(this.tip).remove(); + } - tip.setAttribute('id', tipId); - this.element.setAttribute('aria-describedby', tipId); + this._isEnabled = null; + this._timeout = null; + this._hoverState = null; + this._activeTrigger = null; + this._tether = null; - this.setContent(); + this.element = null; + this.config = null; + this.tip = null; + }; - if (this.config.animation) { - $(tip).addClass(ClassName.FADE); - } + Tooltip.prototype.show = function show() { + var _this = this; - var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; + var showEvent = $.Event(this.constructor.Event.SHOW); - var attachment = this._getAttachment(placement); + if (this.isWithContent() && this._isEnabled) { + $(this.element).trigger(showEvent); - $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body); + var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element); - $(this.element).trigger(this.constructor.Event.INSERTED); + if (showEvent.isDefaultPrevented() || !isInTheDom) { + return; + } - this._tether = new Tether({ - attachment: attachment, - element: tip, - target: this.element, - classes: TetherClass, - classPrefix: CLASS_PREFIX, - offset: this.config.offset, - constraints: this.config.constraints, - addTargetClasses: false - }); + var tip = this.getTipElement(); + var tipId = Util.getUID(this.constructor.NAME); - Util.reflow(tip); - this._tether.position(); + tip.setAttribute('id', tipId); + this.element.setAttribute('aria-describedby', tipId); - $(tip).addClass(ClassName.IN); + this.setContent(); - var complete = function complete() { - var prevHoverState = _this._hoverState; - _this._hoverState = null; + if (this.config.animation) { + $(tip).addClass(ClassName.FADE); + } - $(_this.element).trigger(_this.constructor.Event.SHOWN); + var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; - if (prevHoverState === HoverState.OUT) { - _this._leave(null, _this); - } - }; + var attachment = this._getAttachment(placement); - if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { - $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION); - return; - } + $(tip).data(this.constructor.DATA_KEY, this).appendTo(document.body); - complete(); - } - } - }, { - key: 'hide', - value: function hide(callback) { - var _this2 = this; + $(this.element).trigger(this.constructor.Event.INSERTED); + + this._tether = new Tether({ + attachment: attachment, + element: tip, + target: this.element, + classes: TetherClass, + classPrefix: CLASS_PREFIX, + offset: this.config.offset, + constraints: this.config.constraints, + addTargetClasses: false + }); + + Util.reflow(tip); + this._tether.position(); + + $(tip).addClass(ClassName.IN); - var tip = this.getTipElement(); - var hideEvent = $.Event(this.constructor.Event.HIDE); var complete = function complete() { - if (_this2._hoverState !== HoverState.IN && tip.parentNode) { - tip.parentNode.removeChild(tip); - } + var prevHoverState = _this._hoverState; + _this._hoverState = null; - _this2.element.removeAttribute('aria-describedby'); - $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); - _this2.cleanupTether(); + $(_this.element).trigger(_this.constructor.Event.SHOWN); - if (callback) { - callback(); + if (prevHoverState === HoverState.OUT) { + _this._leave(null, _this); } }; - $(this.element).trigger(hideEvent); - - if (hideEvent.isDefaultPrevented()) { + if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { + $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION); return; } - $(tip).removeClass(ClassName.IN); + complete(); + } + }; - if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { + Tooltip.prototype.hide = function hide(callback) { + var _this2 = this; - $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); - } else { - complete(); + var tip = this.getTipElement(); + var hideEvent = $.Event(this.constructor.Event.HIDE); + var complete = function complete() { + if (_this2._hoverState !== HoverState.IN && tip.parentNode) { + tip.parentNode.removeChild(tip); } - this._hoverState = ''; - } + _this2.element.removeAttribute('aria-describedby'); + $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); + _this2.cleanupTether(); - // protected + if (callback) { + callback(); + } + }; - }, { - key: 'isWithContent', - value: function isWithContent() { - return Boolean(this.getTitle()); - } - }, { - key: 'getTipElement', - value: function getTipElement() { - return this.tip = this.tip || $(this.config.template)[0]; + $(this.element).trigger(hideEvent); + + if (hideEvent.isDefaultPrevented()) { + return; } - }, { - key: 'setContent', - value: function setContent() { - var $tip = $(this.getTipElement()); - this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); + $(tip).removeClass(ClassName.IN); - $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN); + if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { - this.cleanupTether(); + $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); + } else { + complete(); } - }, { - key: 'setElementContent', - value: function setElementContent($element, content) { - var html = this.config.html; - if (typeof content === 'object' && (content.nodeType || content.jquery)) { - // content is a DOM node or a jQuery - if (html) { - if (!$(content).parent().is($element)) { - $element.empty().append(content); - } - } else { - $element.text($(content).text()); + + this._hoverState = ''; + }; + + // protected + + Tooltip.prototype.isWithContent = function isWithContent() { + return Boolean(this.getTitle()); + }; + + Tooltip.prototype.getTipElement = function getTipElement() { + return this.tip = this.tip || $(this.config.template)[0]; + }; + + Tooltip.prototype.setContent = function setContent() { + var $tip = $(this.getTipElement()); + + this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); + + $tip.removeClass(ClassName.FADE).removeClass(ClassName.IN); + + this.cleanupTether(); + }; + + Tooltip.prototype.setElementContent = function setElementContent($element, content) { + var html = this.config.html; + if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) { + // content is a DOM node or a jQuery + if (html) { + if (!$(content).parent().is($element)) { + $element.empty().append(content); } } else { - $element[html ? 'html' : 'text'](content); + $element.text($(content).text()); } + } else { + $element[html ? 'html' : 'text'](content); } - }, { - key: 'getTitle', - value: function getTitle() { - var title = this.element.getAttribute('data-original-title'); + }; - if (!title) { - title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; - } + Tooltip.prototype.getTitle = function getTitle() { + var title = this.element.getAttribute('data-original-title'); - return title; - } - }, { - key: 'cleanupTether', - value: function cleanupTether() { - if (this._tether) { - this._tether.destroy(); - } + if (!title) { + title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; } - // private + return title; + }; - }, { - key: '_getAttachment', - value: function _getAttachment(placement) { - return AttachmentMap[placement.toUpperCase()]; + Tooltip.prototype.cleanupTether = function cleanupTether() { + if (this._tether) { + this._tether.destroy(); } - }, { - key: '_setListeners', - value: function _setListeners() { - var _this3 = this; + }; - var triggers = this.config.trigger.split(' '); + // private - triggers.forEach(function (trigger) { - if (trigger === 'click') { - $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3)); - } else if (trigger !== Trigger.MANUAL) { - var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; - var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; + Tooltip.prototype._getAttachment = function _getAttachment(placement) { + return AttachmentMap[placement.toUpperCase()]; + }; - $(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3)); - } - }); + Tooltip.prototype._setListeners = function _setListeners() { + var _this3 = this; - if (this.config.selector) { - this.config = $.extend({}, this.config, { - trigger: 'manual', - selector: '' - }); - } else { - this._fixTitle(); - } - } - }, { - key: '_fixTitle', - value: function _fixTitle() { - var titleType = typeof this.element.getAttribute('data-original-title'); - if (this.element.getAttribute('title') || titleType !== 'string') { - this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); - this.element.setAttribute('title', ''); + var triggers = this.config.trigger.split(' '); + + triggers.forEach(function (trigger) { + if (trigger === 'click') { + $(_this3.element).on(_this3.constructor.Event.CLICK, _this3.config.selector, $.proxy(_this3.toggle, _this3)); + } else if (trigger !== Trigger.MANUAL) { + var eventIn = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSEENTER : _this3.constructor.Event.FOCUSIN; + var eventOut = trigger === Trigger.HOVER ? _this3.constructor.Event.MOUSELEAVE : _this3.constructor.Event.FOCUSOUT; + + $(_this3.element).on(eventIn, _this3.config.selector, $.proxy(_this3._enter, _this3)).on(eventOut, _this3.config.selector, $.proxy(_this3._leave, _this3)); } + }); + + if (this.config.selector) { + this.config = $.extend({}, this.config, { + trigger: 'manual', + selector: '' + }); + } else { + this._fixTitle(); } - }, { - key: '_enter', - value: function _enter(event, context) { - var dataKey = this.constructor.DATA_KEY; + }; - context = context || $(event.currentTarget).data(dataKey); + Tooltip.prototype._fixTitle = function _fixTitle() { + var titleType = _typeof(this.element.getAttribute('data-original-title')); + if (this.element.getAttribute('title') || titleType !== 'string') { + this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); + this.element.setAttribute('title', ''); + } + }; - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); - } + Tooltip.prototype._enter = function _enter(event, context) { + var dataKey = this.constructor.DATA_KEY; - if (event) { - context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; - } + context = context || $(event.currentTarget).data(dataKey); - if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) { - context._hoverState = HoverState.IN; - return; - } + if (!context) { + context = new this.constructor(event.currentTarget, this._getDelegateConfig()); + $(event.currentTarget).data(dataKey, context); + } - clearTimeout(context._timeout); + if (event) { + context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; + } + if ($(context.getTipElement()).hasClass(ClassName.IN) || context._hoverState === HoverState.IN) { context._hoverState = HoverState.IN; + return; + } + + clearTimeout(context._timeout); + + context._hoverState = HoverState.IN; - if (!context.config.delay || !context.config.delay.show) { + if (!context.config.delay || !context.config.delay.show) { + context.show(); + return; + } + + context._timeout = setTimeout(function () { + if (context._hoverState === HoverState.IN) { context.show(); - return; } + }, context.config.delay.show); + }; - context._timeout = setTimeout(function () { - if (context._hoverState === HoverState.IN) { - context.show(); - } - }, context.config.delay.show); - } - }, { - key: '_leave', - value: function _leave(event, context) { - var dataKey = this.constructor.DATA_KEY; + Tooltip.prototype._leave = function _leave(event, context) { + var dataKey = this.constructor.DATA_KEY; - context = context || $(event.currentTarget).data(dataKey); + context = context || $(event.currentTarget).data(dataKey); - if (!context) { - context = new this.constructor(event.currentTarget, this._getDelegateConfig()); - $(event.currentTarget).data(dataKey, context); - } + if (!context) { + context = new this.constructor(event.currentTarget, this._getDelegateConfig()); + $(event.currentTarget).data(dataKey, context); + } - if (event) { - context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; - } + if (event) { + context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false; + } - if (context._isWithActiveTrigger()) { - return; - } + if (context._isWithActiveTrigger()) { + return; + } + + clearTimeout(context._timeout); - clearTimeout(context._timeout); + context._hoverState = HoverState.OUT; - context._hoverState = HoverState.OUT; + if (!context.config.delay || !context.config.delay.hide) { + context.hide(); + return; + } - if (!context.config.delay || !context.config.delay.hide) { + context._timeout = setTimeout(function () { + if (context._hoverState === HoverState.OUT) { context.hide(); - return; } + }, context.config.delay.hide); + }; - context._timeout = setTimeout(function () { - if (context._hoverState === HoverState.OUT) { - context.hide(); - } - }, context.config.delay.hide); - } - }, { - key: '_isWithActiveTrigger', - value: function _isWithActiveTrigger() { - for (var trigger in this._activeTrigger) { - if (this._activeTrigger[trigger]) { - return true; - } + Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() { + for (var trigger in this._activeTrigger) { + if (this._activeTrigger[trigger]) { + return true; } - - return false; } - }, { - key: '_getConfig', - value: function _getConfig(config) { - config = $.extend({}, this.constructor.Default, $(this.element).data(), config); - - if (config.delay && typeof config.delay === 'number') { - config.delay = { - show: config.delay, - hide: config.delay - }; - } - Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); + return false; + }; + + Tooltip.prototype._getConfig = function _getConfig(config) { + config = $.extend({}, this.constructor.Default, $(this.element).data(), config); - return config; + if (config.delay && typeof config.delay === 'number') { + config.delay = { + show: config.delay, + hide: config.delay + }; } - }, { - key: '_getDelegateConfig', - value: function _getDelegateConfig() { - var config = {}; - - if (this.config) { - for (var key in this.config) { - if (this.constructor.Default[key] !== this.config[key]) { - config[key] = this.config[key]; - } + + Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); + + return config; + }; + + Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() { + var config = {}; + + if (this.config) { + for (var key in this.config) { + if (this.constructor.Default[key] !== this.config[key]) { + config[key] = this.config[key]; } } - - return config; } - // static + return config; + }; - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var data = $(this).data(DATA_KEY); - var _config = typeof config === 'object' ? config : null; + // static - if (!data && /destroy|hide/.test(config)) { - return; - } + Tooltip._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var data = $(this).data(DATA_KEY); + var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null; - if (!data) { - data = new Tooltip(this, _config); - $(this).data(DATA_KEY, data); - } + if (!data && /dispose|hide/.test(config)) { + return; + } - if (typeof config === 'string') { - if (data[config] === undefined) { - throw new Error('No method named "' + config + '"'); - } - data[config](); + if (!data) { + data = new Tooltip(this, _config); + $(this).data(DATA_KEY, data); + } + + if (typeof config === 'string') { + if (data[config] === undefined) { + throw new Error('No method named "' + config + '"'); } - }); - } - }, { + data[config](); + } + }); + }; + + _createClass(Tooltip, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -605,7 +571,13 @@ var Tooltip = (function ($) { }]); return Tooltip; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ $.fn[NAME] = Tooltip._jQueryInterface; $.fn[NAME].Constructor = Tooltip; @@ -615,4 +587,4 @@ var Tooltip = (function ($) { }; return Tooltip; -})(jQuery); +}(jQuery); /* global Tether */ diff --git a/assets/javascripts/bootstrap/util.js b/assets/javascripts/bootstrap/util.js index f2b4dff..6bb47a7 100644 --- a/assets/javascripts/bootstrap/util.js +++ b/assets/javascripts/bootstrap/util.js @@ -1,13 +1,11 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0-alpha.4): util.js + * Bootstrap (v4.0.0-alpha.5): util.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ -'use strict'; - -var Util = (function ($) { +var Util = function ($) { /** * ------------------------------------------------------------------------ @@ -28,7 +26,7 @@ var Util = (function ($) { // shoutout AngusCroll (https://goo.gl/pxwQGp) function toType(obj) { - return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); + return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); } function isElement(obj) { @@ -55,9 +53,9 @@ var Util = (function ($) { var el = document.createElement('bootstrap'); - for (var _name in TransitionEndEvent) { - if (el.style[_name] !== undefined) { - return { end: TransitionEndEvent[_name] }; + for (var name in TransitionEndEvent) { + if (el.style[name] !== undefined) { + return { end: TransitionEndEvent[name] }; } } @@ -105,12 +103,11 @@ var Util = (function ($) { getUID: function getUID(prefix) { do { /* eslint-disable no-bitwise */ - prefix += ~ ~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here + prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here /* eslint-enable no-bitwise */ } while (document.getElementById(prefix)); return prefix; }, - getSelectorFromElement: function getSelectorFromElement(element) { var selector = element.getAttribute('data-target'); @@ -121,25 +118,21 @@ var Util = (function ($) { return selector; }, - reflow: function reflow(element) { new Function('bs', 'return bs')(element.offsetHeight); }, - triggerTransitionEnd: function triggerTransitionEnd(element) { $(element).trigger(transition.end); }, - supportsTransitionEnd: function supportsTransitionEnd() { return Boolean(transition); }, - typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { for (var property in configTypes) { if (configTypes.hasOwnProperty(property)) { var expectedTypes = configTypes[property]; var value = config[property]; - var valueType = undefined; + var valueType = void 0; if (value && isElement(value)) { valueType = 'element'; @@ -158,4 +151,4 @@ var Util = (function ($) { setTransitionEndSupport(); return Util; -})(jQuery); +}(jQuery); -- cgit v1.2.3