1
/* ========================================================================
2
* Bootstrap: popover.js v3.2.0
3
* http://getbootstrap.com/javascript/#popovers
4
* ========================================================================
5
* Copyright 2011-2014 Twitter, Inc.
6
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
7
* ======================================================================== */
13
// POPOVER PUBLIC CLASS DEFINITION
14
// ===============================
16
var Popover = function (element, options) {
17
this.init('popover', element, options)
20
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
22
Popover.VERSION = '3.2.0'
24
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
28
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
32
// NOTE: POPOVER EXTENDS tooltip.js
33
// ================================
35
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
37
Popover.prototype.constructor = Popover
39
Popover.prototype.getDefaults = function () {
40
return Popover.DEFAULTS
43
Popover.prototype.setContent = function () {
45
var title = this.getTitle()
46
var content = this.getContent()
48
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
49
$tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
50
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
53
$tip.removeClass('fade top bottom left right in')
55
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
56
// this manually by checking the contents.
57
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
60
Popover.prototype.hasContent = function () {
61
return this.getTitle() || this.getContent()
64
Popover.prototype.getContent = function () {
65
var $e = this.$element
68
return $e.attr('data-content')
69
|| (typeof o.content == 'function' ?
70
o.content.call($e[0]) :
74
Popover.prototype.arrow = function () {
75
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
78
Popover.prototype.tip = function () {
79
if (!this.$tip) this.$tip = $(this.options.template)
84
// POPOVER PLUGIN DEFINITION
85
// =========================
87
function Plugin(option) {
88
return this.each(function () {
90
var data = $this.data('bs.popover')
91
var options = typeof option == 'object' && option
93
if (!data && option == 'destroy') return
94
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
95
if (typeof option == 'string') data[option]()
99
var old = $.fn.popover
101
$.fn.popover = Plugin
102
$.fn.popover.Constructor = Popover
105
// POPOVER NO CONFLICT
106
// ===================
108
$.fn.popover.noConflict = function () {