PageSourceSearch

https://www.impresi.cz/js/common/tooltip.min.js?v2

js impresi.cz collected 2026-10-06 19:15:03 UTC 12,984 bytes, 1 lines download raw bytes

1(function(window,document){"use strict";if(window.AppTooltip)return;const selectors=new Map([['[data-toggle="tooltip"]',{}]]);const elementOptions=new WeakMap;const states=new WeakMap;const prepared=new WeakMap;const destroyed=new WeakSet;const owners=new WeakMap;const active=new Set;let nextId=0;let frame=0;function elements(target){if(typeof target==="string")return Array.from(document.querySelectorAll(target));if(target instanceof Element)return[target];return target?Array.from(target).filter(element=>element instanceof Element):[]}function registered(element){return!destroyed.has(element)&&(elementOptions.has(element)||Array.from(selectors.keys()).some(selector=>element.matches(selector)))}function prepare(element){if(destroyed.has(element))return;if(!prepared.has(element))prepared.set(element,{ownsTitle:!element.hasAttribute("data-original-title")});if(element.hasAttribute("title")){const title=element.getAttribute("title");if(title||!element.hasAttribute("data-original-title"))element.setAttribute("data-original-title",title);element.removeAttribute("title")}}function refresh(root=document){if(root instanceof Element&&registered(root))prepare(root);if(!root.querySelectorAll)return;const selector=Array.from(selectors.keys()).join(",");if(selector)root.querySelectorAll(selector).forEach(prepare)}function optionsFor(element,overrides){const data=element.dataset;const options={placement:data.placement||"top",trigger:data.trigger||"hover focus",html:data.html==="true",animation:data.animation!=="false"};selectors.forEach((settings,selector)=>{if(element.matches(selector))Object.assign(options,settings)});return Object.assign(options,elementOptions.get(element),overrides)}function titleFor(element,options){const title=options.title!==undefined?options.title:element.getAttribute("data-original-title")||element.getAttribute("data-title")||"";return String(typeof title==="function"?title.call(element):title)}function safeHtml(html){const template=document.createElement("template");template.innerHTML=html;const allowed=new Set(["A","B","BR","DIV","EM","I","LI","OL","P","S","SMALL","SPAN","STRONG","SUB","SUP","U","UL"]);const discard=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","SVG","MATH","TEMPLATE"]);Array.from(template.content.querySelectorAll("*")).reverse().forEach(element=>{if(discard.has(element.tagName)){element.remove();return}if(!allowed.has(element.tagName)){element.replaceWith(...element.childNodes);return}Array.from(element.attributes).forEach(attribute=>{const safeLink=element.tagName==="A"&&attribute.name==="href"&&/^(https?:\/\/|mailto:|\/[^/]|#)/i.test(attribute.value.trim());if(attribute.name!=="title"&&!safeLink)element.removeAttribute(attribute.name)})});return template.content}function stateFor(element){if(!states.has(element))states.set(element,{element:element,tip:null,hover:false,focus:false,click:false,tipHover:false,timer:0,overrides:{}});return states.get(element)}function remove(state){clearTimeout(state.timer);state.timer=0;if(state.tip){const ids=(state.element.getAttribute("aria-describedby")||"").split(/\s+/).filter(id=>id&&id!==state.tip.id);if(ids.length)state.element.setAttribute("aria-describedby",ids.join(" "));else state.element.removeAttribute("aria-describedby");state.tip.remove();state.tip=null}state.hover=state.focus=state.click=state.tipHover=false;active.delete(state)}function visible(element){if(!element.isConnected||!element.getClientRects().length)return false;const rect=element.getBoundingClientRect();const style=getComputedStyle(element);if(style.visibility==="hidden"||style.visibility==="collapse")return false;if(rect.bottom<=0||rect.right<=0||rect.top>=window.innerHeight||rect.left>=document.documentElement.clientWidth)return false;for(let parent=element;parent&&parent!==document.documentElement;parent=parent.parentElement){const parentStyle=parent===element?style:getComputedStyle(parent);if(parent.hidden||parent.getAttribute("aria-hidden")==="true"||Number(parentStyle.opacity)===0)return false;if(parent!==element&&parent!==document.body){const box=parent.getBoundingClientRect();if(/(auto|scroll|hidden|clip)/.test(parentStyle.overflowY)&&(rect.bottom<=box.top||rect.top>=box.bottom))return false;if(/(auto|scroll|hidden|clip)/.test(parentStyle.overflowX)&&(rect.right<=box.left||rect.left>=box.right))return false}}return true}function position(state,options){const tip=state.tip;const rect=state.element.getBoundingClientRect();
1const viewport=window.visualViewport;const leftEdge=(viewport?viewport.offsetLeft:0)+5;const topEdge=(viewport?viewport.offsetTop:0)+5;const rightEdge=leftEdge+(viewport?viewport.width:document.documentElement.clientWidth)-10;const bottomEdge=topEdge+(viewport?viewport.height:window.innerHeight)-10;const wanted=String(options.placement).replace(/\bauto\b/g,"").trim();let placement=["top","bottom","left","right"].includes(wanted)?wanted:"top";tip.classList.remove("top","bottom","left","right");tip.classList.add(placement);tip.style.width="";tip.style.left="0px";tip.style.maxWidth=Math.max(1,rightEdge-leftEdge)+"px";tip.lastElementChild.style.maxHeight=Math.max(1,bottomEdge-topEdge-10)+"px";let box=tip.getBoundingClientRect();const space={top:rect.top-topEdge,bottom:bottomEdge-rect.bottom,left:rect.left-leftEdge,right:rightEdge-rect.right};const opposite={top:"bottom",bottom:"top",left:"right",right:"left"};if(placement==="left"||placement==="right"){if(space[placement]<Math.min(100,box.width+3)&&space[opposite[placement]]>space[placement]){tip.classList.replace(placement,opposite[placement]);placement=opposite[placement]}tip.style.maxWidth=Math.max(1,Math.min(rightEdge-leftEdge,space[placement]-3))+"px";box=tip.getBoundingClientRect()}const needed=placement==="top"||placement==="bottom"?box.height+3:box.width+3;if(space[placement]<needed&&space[opposite[placement]]>space[placement]){tip.classList.replace(placement,opposite[placement]);placement=opposite[placement];box=tip.getBoundingClientRect()}let left=rect.left+(rect.width-box.width)/2;let top=rect.top+(rect.height-box.height)/2;if(placement==="top")top=rect.top-box.height-3;if(placement==="bottom")top=rect.bottom+3;if(placement==="left")left=rect.left-box.width-3;if(placement==="right")left=rect.right+3;left=Math.max(leftEdge,Math.min(left,rightEdge-box.width));top=Math.max(topEdge,Math.min(top,bottomEdge-box.height));tip.style.width=box.width+"px";tip.style.left=left+"px";tip.style.top=top+"px";const arrow=tip.firstElementChild;const vertical=placement==="top"||placement==="bottom";arrow.style.left=vertical?Math.max(5,Math.min(rect.left+rect.width/2-left,box.width-5))+"px":"";arrow.style.top=vertical?"":Math.max(5,Math.min(rect.top+rect.height/2-top,box.height-5))+"px"}function update(state){if(!visible(state.element)){remove(state);return}if(!state.tip)return;if(state.tip!==document.body.lastElementChild)document.body.appendChild(state.tip);const options=optionsFor(state.element,state.overrides);const title=titleFor(state.element,options);if(!title){remove(state);return}if(state.title!==title||state.html!==options.html){const inner=state.tip.lastElementChild;if(options.html){inner.textContent="";inner.appendChild(safeHtml(title))}else inner.textContent=title;state.title=title;state.html=options.html}position(state,options)}function showOne(element,overrides={}){if(destroyed.has(element))return;prepare(element);const state=stateFor(element);const options=optionsFor(element,overrides);if(!visible(element)||!titleFor(element,options)){remove(state);return}clearTimeout(state.timer);state.timer=0;state.overrides=overrides;if(!state.tip){const tip=document.createElement("div");tip.id="app-tooltip-"+ ++nextId;tip.className="tooltip app-tooltip"+(options.animation?" fade":"");tip.setAttribute("role","tooltip");tip.innerHTML='<div class="tooltip-arrow"></div><div class="tooltip-inner"></div>';state.tip=tip;state.title=null;owners.set(tip,state);document.body.appendChild(tip);const ids=(element.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);ids.push(tip.id);element.setAttribute("aria-describedby",ids.join(" "))}active.add(state);update(state);if(state.tip){void state.tip.offsetWidth;state.tip.classList.add("in")}}function show(target,overrides){elements(target).forEach(element=>showOne(element,overrides))}function hide(target){elements(target).forEach(element=>{const state=states.get(element);if(state)remove(state)})}function init(target,options={}){if(typeof target==="string")selectors.set(target,Object.assign({},selectors.get(target),options));elements(target).forEach(element=>{destroyed.delete(element);if(typeof target!=="string")elementOptions.set(element,Object.assign({},elementOptions.get(element),options));prepare(element)});schedule()}function destroy(target){elements(target).forEach(element=>{hide(element);destroyed.add(element);const title=element.getAttribute("data-original-title");if(title!==null)element.setAttribute("title",title);const preparation=prepared.get(element);if(preparation&&preparation.ownsTitle)element.removeAttribute("data-original-title");elementOptions.delete(element);states.delete(element);prepared.delete(element)})}function triggerFor(target){for(let element=target instanceof Element?target:null;element;element=element.parentElement){if(registered(element))return element}return null}function activate(element,trigger,enabled){if(!String(optionsFor(element).trigger).split(/\s+/).includes(trigger))return;const state=stateFor(element);state[trigger]=enabled;clearTimeout(state.timer);if(state.hover||state.focus||state.click||state.tipHover){const delay=optionsFor(element).delay;const milliseconds=Number(typeof delay==="object"?delay.show:delay)||0;if(!state.tip&&milliseconds>0){active.add(state);
1state.timer=window.setTimeout(()=>{active.delete(state);showOne(element)},milliseconds)}else showOne(element)}else leave(state)}function leave(state){if(state.hover||state.focus||state.click||state.tipHover)return;clearTimeout(state.timer);const delay=optionsFor(state.element).delay;const milliseconds=delay===undefined?120:Number(typeof delay==="object"?delay.hide:delay)||0;if(milliseconds)state.timer=window.setTimeout(()=>remove(state),milliseconds);else remove(state)}function mouse(event){const entering=event.type==="mouseover";const tip=event.target instanceof Element&&event.target.closest(".app-tooltip");const owner=tip&&owners.get(tip);if(owner&&String(optionsFor(owner.element).trigger).split(/\s+/).includes("hover")&&!(event.relatedTarget instanceof Node&&tip.contains(event.relatedTarget))){owner.tipHover=entering;if(entering)clearTimeout(owner.timer);else leave(owner)}const element=triggerFor(event.target);if(element&&!(event.relatedTarget instanceof Node&&element.contains(event.relatedTarget)))activate(element,"hover",entering)}function schedule(){if(frame||!active.size)return;frame=window.requestAnimationFrame(()=>{frame=0;active.forEach(update)})}function changed(mutations){let relevant=false;for(const mutation of mutations){if(mutation.target instanceof Element&&mutation.target.closest(".app-tooltip"))continue;if(mutation.type==="childList"){const nodes=[...mutation.addedNodes,...mutation.removedNodes];if(nodes.every(node=>node instanceof Element&&node.classList.contains("app-tooltip")))continue;relevant=true;mutation.addedNodes.forEach(node=>{if(node instanceof Element&&!node.classList.contains("app-tooltip"))refresh(node)})}else{relevant=true;if(registered(mutation.target))prepare(mutation.target)}}if(!relevant)return;active.forEach(state=>{if(!state.element.isConnected)remove(state)});schedule()}function start(){refresh();new MutationObserver(changed).observe(document.body,{subtree:true,childList:true,attributes:true,attributeFilter:["title","data-original-title","data-title","data-trigger","data-placement","data-html","class","style","hidden","aria-hidden","open"]})}document.addEventListener("mouseover",mouse);document.addEventListener("mouseout",mouse);document.addEventListener("focusin",event=>{const element=triggerFor(event.target);if(element)activate(element,"focus",true)});document.addEventListener("focusout",event=>{const element=triggerFor(event.target);if(element&&!(event.relatedTarget instanceof Node&&element.contains(event.relatedTarget)))activate(element,"focus",false)});document.addEventListener("click",event=>{const element=triggerFor(event.target);if(element)activate(element,"click",!stateFor(element).click)});document.addEventListener("keydown",event=>{if(event.key==="Escape")Array.from(active).forEach(remove)});document.addEventListener("scroll",schedule,true);window.addEventListener("resize",schedule);if(window.visualViewport){window.visualViewport.addEventListener("resize",schedule);window.visualViewport.addEventListener("scroll",schedule)}window.AppTooltip={init:init,show:show,hide:hide,destroy:destroy,refresh:refresh};if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",start,{once:true});else start()})(window,document);

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.