1 line
1.2 KiB
JavaScript
1 line
1.2 KiB
JavaScript
!function(i){"use strict";var p=function(t,o){this.init("popover",t,o)};p.prototype=i.extend({},i.fn.tooltip.Constructor.prototype,{constructor:p,setContent:function(){var t=this.tip(),o=this.getTitle(),e=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](o),t.find(".popover-content > *")[this.options.html?"html":"text"](e),t.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var t=this.$element,o=this.options;return t.attr("data-content")||("function"==typeof o.content?o.content.call(t[0]):o.content)},tip:function(){return this.$tip||(this.$tip=i(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}}),i.fn.popover=function(n){return this.each(function(){var t=i(this),o=t.data("popover"),e="object"==typeof n&&n;o||t.data("popover",o=new p(this,e)),"string"==typeof n&&o[n]()})},i.fn.popover.Constructor=p,i.fn.popover.defaults=i.extend({},i.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery); |