2012-01-31 22:58:28 +01:00
|
|
|
/* ===========================================================
|
2013-02-06 06:20:29 +01:00
|
|
|
* bootstrap-popover.js v2.3.0
|
2012-01-31 22:58:28 +01:00
|
|
|
* http://twitter.github.com/bootstrap/javascript.html#popovers
|
|
|
|
* ===========================================================
|
|
|
|
* Copyright 2012 Twitter, Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
* =========================================================== */
|
|
|
|
|
|
|
|
|
2012-04-15 01:29:53 +02:00
|
|
|
!function ($) {
|
2012-01-31 22:58:28 +01:00
|
|
|
|
2012-04-15 01:29:53 +02:00
|
|
|
"use strict"; // jshint ;_;
|
|
|
|
|
|
|
|
|
|
|
|
/* POPOVER PUBLIC CLASS DEFINITION
|
|
|
|
* =============================== */
|
2012-01-31 22:58:28 +01:00
|
|
|
|
2012-07-23 03:28:39 +02:00
|
|
|
var Popover = function (element, options) {
|
2012-01-31 22:58:28 +01:00
|
|
|
this.init('popover', element, options)
|
|
|
|
}
|
|
|
|
|
2012-04-15 01:29:53 +02:00
|
|
|
|
2012-01-31 22:58:28 +01:00
|
|
|
/* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
|
|
|
|
========================================== */
|
|
|
|
|
|
|
|
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
|
|
|
|
|
|
|
|
constructor: Popover
|
|
|
|
|
|
|
|
, setContent: function () {
|
|
|
|
var $tip = this.tip()
|
|
|
|
, title = this.getTitle()
|
|
|
|
, content = this.getContent()
|
|
|
|
|
2012-06-03 02:55:10 +02:00
|
|
|
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
|
2012-12-02 10:32:23 +01:00
|
|
|
$tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
|
2012-01-31 22:58:28 +01:00
|
|
|
|
|
|
|
$tip.removeClass('fade top bottom left right in')
|
|
|
|
}
|
|
|
|
|
|
|
|
, hasContent: function () {
|
|
|
|
return this.getTitle() || this.getContent()
|
|
|
|
}
|
|
|
|
|
|
|
|
, getContent: function () {
|
|
|
|
var content
|
|
|
|
, $e = this.$element
|
|
|
|
, o = this.options
|
|
|
|
|
2013-02-06 07:17:28 +01:00
|
|
|
content = (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
|
|
|
|
|| $e.attr('data-content')
|
2012-01-31 22:58:28 +01:00
|
|
|
|
|
|
|
return content
|
|
|
|
}
|
|
|
|
|
2012-04-15 01:29:53 +02:00
|
|
|
, tip: function () {
|
2012-01-31 22:58:28 +01:00
|
|
|
if (!this.$tip) {
|
|
|
|
this.$tip = $(this.options.template)
|
|
|
|
}
|
|
|
|
return this.$tip
|
|
|
|
}
|
|
|
|
|
2012-06-21 08:46:29 +02:00
|
|
|
, destroy: function () {
|
2012-07-23 03:28:39 +02:00
|
|
|
this.hide().$element.off('.' + this.type).removeData(this.type)
|
2012-06-21 08:46:29 +02:00
|
|
|
}
|
|
|
|
|
2012-01-31 22:58:28 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
/* POPOVER PLUGIN DEFINITION
|
|
|
|
* ======================= */
|
|
|
|
|
2012-12-07 23:06:01 +01:00
|
|
|
var old = $.fn.popover
|
|
|
|
|
2012-04-15 01:29:53 +02:00
|
|
|
$.fn.popover = function (option) {
|
2012-01-31 22:58:28 +01:00
|
|
|
return this.each(function () {
|
|
|
|
var $this = $(this)
|
|
|
|
, data = $this.data('popover')
|
|
|
|
, options = typeof option == 'object' && option
|
|
|
|
if (!data) $this.data('popover', (data = new Popover(this, options)))
|
|
|
|
if (typeof option == 'string') data[option]()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
$.fn.popover.Constructor = Popover
|
|
|
|
|
|
|
|
$.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
|
|
|
|
placement: 'right'
|
2012-08-19 04:54:30 +02:00
|
|
|
, trigger: 'click'
|
2012-01-31 22:58:28 +01:00
|
|
|
, content: ''
|
2013-01-11 03:50:52 +01:00
|
|
|
, template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
|
2012-01-31 22:58:28 +01:00
|
|
|
})
|
|
|
|
|
2012-12-07 23:06:01 +01:00
|
|
|
|
|
|
|
/* POPOVER NO CONFLICT
|
|
|
|
* =================== */
|
|
|
|
|
|
|
|
$.fn.popover.noConflict = function () {
|
|
|
|
$.fn.popover = old
|
|
|
|
return this
|
|
|
|
}
|
|
|
|
|
2013-02-06 07:17:28 +01:00
|
|
|
}(window.jQuery);
|