1
/* ========================================================================
2
* Bootstrap: popover.js v3.1.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.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
26
template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
30
// NOTE: POPOVER EXTENDS tooltip.js
31
// ================================
33
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
35
Popover.prototype.constructor = Popover
37
Popover.prototype.getDefaults = function () {
38
return Popover.DEFAULTS
41
Popover.prototype.setContent = function () {
43
var title = this.getTitle()
44
var content = this.getContent()
46
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
47
$tip.find('.popover-content')[ // we use append for html objects to maintain js events
48
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
51
$tip.removeClass('fade top bottom left right in')
53
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
54
// this manually by checking the contents.
55
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
58
Popover.prototype.hasContent = function () {
59
return this.getTitle() || this.getContent()
62
Popover.prototype.getContent = function () {
63
var $e = this.$element
66
return $e.attr('data-content')
67
|| (typeof o.content == 'function' ?
68
o.content.call($e[0]) :
72
Popover.prototype.arrow = function () {
73
return this.$arrow = this.$arrow || this.tip().find('.arrow')
76
Popover.prototype.tip = function () {
77
if (!this.$tip) this.$tip = $(this.options.template)
82
// POPOVER PLUGIN DEFINITION
83
// =========================
85
var old = $.fn.popover
87
$.fn.popover = function (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
$.fn.popover.Constructor = Popover
102
// POPOVER NO CONFLICT
103
// ===================
105
$.fn.popover.noConflict = function () {