vendor: 11,922 bytes, lines 1-193
1 2+function($){'use strict';var Tooltip=function(element,options){this.type=null 3this.options=null 4this.enabled=null 5this.timeout=null 6this.hoverState=null 7this.$element=null 8this.inState=null 9this.init('tooltip',element,options)} 10Tooltip.VERSION='3.3.7' 11Tooltip.TRANSITION_DURATION=150 12Tooltip.DEFAULTS={animation:!0,placement:'top',selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:'hover focus',title:'',delay:0,html:!1,container:!1,viewport:{selector:'body',padding:0}} 13Tooltip.prototype.init=function(type,element,options){this.enabled=!0 14this.type=type 15this.$element=$(element) 16this.options=this.getOptions(options) 17this.$viewport=this.options.viewport&&$($.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):(this.options.viewport.selector||this.options.viewport)) 18this.inState={click:!1,hover:!1,focus:!1} 19if(this.$element[0]instanceof document.constructor&&!this.options.selector){throw new Error('`selector` option must be specified when initializing '+this.type+' on the window.document object!')} 20var triggers=this.options.trigger.split(' ') 21for(var i=triggers.length;i--;){var trigger=triggers[i] 22if(trigger=='click'){this.$element.on('click.'+this.type,this.options.selector,$.proxy(this.toggle,this))}else if(trigger!='manual'){var eventIn=trigger=='hover'?'mouseenter':'focusin' 23var eventOut=trigger=='hover'?'mouseleave':'focusout' 24this.$element.on(eventIn+'.'+this.type,this.options.selector,$.proxy(this.enter,this)) 25this.$element.on(eventOut+'.'+this.type,this.options.selector,$.proxy(this.leave,this))}} 26this.options.selector?(this._options=$.extend({},this.options,{trigger:'manual',selector:''})):this.fixTitle()} 27Tooltip.prototype.getDefaults=function(){return Tooltip.DEFAULTS} 28Tooltip.prototype.getOptions=function(options){options=$.extend({},this.getDefaults(),this.$element.data(),options) 29if(options.delay&&typeof options.delay=='number'){options.delay={show:options.delay,hide:options.delay}} 30return options} 31Tooltip.prototype.getDelegateOptions=function(){var options={} 32var defaults=this.getDefaults() 33this._options&&$.each(this._options,function(key,value){if(defaults[key]!=value)options[key]=value}) 34return options} 35Tooltip.prototype.enter=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget).data('bs.'+this.type) 36if(!self){self=new this.constructor(obj.currentTarget,this.getDelegateOptions()) 37$(obj.currentTarget).data('bs.'+this.type,self)} 38if(obj instanceof $.Event){self.inState[obj.type=='focusin'?'focus':'hover']=!0} 39if(self.tip().hasClass('in')||self.hoverState=='in'){self.hoverState='in' 40return} 41clearTimeout(self.timeout) 42self.hoverState='in' 43if(!self.options.delay||!self.options.delay.show)return self.show() 44self.timeout=setTimeout(function(){if(self.hoverState=='in')self.show()},self.options.delay.show)} 45Tooltip.prototype.isInStateTrue=function(){for(var key in this.inState){if(this.inState[key])return!0} 46return!1} 47Tooltip.prototype.leave=function(obj){var self=obj instanceof this.constructor?obj:$(obj.currentTarget).data('bs.'+this.type) 48if(!self){self=new this.constructor(obj.currentTarget,this.getDelegateOptions()) 49$(obj.currentTarget).data('bs.'+this.type,self)} 50if(obj instanceof $.Event){self.inState[obj.type=='focusout'?'focus':'hover']=!1} 51if(self.isInStateTrue())return 52clearTimeout(self.timeout) 53self.hoverState='out' 54if(!self.options.delay||!self.options.delay.hide)return self.hide() 55self.timeout=setTimeout(function(){if(self.hoverState=='out')self.hide()},self.options.delay.hide)} 56Tooltip.prototype.show=function(){var e=$.Event('show.bs.'+this.type) 57if(this.hasContent()&&this.enabled){this.$element.trigger(e) 58var inDom=$.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]) 59if(e.isDefaultPrevented()||!inDom)return 60var that=this 61var $tip=this.tip() 62var tipId=this.getUID(this.type) 63this.setContent() 64$tip.attr('id',tipId) 65this.$element.attr('aria-describedby',tipId) 66if(this.options.animation)$tip.addClass('fade') 67var placement=typeof this.options.placement=='function'?this.options.placement.call(this,$tip[0],this.$element[0]):this.options.placement 68var autoToken=/\s?auto?\s?/i 69var autoPlace=autoToken.test(placement) 70if(autoPlace)placement=placement.replace(autoToken,'')||'top' 71$tip.detach().css({top:0,left:0,display:'block'}).addClass(placement).data('bs.'+this.type,this) 72this.options.container?$tip.appendTo(this.options.container):$tip.insertAfter(this.$element) 73this.$element.trigger('inserted.bs.'+this.type) 74var pos=this.getPosition() 75var actualWidth=$tip[0].offsetWidth 76var actualHeight=$tip[0].offsetHeight 77if(autoPlace){var orgPlacement=placement 78var viewportDim=this.getPosition(this.$viewport) 79placement=placement=='bottom'&&pos.bottom+actualHeight>viewportDim.bottom?'top':placement=='top'&&pos.top-actualHeight<viewportDim.top?'bottom':placement=='right'&&pos.right+actualWidth>viewportDim.width?'left':placement=='left'&&pos.left-actualWidth<viewportDim.left?'right':placement 80$tip.removeClass(orgPlacement).addClass(placement)} 81var calculatedOffset=this.getCalculatedOffset(placement,pos,actualWidth,actualHeight) 82this.applyPlacement(calculatedOffset,placement) 83var complete=function(){var prevHoverState=that.hoverState 84that.$element.trigger('shown.bs.'+that.type) 85that.hoverState=null 86if(prevHoverState=='out')that.leave(that)} 87$.support.transition&&this.$tip.hasClass('fade')?$tip.one('bsTransitionEnd',complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION):complete()}} 88Tooltip.prototype.applyPlacement=function(offset,placement){var $tip=this.tip() 89var width=$tip[0].offsetWidth 90var height=$tip[0].offsetHeight 91var marginTop=parseInt($tip.css('margin-top'),10) 92var marginLeft=parseInt($tip.css('margin-left'),10) 93if(isNaN(marginTop))marginTop=0 94if(isNaN(marginLeft))marginLeft=0 95offset.top+=marginTop 96offset.left+=marginLeft 97$.offset.setOffset($tip[0],$.extend({using:function(props){$tip.css({top:Math.round(props.top),left:Math.round(props.left)})}},offset),0) 98$tip.addClass('in') 99var actualWidth=$tip[0].offsetWidth 100var actualHeight=$tip[0].offsetHeight 101if(placement=='top'&&actualHeight!=height){offset.top=offset.top+height-actualHeight} 102var delta=this.getViewportAdjustedDelta(placement,offset,actualWidth,actualHeight) 103if(delta.left)offset.left+=delta.left 104else offset.top+=delta.top 105var isVertical=/top|bottom/.test(placement) 106var arrowDelta=isVertical?delta.left*2-width+actualWidth:delta.top*2-height+actualHeight 107var arrowOffsetPosition=isVertical?'offsetWidth':'offsetHeight' 108$tip.offset(offset) 109this.replaceArrow(arrowDelta,$tip[0][arrowOffsetPosition],isVertical)} 110Tooltip.prototype.replaceArrow=function(delta,dimension,isVertical){this.arrow().css(isVertical?'left':'top',50*(1-delta/dimension)+'%').css(isVertical?'top':'left','')} 111Tooltip.prototype.setContent=function(){var $tip=this.tip() 112var title=this.getTitle() 113$tip.find('.tooltip-inner')[this.options.html?'html':'text'](title) 114$tip.removeClass('fade in top bottom left right')} 115Tooltip.prototype.hide=function(callback){var that=this 116var $tip=$(this.$tip) 117var e=$.Event('hide.bs.'+this.type) 118function complete(){if(that.hoverState!='in')$tip.detach() 119if(that.$element){that.$element.removeAttr('aria-describedby').trigger('hidden.bs.'+that.type)} 120callback&&callback()} 121this.$element.trigger(e) 122if(e.isDefaultPrevented())return 123$tip.removeClass('in') 124$.support.transition&&$tip.hasClass('fade')?$tip.one('bsTransitionEnd',complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION):complete() 125this.hoverState=null 126return this} 127Tooltip.prototype.fixTitle=function(){var $e=this.$element 128if($e.attr('title')||typeof $e.attr('data-original-title')!='string'){$e.attr('data-original-title',$e.attr('title')||'').attr('title','')}} 129Tooltip.prototype.hasContent=function(){return this.getTitle()} 130Tooltip.prototype.getPosition=function($element){$element=$element||this.$element 131var el=$element[0] 132var isBody=el.tagName=='BODY' 133var elRect=el.getBoundingClientRect() 134if(elRect.width==null){elRect=$.extend({},elRect,{width:elRect.right-elRect.left,height:elRect.bottom-elRect.top})} 135var isSvg=window.SVGElement&&el instanceof window.SVGElement 136var elOffset=isBody?{top:0,left:0}:(isSvg?null:$element.offset()) 137var scroll={scroll:isBody?document.documentElement.scrollTop||document.body.scrollTop:$element.scrollTop()} 138var outerDims=isBody?{width:$(window).width(),height:$(window).height()}:null 139return $.extend({},elRect,scroll,outerDims,elOffset)} 140Tooltip.prototype.getCalculatedOffset=function(placement,pos,actualWidth,actualHeight){return placement=='bottom'?{top:pos.top+pos.height,left:pos.left+pos.width/2-actualWidth/2}:placement=='top'?{top:pos.top-actualHeight,left:pos.left+pos.width/2-actualWidth/2}:placement=='left'?{top:pos.top+pos.height/2-actualHeight/2,left:pos.left-actualWidth}:{top:pos.top+pos.height/2-actualHeight/2,left:pos.left+pos.width}} 141Tooltip.prototype.getViewportAdjustedDelta=function(placement,pos,actualWidth,actualHeight){var delta={top:0,left:0} 142if(!this.$viewport)return delta 143var viewportPadding=this.options.viewport&&this.options.viewport.padding||0 144var viewportDimensions=this.getPosition(this.$viewport) 145if(/right|left/.test(placement)){var topEdgeOffset=pos.top-viewportPadding-viewportDimensions.scroll 146var bottomEdgeOffset=pos.top+viewportPadding-viewportDimensions.scroll+actualHeight 147if(topEdgeOffset<viewportDimensions.top){delta.top=viewportDimensions.top-topEdgeOffset}else if(bottomEdgeOffset>viewportDimensions.top+viewportDimensions.height){delta.top=viewportDimensions.top+viewportDimensions.height-bottomEdgeOffset}}else{var leftEdgeOffset=pos.left-viewportPadding 148var rightEdgeOffset=pos.left+viewportPadding+actualWidth 149if(leftEdgeOffset<viewportDimensions.left){delta.left=viewportDimensions.left-leftEdgeOffset}else if(rightEdgeOffset>viewportDimensions.right){delta.left=viewportDimensions.left+viewportDimensions.width-rightEdgeOffset}} 150return delta} 151Tooltip.prototype.getTitle=function(){var title 152var $e=this.$element 153var o=this.options 154title=$e.attr('data-original-title')||(typeof o.title=='function'?o.title.call($e[0]):o.title) 155return title} 156Tooltip.prototype.getUID=function(prefix){do prefix+=~~(Math.random()*1000000) 157while(document.getElementById(prefix)) 158return prefix} 159Tooltip.prototype.tip=function(){if(!this.$tip){this.$tip=$(this.options.template) 160if(this.$tip.length!=1){throw new Error(this.type+' `template` option must consist of exactly 1 top-level element!')}} 161return this.$tip} 162Tooltip.prototype.arrow=function(){return(this.$arrow=this.$arrow||this.tip().find('.tooltip-arrow'))} 163Tooltip.prototype.enable=function(){this.enabled=!0} 164Tooltip.prototype.disable=function(){this.enabled=!1} 165Tooltip.prototype.toggleEnabled=function(){this.enabled=!this.enabled} 166Tooltip.prototype.toggle=function(e){var self=this 167if(e){self=$(e.currentTarget).data('bs.'+this.type) 168if(!self){self=new this.constructor(e.currentTarget,this.getDelegateOptions()) 169$(e.currentTarget).data('bs.'+this.type,self)}} 170if(e){self.inState.click=!self.inState.click 171if(self.isInStateTrue())self.enter(self) 172else self.leave(self)}else{self.tip().hasClass('in')?self.leave(self):self.enter(self)}} 173Tooltip.prototype.destroy=function(){var that=this 174clearTimeout(this.timeout) 175this.hide(function(){that.$element.off('.'+that.type).removeData('bs.'+that.type) 176if(that.$tip){that.$tip.detach()} 177that.$tip=null 178that.$arrow=null 179that.$viewport=null 180that.$element=null})} 181function Plugin(option){return this.each(function(){var $this=$(this) 182var data=$this.data('bs.tooltip') 183var options=typeof option=='object'&&option 184if(!data&&/destroy|hide/.test(option))return 185if(!data)$this.data('bs.tooltip',(data=new Tooltip(this,options))) 186if(typeof option=='string')data[option]()})} 187var old=$.fn.tooltip 188$.fn.tooltip=Plugin 189$.fn.tooltip.Constructor=Tooltip 190$.fn.tooltip.noConflict=function(){$.fn.tooltip=old 191return this}}(jQuery); 192 193
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.