Files
PyRIGS/RIGS/static/js/tooltip.js
2020-10-09 09:25:23 +01:00

6 lines
13 KiB
JavaScript

/*!
* Bootstrap tooltip.js v4.5.2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("jquery"),require("popper.js"),require("./util.js")):"function"==typeof define&&define.amd?define(["jquery","popper.js","./util.js"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).Tooltip=e(t.jQuery,t.Popper,t.Util)}(this,(function(t,e,i){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,i=i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;var n=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],o={"*":["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","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/gi,s=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;function a(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);for(var o=(new window.DOMParser).parseFromString(t,"text/html"),a=Object.keys(e),l=[].slice.call(o.body.querySelectorAll("*")),c=function(t,i){var o=l[t],c=o.nodeName.toLowerCase();if(-1===a.indexOf(o.nodeName.toLowerCase()))return o.parentNode.removeChild(o),"continue";var h=[].slice.call(o.attributes),u=[].concat(e["*"]||[],e[c]||[]);h.forEach((function(t){(function(t,e){var i=t.nodeName.toLowerCase();if(-1!==e.indexOf(i))return-1===n.indexOf(i)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(s));for(var o=e.filter((function(t){return t instanceof RegExp})),a=0,l=o.length;a<l;a++)if(i.match(o[a]))return!0;return!1})(t,u)||o.removeAttribute(t.nodeName)}))},h=0,u=l.length;h<u;h++)c(h);return o.body.innerHTML}function l(){return(l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}function c(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var h="tooltip",u=".bs.tooltip",f=t.fn[h],g=new RegExp("(^|\\s)bs-tooltip\\S+","g"),p=["sanitize","whiteList","sanitizeFn"],d={animation:"boolean",template:"string",title:"(string|element|function)",trigger:"string",delay:"(number|object)",html:"boolean",selector:"(string|boolean)",placement:"(string|function)",offset:"(number|string|function)",container:"(string|element|boolean)",fallbackPlacement:"(string|array)",boundary:"(string|element)",sanitize:"boolean",sanitizeFn:"(null|function)",whiteList:"object",popperConfig:"(null|object)"},m={AUTO:"auto",TOP:"top",RIGHT:"right",BOTTOM:"bottom",LEFT:"left"},v={animation:!0,template:'<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:0,container:!1,fallbackPlacement:"flip",boundary:"scrollParent",sanitize:!0,sanitizeFn:null,whiteList:o,popperConfig:null},_={HIDE:"hide"+u,HIDDEN:"hidden"+u,SHOW:"show"+u,SHOWN:"shown"+u,INSERTED:"inserted"+u,CLICK:"click"+u,FOCUSIN:"focusin"+u,FOCUSOUT:"focusout"+u,MOUSEENTER:"mouseenter"+u,MOUSELEAVE:"mouseleave"+u},b=function(){function n(t,i){if(void 0===e)throw new TypeError("Bootstrap's tooltips require Popper.js (https://popper.js.org/)");this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._popper=null,this.element=t,this.config=this._getConfig(i),this.tip=null,this._setListeners()}var o,r,s,f=n.prototype;return f.enable=function(){this._isEnabled=!0},f.disable=function(){this._isEnabled=!1},f.toggleEnabled=function(){this._isEnabled=!this._isEnabled},f.toggle=function(e){if(this._isEnabled)if(e){var i=this.constructor.DATA_KEY,n=t(e.currentTarget).data(i);n||(n=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(i,n)),n._activeTrigger.click=!n._activeTrigger.click,n._isWithActiveTrigger()?n._enter(null,n):n._leave(null,n)}else{if(t(this.getTipElement()).hasClass("show"))return void this._leave(null,this);this._enter(null,this)}},f.dispose=function(){clearTimeout(this._timeout),t.removeData(this.element,this.constructor.DATA_KEY),t(this.element).off(this.constructor.EVENT_KEY),t(this.element).closest(".modal").off("hide.bs.modal",this._hideModalHandler),this.tip&&t(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._popper&&this._popper.destroy(),this._popper=null,this.element=null,this.config=null,this.tip=null},f.show=function(){var n=this;if("none"===t(this.element).css("display"))throw new Error("Please use show on visible elements");var o=t.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){t(this.element).trigger(o);var r=i.findShadowRoot(this.element),s=t.contains(null!==r?r:this.element.ownerDocument.documentElement,this.element);if(o.isDefaultPrevented()||!s)return;var a=this.getTipElement(),l=i.getUID(this.constructor.NAME);a.setAttribute("id",l),this.element.setAttribute("aria-describedby",l),this.setContent(),this.config.animation&&t(a).addClass("fade");var c="function"==typeof this.config.placement?this.config.placement.call(this,a,this.element):this.config.placement,h=this._getAttachment(c);this.addAttachmentClass(h);var u=this._getContainer();t(a).data(this.constructor.DATA_KEY,this),t.contains(this.element.ownerDocument.documentElement,this.tip)||t(a).appendTo(u),t(this.element).trigger(this.constructor.Event.INSERTED),this._popper=new e(this.element,a,this._getPopperConfig(h)),t(a).addClass("show"),"ontouchstart"in document.documentElement&&t(document.body).children().on("mouseover",null,t.noop);var f=function(){n.config.animation&&n._fixTransition();var e=n._hoverState;n._hoverState=null,t(n.element).trigger(n.constructor.Event.SHOWN),"out"===e&&n._leave(null,n)};if(t(this.tip).hasClass("fade")){var g=i.getTransitionDurationFromElement(this.tip);t(this.tip).one(i.TRANSITION_END,f).emulateTransitionEnd(g)}else f()}},f.hide=function(e){var n=this,o=this.getTipElement(),r=t.Event(this.constructor.Event.HIDE),s=function(){"show"!==n._hoverState&&o.parentNode&&o.parentNode.removeChild(o),n._cleanTipClass(),n.element.removeAttribute("aria-describedby"),t(n.element).trigger(n.constructor.Event.HIDDEN),null!==n._popper&&n._popper.destroy(),e&&e()};if(t(this.element).trigger(r),!r.isDefaultPrevented()){if(t(o).removeClass("show"),"ontouchstart"in document.documentElement&&t(document.body).children().off("mouseover",null,t.noop),this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,t(this.tip).hasClass("fade")){var a=i.getTransitionDurationFromElement(o);t(o).one(i.TRANSITION_END,s).emulateTransitionEnd(a)}else s();this._hoverState=""}},f.update=function(){null!==this._popper&&this._popper.scheduleUpdate()},f.isWithContent=function(){return Boolean(this.getTitle())},f.addAttachmentClass=function(e){t(this.getTipElement()).addClass("bs-tooltip-"+e)},f.getTipElement=function(){return this.tip=this.tip||t(this.config.template)[0],this.tip},f.setContent=function(){var e=this.getTipElement();this.setElementContent(t(e.querySelectorAll(".tooltip-inner")),this.getTitle()),t(e).removeClass("fade show")},f.setElementContent=function(e,i){"object"!=typeof i||!i.nodeType&&!i.jquery?this.config.html?(this.config.sanitize&&(i=a(i,this.config.whiteList,this.config.sanitizeFn)),e.html(i)):e.text(i):this.config.html?t(i).parent().is(e)||e.empty().append(i):e.text(t(i).text())},f.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},f._getPopperConfig=function(t){var e=this;return l({},{placement:t,modifiers:{offset:this._getOffset(),flip:{behavior:this.config.fallbackPlacement},arrow:{element:".arrow"},preventOverflow:{boundariesElement:this.config.boundary}},onCreate:function(t){t.originalPlacement!==t.placement&&e._handlePopperPlacementChange(t)},onUpdate:function(t){return e._handlePopperPlacementChange(t)}},this.config.popperConfig)},f._getOffset=function(){var t=this,e={};return"function"==typeof this.config.offset?e.fn=function(e){return e.offsets=l({},e.offsets,t.config.offset(e.offsets,t.element)||{}),e}:e.offset=this.config.offset,e},f._getContainer=function(){return!1===this.config.container?document.body:i.isElement(this.config.container)?t(this.config.container):t(document).find(this.config.container)},f._getAttachment=function(t){return m[t.toUpperCase()]},f._setListeners=function(){var e=this;this.config.trigger.split(" ").forEach((function(i){if("click"===i)t(e.element).on(e.constructor.Event.CLICK,e.config.selector,(function(t){return e.toggle(t)}));else if("manual"!==i){var n="hover"===i?e.constructor.Event.MOUSEENTER:e.constructor.Event.FOCUSIN,o="hover"===i?e.constructor.Event.MOUSELEAVE:e.constructor.Event.FOCUSOUT;t(e.element).on(n,e.config.selector,(function(t){return e._enter(t)})).on(o,e.config.selector,(function(t){return e._leave(t)}))}})),this._hideModalHandler=function(){e.element&&e.hide()},t(this.element).closest(".modal").on("hide.bs.modal",this._hideModalHandler),this.config.selector?this.config=l({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},f._fixTitle=function(){var t=typeof this.element.getAttribute("data-original-title");(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},f._enter=function(e,i){var n=this.constructor.DATA_KEY;(i=i||t(e.currentTarget).data(n))||(i=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(n,i)),e&&(i._activeTrigger["focusin"===e.type?"focus":"hover"]=!0),t(i.getTipElement()).hasClass("show")||"show"===i._hoverState?i._hoverState="show":(clearTimeout(i._timeout),i._hoverState="show",i.config.delay&&i.config.delay.show?i._timeout=setTimeout((function(){"show"===i._hoverState&&i.show()}),i.config.delay.show):i.show())},f._leave=function(e,i){var n=this.constructor.DATA_KEY;(i=i||t(e.currentTarget).data(n))||(i=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(n,i)),e&&(i._activeTrigger["focusout"===e.type?"focus":"hover"]=!1),i._isWithActiveTrigger()||(clearTimeout(i._timeout),i._hoverState="out",i.config.delay&&i.config.delay.hide?i._timeout=setTimeout((function(){"out"===i._hoverState&&i.hide()}),i.config.delay.hide):i.hide())},f._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},f._getConfig=function(e){var n=t(this.element).data();return Object.keys(n).forEach((function(t){-1!==p.indexOf(t)&&delete n[t]})),"number"==typeof(e=l({},this.constructor.Default,n,"object"==typeof e&&e?e:{})).delay&&(e.delay={show:e.delay,hide:e.delay}),"number"==typeof e.title&&(e.title=e.title.toString()),"number"==typeof e.content&&(e.content=e.content.toString()),i.typeCheckConfig(h,e,this.constructor.DefaultType),e.sanitize&&(e.template=a(e.template,e.whiteList,e.sanitizeFn)),e},f._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},f._cleanTipClass=function(){var e=t(this.getTipElement()),i=e.attr("class").match(g);null!==i&&i.length&&e.removeClass(i.join(""))},f._handlePopperPlacementChange=function(t){this.tip=t.instance.popper,this._cleanTipClass(),this.addAttachmentClass(this._getAttachment(t.placement))},f._fixTransition=function(){var e=this.getTipElement(),i=this.config.animation;null===e.getAttribute("x-placement")&&(t(e).removeClass("fade"),this.config.animation=!1,this.hide(),this.show(),this.config.animation=i)},n._jQueryInterface=function(e){return this.each((function(){var i=t(this).data("bs.tooltip"),o="object"==typeof e&&e;if((i||!/dispose|hide/.test(e))&&(i||(i=new n(this,o),t(this).data("bs.tooltip",i)),"string"==typeof e)){if(void 0===i[e])throw new TypeError('No method named "'+e+'"');i[e]()}}))},o=n,s=[{key:"VERSION",get:function(){return"4.5.2"}},{key:"Default",get:function(){return v}},{key:"NAME",get:function(){return h}},{key:"DATA_KEY",get:function(){return"bs.tooltip"}},{key:"Event",get:function(){return _}},{key:"EVENT_KEY",get:function(){return u}},{key:"DefaultType",get:function(){return d}}],(r=null)&&c(o.prototype,r),s&&c(o,s),n}();return t.fn[h]=b._jQueryInterface,t.fn[h].Constructor=b,t.fn[h].noConflict=function(){return t.fn[h]=f,b._jQueryInterface},b}));