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