Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/bootstrap/popover.js')
-rw-r--r--assets/javascripts/bootstrap/popover.js130
1 files changed, 72 insertions, 58 deletions
diff --git a/assets/javascripts/bootstrap/popover.js b/assets/javascripts/bootstrap/popover.js
index 2ae9b24..74891c1 100644
--- a/assets/javascripts/bootstrap/popover.js
+++ b/assets/javascripts/bootstrap/popover.js
@@ -1,3 +1,5 @@
+'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; }; }();
@@ -15,7 +17,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
* --------------------------------------------------------------------------
*/
-var Popover = function ($) {
+var Popover = function () {
/**
* ------------------------------------------------------------------------
@@ -63,87 +65,99 @@ var Popover = function ($) {
FOCUSOUT: 'focusout' + EVENT_KEY,
MOUSEENTER: 'mouseenter' + EVENT_KEY,
MOUSELEAVE: 'mouseleave' + EVENT_KEY
+ };
- /**
- * ------------------------------------------------------------------------
- * Class Definition
- * ------------------------------------------------------------------------
- */
+ /**
+ * ------------------------------------------------------------------------
+ * Class Definition
+ * ------------------------------------------------------------------------
+ */
- };
var Popover = function (_Tooltip) {
_inherits(Popover, _Tooltip);
function Popover() {
_classCallCheck(this, Popover);
- return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments));
+ return _possibleConstructorReturn(this, (Popover.__proto__ || Object.getPrototypeOf(Popover)).apply(this, arguments));
}
- // overrides
+ _createClass(Popover, [{
+ key: 'isWithContent',
- Popover.prototype.isWithContent = function isWithContent() {
- return this.getTitle() || this._getContent();
- };
- Popover.prototype.addAttachmentClass = function addAttachmentClass(attachment) {
- $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
- };
+ // overrides
- Popover.prototype.getTipElement = function getTipElement() {
- return this.tip = this.tip || $(this.config.template)[0];
- };
-
- 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());
+ value: function isWithContent() {
+ return this.getTitle() || this._getContent();
+ }
+ }, {
+ key: 'addAttachmentClass',
+ value: function addAttachmentClass(attachment) {
+ $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment);
+ }
+ }, {
+ key: 'getTipElement',
+ value: function getTipElement() {
+ this.tip = this.tip || $(this.config.template)[0];
+ return this.tip;
+ }
+ }, {
+ key: 'setContent',
+ value: function setContent() {
+ var $tip = $(this.getTipElement());
- $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
- };
+ // 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());
- // private
+ $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW);
+ }
- 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);
- };
+ // private
- Popover.prototype._cleanTipClass = function _cleanTipClass() {
- var $tip = $(this.getTipElement());
- var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
- if (tabClass !== null && tabClass.length > 0) {
- $tip.removeClass(tabClass.join(''));
+ }, {
+ 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);
+ }
+ }, {
+ key: '_cleanTipClass',
+ value: function _cleanTipClass() {
+ var $tip = $(this.getTipElement());
+ var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
+ if (tabClass !== null && tabClass.length > 0) {
+ $tip.removeClass(tabClass.join(''));
+ }
}
- };
-
- // static
- 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;
+ // static
- if (!data && /destroy|hide/.test(config)) {
- return;
- }
+ }], [{
+ key: '_jQueryInterface',
+ value: 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 Popover(this, _config);
- $(this).data(DATA_KEY, data);
- }
+ if (!data && /destroy|hide/.test(config)) {
+ return;
+ }
- if (typeof config === 'string') {
- if (data[config] === undefined) {
- throw new Error('No method named "' + config + '"');
+ if (!data) {
+ data = new Popover(this, _config);
+ $(this).data(DATA_KEY, data);
}
- data[config]();
- }
- });
- };
- _createClass(Popover, null, [{
+ if (typeof config === 'string') {
+ if (typeof data[config] === 'undefined') {
+ throw new Error('No method named "' + config + '"');
+ }
+ data[config]();
+ }
+ });
+ }
+ }, {
key: 'VERSION',