All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bsf.js.tooltip.js Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
/*
 ========================================================================
 Bootstrap: tooltip.js v3.4.1
 https://getbootstrap.com/docs/3.4/javascript/#tooltip
 Inspired by the original jQuery.tipsy by Jason Frame
 ========================================================================
 Copyright 2011-2019 Twitter, Inc.
 Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 ======================================================================== */
var process=process||{env:{NODE_ENV:"development"}};
+function(e){function r(b,a){var c=b.nodeName.toLowerCase();if(-1!==e.inArray(c,a))return-1!==e.inArray(c,t)?!(!b.nodeValue.match(u)&&!b.nodeValue.match(v)):!0;b=e(a).filter(function(h,k){return k instanceof RegExp});a=0;for(var d=b.length;a
', trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]}};f.prototype.init=function(b,a,c){this.enabled=!0;this.type= b;this.$element=e(a);this.options=this.getOptions(c);this.$viewport=this.options.viewport&&e(document).find(e.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport);this.inState={click:!1,hover:!1,focus:!1};if(this.$element[0]instanceof document.constructor&&!this.options.selector)throw Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");b=this.options.trigger.split(" "); for(a=b.length;a--;)if(c=b[a],"click"==c)this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if("manual"!=c){var d="hover"==c?"mouseleave":"focusout";this.$element.on(("hover"==c?"mouseenter":"focusin")+"."+this.type,this.options.selector,e.proxy(this.enter,this));this.$element.on(d+"."+this.type,this.options.selector,e.proxy(this.leave,this))}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()};f.prototype.getDefaults= function(){return f.DEFAULTS};f.prototype.getOptions=function(b){var a=this.$element.data(),c;for(c in a)a.hasOwnProperty(c)&&-1!==e.inArray(c,y)&&delete a[c];b=e.extend({},this.getDefaults(),a,b);b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay});b.sanitize&&(b.template=p(b.template,b.whiteList,b.sanitizeFn));return b};f.prototype.getDelegateOptions=function(){var b={},a=this.getDefaults();this._options&&e.each(this._options,function(c,d){a[c]!=d&&(b[c]=d)});return b};f.prototype.enter= function(b){var a=b instanceof this.constructor?b:e(b.currentTarget).data("bs."+this.type);a||(a=new this.constructor(b.currentTarget,this.getDelegateOptions()),e(b.currentTarget).data("bs."+this.type,a));b instanceof e.Event&&(a.inState["focusin"==b.type?"focus":"hover"]=!0);if(a.tip().hasClass("in")||"in"==a.hoverState)a.hoverState="in";else{clearTimeout(a.timeout);a.hoverState="in";if(!a.options.delay||!a.options.delay.show)return a.show();a.timeout=setTimeout(function(){"in"==a.hoverState&&a.show()}, a.options.delay.show)}};f.prototype.isInStateTrue=function(){for(var b in this.inState)if(this.inState[b])return!0;return!1};f.prototype.leave=function(b){var a=b instanceof this.constructor?b:e(b.currentTarget).data("bs."+this.type);a||(a=new this.constructor(b.currentTarget,this.getDelegateOptions()),e(b.currentTarget).data("bs."+this.type,a));b instanceof e.Event&&(a.inState["focusout"==b.type?"focus":"hover"]=!1);if(!a.isInStateTrue()){clearTimeout(a.timeout);a.hoverState="out";if(!a.options.delay|| !a.options.delay.hide)return a.hide();a.timeout=setTimeout(function(){"out"==a.hoverState&&a.hide()},a.options.delay.hide)}};f.prototype.show=function(){var b=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var a=e.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(!b.isDefaultPrevented()&&a){var c=this;b=this.tip();a=this.getUID(this.type);this.setContent();b.attr("id",a);this.$element.attr("aria-describedby",a);this.options.animation&& b.addClass("fade");a="function"==typeof this.options.placement?this.options.placement.call(this,b[0],this.$element[0]):this.options.placement;var d=/\s?auto?\s?/i,h=d.test(a);h&&(a=a.replace(d,"")||"top");b.detach().css({top:0,left:0,display:"block"}).addClass(a).data("bs."+this.type,this);this.options.container?b.appendTo(e(document).find(this.options.container)):b.insertAfter(this.$element);this.$element.trigger("inserted.bs."+this.type);d=this.getPosition();var k=b[0].offsetWidth,g=b[0].offsetHeight; if(h){h=a;var l=this.getPosition(this.$viewport);a="bottom"==a&&d.bottom+g>l.bottom?"top":"top"==a&&d.top-gl.width?"left":"left"==a&&d.left-kg.top+g.height&&(h.top=g.top+g.height-a)):(d=a.left-k,a=a.left+k+c,dg.right&&(h.left=g.left+g.width-a));return h};f.prototype.getTitle=function(){var b=this.$element,a=this.options;return b.attr("data-original-title")||("function"==typeof a.title?a.title.call(b[0]):a.title)};f.prototype.getUID=function(b){do b+= ~~(1E6*Math.random());while(document.getElementById(b));return b};f.prototype.tip=function(){if(!this.$tip&&(this.$tip=e(this.options.template),1!=this.$tip.length))throw Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip};f.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")};f.prototype.enable=function(){this.enabled=!0};f.prototype.disable=function(){this.enabled=!1};f.prototype.toggleEnabled=function(){this.enabled= !this.enabled};f.prototype.toggle=function(b){var a=this;b&&(a=e(b.currentTarget).data("bs."+this.type),a||(a=new this.constructor(b.currentTarget,this.getDelegateOptions()),e(b.currentTarget).data("bs."+this.type,a)));b?(a.inState.click=!a.inState.click,a.isInStateTrue()?a.enter(a):a.leave(a)):a.tip().hasClass("in")?a.leave(a):a.enter(a)};f.prototype.destroy=function(){var b=this;clearTimeout(this.timeout);this.hide(function(){b.$element.off("."+b.type).removeData("bs."+b.type);b.$tip&&b.$tip.detach(); b.$tip=null;b.$arrow=null;b.$viewport=null;b.$element=null})};f.prototype.sanitizeHtml=function(b){return p(b,this.options.whiteList,this.options.sanitizeFn)};var z=e.fn.tooltip;e.fn.tooltip=function(b){return this.each(function(){var a=e(this),c=a.data("bs.tooltip"),d="object"==typeof b&&b;if(c||!/destroy|hide/.test(b))if(c||a.data("bs.tooltip",c=new f(this,d)),"string"==typeof b)c[b]()})};e.fn.tooltip.Constructor=f;e.fn.tooltip.noConflict=function(){e.fn.tooltip=z;return this}}(jQuery);



© 2015 - 2025 Weber Informatics LLC | Privacy Policy