]>
git.ipfire.org Git - ipfire.org.git/blob - src/scss/bootstrap-4.0.0-alpha.6/js/dist/popover.js
1 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
; };
3 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
; }; }();
5 function _classCallCheck(instance
, Constructor
) { if (!(instance
instanceof Constructor
)) { throw new TypeError("Cannot call a class as a function"); } }
7 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
; }
9 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
; }
12 * --------------------------------------------------------------------------
13 * Bootstrap (v4.0.0-alpha.6): popover.js
14 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15 * --------------------------------------------------------------------------
18 var Popover = function ($) {
21 * ------------------------------------------------------------------------
23 * ------------------------------------------------------------------------
27 var VERSION
= '4.0.0-alpha.6';
28 var DATA_KEY
= 'bs.popover';
29 var EVENT_KEY
= '.' + DATA_KEY
;
30 var JQUERY_NO_CONFLICT
= $.fn
[NAME
];
32 var Default
= $.extend({}, Tooltip
.Default
, {
36 template
: '<div class="popover" role="tooltip">' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>'
39 var DefaultType
= $.extend({}, Tooltip
.DefaultType
, {
40 content
: '(string|element|function)'
49 TITLE
: '.popover-title',
50 CONTENT
: '.popover-content'
54 HIDE
: 'hide' + EVENT_KEY
,
55 HIDDEN
: 'hidden' + EVENT_KEY
,
56 SHOW
: 'show' + EVENT_KEY
,
57 SHOWN
: 'shown' + EVENT_KEY
,
58 INSERTED
: 'inserted' + EVENT_KEY
,
59 CLICK
: 'click' + EVENT_KEY
,
60 FOCUSIN
: 'focusin' + EVENT_KEY
,
61 FOCUSOUT
: 'focusout' + EVENT_KEY
,
62 MOUSEENTER
: 'mouseenter' + EVENT_KEY
,
63 MOUSELEAVE
: 'mouseleave' + EVENT_KEY
67 * ------------------------------------------------------------------------
69 * ------------------------------------------------------------------------
72 var Popover = function (_Tooltip
) {
73 _inherits(Popover
, _Tooltip
);
76 _classCallCheck(this, Popover
);
78 return _possibleConstructorReturn(this, _Tooltip
.apply(this, arguments
));
83 Popover
.prototype.isWithContent
= function isWithContent() {
84 return this.getTitle() || this._getContent();
87 Popover
.prototype.getTipElement
= function getTipElement() {
88 return this.tip
= this.tip
|| $(this.config
.template
)[0];
91 Popover
.prototype.setContent
= function setContent() {
92 var $tip
= $(this.getTipElement());
94 // we use append for html objects to maintain js events
95 this.setElementContent($tip
.find(Selector
.TITLE
), this.getTitle());
96 this.setElementContent($tip
.find(Selector
.CONTENT
), this._getContent());
98 $tip
.removeClass(ClassName
.FADE
+ ' ' + ClassName
.SHOW
);
100 this.cleanupTether();
105 Popover
.prototype._getContent
= function _getContent() {
106 return this.element
.getAttribute('data-content') || (typeof this.config
.content
=== 'function' ? this.config
.content
.call(this.element
) : this.config
.content
);
111 Popover
._jQueryInterface
= function _jQueryInterface(config
) {
112 return this.each(function () {
113 var data
= $(this).data(DATA_KEY
);
114 var _config
= (typeof config
=== 'undefined' ? 'undefined' : _typeof(config
)) === 'object' ? config
: null;
116 if (!data
&& /destroy|hide/.test(config
)) {
121 data
= new Popover(this, _config
);
122 $(this).data(DATA_KEY
, data
);
125 if (typeof config
=== 'string') {
126 if (data
[config
] === undefined) {
127 throw new Error('No method named "' + config
+ '"');
134 _createClass(Popover
, null, [{
140 get: function get() {
145 get: function get() {
150 get: function get() {
155 get: function get() {
160 get: function get() {
165 get: function get() {
170 get: function get() {
179 * ------------------------------------------------------------------------
181 * ------------------------------------------------------------------------
184 $.fn
[NAME
] = Popover
._jQueryInterface
;
185 $.fn
[NAME
].Constructor
= Popover
;
186 $.fn
[NAME
].noConflict = function () {
187 $.fn
[NAME
] = JQUERY_NO_CONFLICT
;
188 return Popover
._jQueryInterface
;
193 //# sourceMappingURL=popover.js.map