indvd00m@0
|
1 |
/* ===========================================================
|
indvd00m@0
|
2 |
* bootstrap-popover.js v2.3.1
|
indvd00m@0
|
3 |
* http://twitter.github.com/bootstrap/javascript.html#popovers
|
indvd00m@0
|
4 |
* ===========================================================
|
indvd00m@0
|
5 |
* Copyright 2012 Twitter, Inc.
|
indvd00m@0
|
6 |
*
|
indvd00m@0
|
7 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
indvd00m@0
|
8 |
* you may not use this file except in compliance with the License.
|
indvd00m@0
|
9 |
* You may obtain a copy of the License at
|
indvd00m@0
|
10 |
*
|
indvd00m@0
|
11 |
* http://www.apache.org/licenses/LICENSE-2.0
|
indvd00m@0
|
12 |
*
|
indvd00m@0
|
13 |
* Unless required by applicable law or agreed to in writing, software
|
indvd00m@0
|
14 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
indvd00m@0
|
15 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
indvd00m@0
|
16 |
* See the License for the specific language governing permissions and
|
indvd00m@0
|
17 |
* limitations under the License.
|
indvd00m@0
|
18 |
* =========================================================== */
|
indvd00m@0
|
19 |
|
indvd00m@0
|
20 |
|
indvd00m@0
|
21 |
!function ($) {
|
indvd00m@0
|
22 |
|
indvd00m@0
|
23 |
"use strict"; // jshint ;_;
|
indvd00m@0
|
24 |
|
indvd00m@0
|
25 |
|
indvd00m@0
|
26 |
/* POPOVER PUBLIC CLASS DEFINITION
|
indvd00m@0
|
27 |
* =============================== */
|
indvd00m@0
|
28 |
|
indvd00m@0
|
29 |
var Popover = function (element, options) {
|
indvd00m@0
|
30 |
this.init('popover', element, options)
|
indvd00m@0
|
31 |
}
|
indvd00m@0
|
32 |
|
indvd00m@0
|
33 |
|
indvd00m@0
|
34 |
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
|
indvd00m@0
|
35 |
========================================== */
|
indvd00m@0
|
36 |
|
indvd00m@0
|
37 |
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
|
indvd00m@0
|
38 |
|
indvd00m@0
|
39 |
constructor: Popover
|
indvd00m@0
|
40 |
|
indvd00m@0
|
41 |
, setContent: function () {
|
indvd00m@0
|
42 |
var $tip = this.tip()
|
indvd00m@0
|
43 |
, title = this.getTitle()
|
indvd00m@0
|
44 |
, content = this.getContent()
|
indvd00m@0
|
45 |
|
indvd00m@0
|
46 |
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
indvd00m@0
|
47 |
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
|
indvd00m@0
|
48 |
|
indvd00m@0
|
49 |
$tip.removeClass('fade top bottom left right in')
|
indvd00m@0
|
50 |
}
|
indvd00m@0
|
51 |
|
indvd00m@0
|
52 |
, hasContent: function () {
|
indvd00m@0
|
53 |
return this.getTitle() || this.getContent()
|
indvd00m@0
|
54 |
}
|
indvd00m@0
|
55 |
|
indvd00m@0
|
56 |
, getContent: function () {
|
indvd00m@0
|
57 |
var content
|
indvd00m@0
|
58 |
, $e = this.$element
|
indvd00m@0
|
59 |
, o = this.options
|
indvd00m@0
|
60 |
|
indvd00m@0
|
61 |
content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
indvd00m@0
|
62 |
|| $e.attr('data-content')
|
indvd00m@0
|
63 |
|
indvd00m@0
|
64 |
return content
|
indvd00m@0
|
65 |
}
|
indvd00m@0
|
66 |
|
indvd00m@0
|
67 |
, tip: function () {
|
indvd00m@0
|
68 |
if (!this.$tip) {
|
indvd00m@0
|
69 |
this.$tip = $(this.options.template)
|
indvd00m@0
|
70 |
}
|
indvd00m@0
|
71 |
return this.$tip
|
indvd00m@0
|
72 |
}
|
indvd00m@0
|
73 |
|
indvd00m@0
|
74 |
, destroy: function () {
|
indvd00m@0
|
75 |
this.hide().$element.off('.' + this.type).removeData(this.type)
|
indvd00m@0
|
76 |
}
|
indvd00m@0
|
77 |
|
indvd00m@0
|
78 |
})
|
indvd00m@0
|
79 |
|
indvd00m@0
|
80 |
|
indvd00m@0
|
81 |
/* POPOVER PLUGIN DEFINITION
|
indvd00m@0
|
82 |
* ======================= */
|
indvd00m@0
|
83 |
|
indvd00m@0
|
84 |
var old = $.fn.popover
|
indvd00m@0
|
85 |
|
indvd00m@0
|
86 |
$.fn.popover = function (option) {
|
indvd00m@0
|
87 |
return this.each(function () {
|
indvd00m@0
|
88 |
var $this = $(this)
|
indvd00m@0
|
89 |
, data = $this.data('popover')
|
indvd00m@0
|
90 |
, options = typeof option == 'object' && option
|
indvd00m@0
|
91 |
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
indvd00m@0
|
92 |
if (typeof option == 'string') data[option]()
|
indvd00m@0
|
93 |
})
|
indvd00m@0
|
94 |
}
|
indvd00m@0
|
95 |
|
indvd00m@0
|
96 |
$.fn.popover.Constructor = Popover
|
indvd00m@0
|
97 |
|
indvd00m@0
|
98 |
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
|
indvd00m@0
|
99 |
placement: 'right'
|
indvd00m@0
|
100 |
, trigger: 'click'
|
indvd00m@0
|
101 |
, content: ''
|
indvd00m@0
|
102 |
, template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
indvd00m@0
|
103 |
})
|
indvd00m@0
|
104 |
|
indvd00m@0
|
105 |
|
indvd00m@0
|
106 |
/* POPOVER NO CONFLICT
|
indvd00m@0
|
107 |
* =================== */
|
indvd00m@0
|
108 |
|
indvd00m@0
|
109 |
$.fn.popover.noConflict = function () {
|
indvd00m@0
|
110 |
$.fn.popover = old
|
indvd00m@0
|
111 |
return this
|
indvd00m@0
|
112 |
}
|
indvd00m@0
|
113 |
|
indvd00m@0
|
114 |
}(window.jQuery);
|