Project

General

Profile

1
(function(a){if(typeof module!=="undefined"&&typeof exports=="object"){if(typeof window!="undefined"){module.exports=a()}else{module.exports=a}}else{window.Tooltip=a()}})(function(d){var e=function(h,i){i=i||{};this.link=typeof h==="object"?h:document.querySelector(h);this.title=this.link.getAttribute("title")||this.link.getAttribute("data-original-title");this.tooltip=null;this.options={};this.options.animation=i.animation&&i.animation!=="fade"?i.animation:"fade";this.options.placement=i.placement?i.placement:"top";this.options.delay=parseInt(i.delay)||100;this.isIE=(new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(navigator.userAgent)!=null)?parseFloat(RegExp.$1):false;this.duration=150;this.options.duration=this.isIE&&this.isIE<10?0:(i.duration||this.duration);this.options.container=i.container||document.body;if(this.title){this.init()}this.timer=0};e.prototype={init:function(){this.actions();this.rect=null;var h=("onmouseleave" in this.link)?["mouseenter","mouseleave"]:["mouseover","mouseout"];this.link.addEventListener(h[0],this.open,false);this.link.addEventListener(h[1],this.close,false);this.link.setAttribute("data-original-title",this.title);this.link.removeAttribute("title")},actions:function(){var h=this;this.open=function(i){clearTimeout(h.link.getAttribute("data-timer"));h.timer=setTimeout(function(){if(h.tooltip===null){h.createToolTip();h.styleTooltip();h.updateTooltip()}},h.options.duration);h.link.setAttribute("data-timer",h.timer)},this.close=function(i){clearTimeout(h.link.getAttribute("data-timer"));h.timer=setTimeout(function(){if(h.tooltip&&h.tooltip!==null){h.tooltip.className=h.tooltip.className.replace(" in","");setTimeout(function(){h.removeToolTip()},h.options.duration)}},h.options.delay+h.options.duration);h.link.setAttribute("data-timer",h.timer)},this.removeToolTip=function(){this.tooltip&&this.options.container.removeChild(this.tooltip);this.tooltip=null},this.createToolTip=function(){this.tooltip=document.createElement("div");this.tooltip.setAttribute("role","tooltip");var i=document.createElement("div");i.setAttribute("class","tooltip-arrow");var j=document.createElement("div");j.setAttribute("class","tooltip-inner");this.tooltip.appendChild(i);this.tooltip.appendChild(j);j.innerHTML=this.title;this.options.container.appendChild(this.tooltip)},this.styleTooltip=function(k){this.rect=this.getRect();var j=k||this.options.placement;this.tooltip.setAttribute("class","tooltip "+j+" "+this.options.animation);var i={w:this.link.offsetWidth,h:this.link.offsetHeight};var n=this.tooltipDimensions(this.tooltip);var o={w:n.w,h:n.h};var m=this.getScroll().y;var l=this.getScroll().x;if(/top/.test(j)){this.tooltip.style.top=this.rect.top+m-o.h+"px";this.tooltip.style.left=this.rect.left+l-o.w/2+i.w/2+"px"}else{if(/bottom/.test(j)){this.tooltip.style.top=this.rect.top+m+i.h+"px";this.tooltip.style.left=this.rect.left+l-o.w/2+i.w/2+"px"}else{if(/left/.test(j)){this.tooltip.style.top=this.rect.top+m-o.h/2+i.h/2+"px";this.tooltip.style.left=this.rect.left+l-o.w+"px"}else{if(/right/.test(j)){this.tooltip.style.top=this.rect.top+m-o.h/2+i.h/2+"px";this.tooltip.style.left=this.rect.left+l+i.w+"px"}}}}},this.updateTooltip=function(){var i=null;if(!this.isElementInViewport(this.tooltip)){i=this.updatePlacement()}else{i=this.options.placement}this.styleTooltip(i);this.tooltip.className+=" in"},this.updatePlacement=function(){var i=this.options.placement;if(/top/.test(i)){return"bottom"}else{if(/bottom/.test(i)){return"top"}else{if(/left/.test(i)){return"right"}else{if(/right/.test(i)){return"left"}}}}},this.getRect=function(){return this.link.getBoundingClientRect()},this.getScroll=function(){return{y:window.pageYOffset||document.documentElement.scrollTop,x:window.pageXOffset||document.documentElement.scrollLeft}},this.tooltipDimensions=function(i){return{w:i.offsetWidth,h:i.offsetHeight}},this.isElementInViewport=function(j){var i=j.getBoundingClientRect();return(i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth))}}};var f=document.querySelectorAll("[data-toggle=tooltip]"),a=0,g=f.length;for(a;a<g;a++){var b=f[a],c={};c.animation=b.getAttribute("data-animation");c.placement=b.getAttribute("data-placement");c.duration=b.getAttribute("data-duration");c.delay=b.getAttribute("data-delay");new e(b,c)}return e});
(11-11/11)