1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/bootstrap-source/bootstrap-3.0.3/js/popover.js Fri Jan 17 11:59:43 2014 +0100
1.3 @@ -0,0 +1,117 @@
1.4 +/* ========================================================================
1.5 + * Bootstrap: popover.js v3.0.3
1.6 + * http://getbootstrap.com/javascript/#popovers
1.7 + * ========================================================================
1.8 + * Copyright 2013 Twitter, Inc.
1.9 + *
1.10 + * Licensed under the Apache License, Version 2.0 (the "License");
1.11 + * you may not use this file except in compliance with the License.
1.12 + * You may obtain a copy of the License at
1.13 + *
1.14 + * http://www.apache.org/licenses/LICENSE-2.0
1.15 + *
1.16 + * Unless required by applicable law or agreed to in writing, software
1.17 + * distributed under the License is distributed on an "AS IS" BASIS,
1.18 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1.19 + * See the License for the specific language governing permissions and
1.20 + * limitations under the License.
1.21 + * ======================================================================== */
1.22 +
1.23 +
1.24 ++function ($) { "use strict";
1.25 +
1.26 + // POPOVER PUBLIC CLASS DEFINITION
1.27 + // ===============================
1.28 +
1.29 + var Popover = function (element, options) {
1.30 + this.init('popover', element, options)
1.31 + }
1.32 +
1.33 + if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
1.34 +
1.35 + Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
1.36 + placement: 'right'
1.37 + , trigger: 'click'
1.38 + , content: ''
1.39 + , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
1.40 + })
1.41 +
1.42 +
1.43 + // NOTE: POPOVER EXTENDS tooltip.js
1.44 + // ================================
1.45 +
1.46 + Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
1.47 +
1.48 + Popover.prototype.constructor = Popover
1.49 +
1.50 + Popover.prototype.getDefaults = function () {
1.51 + return Popover.DEFAULTS
1.52 + }
1.53 +
1.54 + Popover.prototype.setContent = function () {
1.55 + var $tip = this.tip()
1.56 + var title = this.getTitle()
1.57 + var content = this.getContent()
1.58 +
1.59 + $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
1.60 + $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
1.61 +
1.62 + $tip.removeClass('fade top bottom left right in')
1.63 +
1.64 + // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
1.65 + // this manually by checking the contents.
1.66 + if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
1.67 + }
1.68 +
1.69 + Popover.prototype.hasContent = function () {
1.70 + return this.getTitle() || this.getContent()
1.71 + }
1.72 +
1.73 + Popover.prototype.getContent = function () {
1.74 + var $e = this.$element
1.75 + var o = this.options
1.76 +
1.77 + return $e.attr('data-content')
1.78 + || (typeof o.content == 'function' ?
1.79 + o.content.call($e[0]) :
1.80 + o.content)
1.81 + }
1.82 +
1.83 + Popover.prototype.arrow = function () {
1.84 + return this.$arrow = this.$arrow || this.tip().find('.arrow')
1.85 + }
1.86 +
1.87 + Popover.prototype.tip = function () {
1.88 + if (!this.$tip) this.$tip = $(this.options.template)
1.89 + return this.$tip
1.90 + }
1.91 +
1.92 +
1.93 + // POPOVER PLUGIN DEFINITION
1.94 + // =========================
1.95 +
1.96 + var old = $.fn.popover
1.97 +
1.98 + $.fn.popover = function (option) {
1.99 + return this.each(function () {
1.100 + var $this = $(this)
1.101 + var data = $this.data('bs.popover')
1.102 + var options = typeof option == 'object' && option
1.103 +
1.104 + if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
1.105 + if (typeof option == 'string') data[option]()
1.106 + })
1.107 + }
1.108 +
1.109 + $.fn.popover.Constructor = Popover
1.110 +
1.111 +
1.112 + // POPOVER NO CONFLICT
1.113 + // ===================
1.114 +
1.115 + $.fn.popover.noConflict = function () {
1.116 + $.fn.popover = old
1.117 + return this
1.118 + }
1.119 +
1.120 +}(jQuery);