]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/pretty-json/node_modules/jsonminify/report/assets/scripts/vendor/bootstrap-popover.js
ecd37ac233ad509eb15f6a1662d331fe613b0104
1 /* ========================================================================
2 * Bootstrap: popover.js v3.0.0
3 * http://twbs.github.com/bootstrap/javascript.html#popovers
4 * ========================================================================
5 * Copyright 2012 Twitter, Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ======================================================================== */
21 +function ($) { "use strict";
23 // POPOVER PUBLIC CLASS DEFINITION
24 // ===============================
26 var Popover = function (element
, options
) {
27 this.init('popover', element
, options
)
30 if (!$.fn
.tooltip
) throw new Error('Popover requires tooltip.js')
32 Popover
.DEFAULTS
= $.extend({} , $.fn
.tooltip
.Constructor
.DEFAULTS
, {
36 , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
40 // NOTE: POPOVER EXTENDS tooltip.js
41 // ================================
43 Popover
.prototype = $.extend({}, $.fn
.tooltip
.Constructor
.prototype)
45 Popover
.prototype.constructor = Popover
47 Popover
.prototype.getDefaults = function () {
48 return Popover
.DEFAULTS
51 Popover
.prototype.setContent = function () {
53 var title
= this.getTitle()
54 var content
= this.getContent()
56 $tip
.find('.popover-title')[this.options
.html
? 'html' : 'text'](title
)
57 $tip
.find('.popover-content')[this.options
.html
? 'html' : 'text'](content
)
59 $tip
.removeClass('fade top bottom left right in')
61 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
62 // this manually by checking the contents.
63 if (!$tip
.find('.popover-title').html()) $tip
.find('.popover-title').hide()
66 Popover
.prototype.hasContent = function () {
67 return this.getTitle() || this.getContent()
70 Popover
.prototype.getContent = function () {
71 var $e
= this.$element
74 return $e
.attr('data-content')
75 || (typeof o
.content
== 'function' ?
76 o
.content
.call($e
[0]) :
80 Popover
.prototype.arrow = function () {
81 return this.$arrow
= this.$arrow
|| this.tip().find('.arrow')
84 Popover
.prototype.tip = function () {
85 if (!this.$tip
) this.$tip
= $(this.options
.template
)
90 // POPOVER PLUGIN DEFINITION
91 // =========================
93 var old
= $.fn
.popover
95 $.fn
.popover = function (option
) {
96 return this.each(function () {
98 var data
= $this.data('bs.popover')
99 var options
= typeof option
== 'object' && option
101 if (!data
) $this.data('bs.popover', (data
= new Popover(this, options
)))
102 if (typeof option
== 'string') data
[option
]()
106 $.fn
.popover
.Constructor
= Popover
109 // POPOVER NO CONFLICT
110 // ===================
112 $.fn
.popover
.noConflict = function () {