1/** 2 * @preserve 3 * @name AccessibilityBar 4 * @author Sami El-Younsi 5 * @version 1.1.3 6 * @date 10.09.2024 7 * @param {object} options - Options to customize the services for the AccessibilityBar module. 8*/class AccessibilityBar{constructor(e){this.version="1.1.3",this.module="AccessibilityBar",this.className="accessibility-bar",this.lang=document.documentElement.lang.split(/[-_]/)[0].toLowerCase(),this.observer=null,this.isObserverActive=!1,this.options={selector:"#navigation .navi, #quickbar li.accessibility-bar",position:"beforeend",services:{fontSize:{icon:'<svg width="25" height="23" viewBox="0 0 20 18" fill="inherit" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_4_241)"><path d="M13.1031 17L7.27877 1H5.82437L0 17H1.63151L3.73475 11.2216H9.36839L11.4716 17H13.1031ZM4.29164 9.68888L6.54987 3.48302L8.80809 9.68888H4.28994H4.29164Z" fill="inherit"/><path d="M15.5046 4.81311H14.0536L12.1257 10.1095L12.9466 12.3644H16.6217L18.0046 16.1638H19.6361L15.5063 4.81652L15.5046 4.81311ZM13.495 10.8299L14.7791 7.30124L16.0631 10.8299H13.495Z" fill="inherit"/></g><defs><clipPath id="clip0_4_241"><rect width="19.7" height="18" fill="white"/></clipPath></defs></svg>',l10n:{de:{buttonTitle:{active:"Schriftgr\xF6\xDFe zur\xFCcksetzen",inactive:"Schriftgr\xF6\xDFe erh\xF6hen"},svgTitle:"Schriftgr\xF6\xDFe"},en:{buttonTitle:{active:"Reset font size",inactive:"Increase font size"},svgTitle:"Font size"}},config:{sizes:["100%","110%","130%"]},function:this.toggleFontSize},contrast:{icon:'<svg width="24" height="23" viewBox="0 0 19 18" fill="inherit" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.69995 16.56C13.8752 16.56 17.26 13.1753 17.26 9C17.26 4.82473 13.8752 1.44 9.69995 1.44C5.52468 1.44 2.13995 4.82473 2.13995 9C2.13995 13.1753 5.52468 16.56 9.69995 16.56ZM9.69995 18C14.6705 18 18.7 13.9706 18.7 9C18.7 4.02944 14.6705 0 9.69995 0C4.72939 0 0.699951 4.02944 0.699951 9C0.699951 13.9706 4.72939 18 9.69995 18Z" fill="inherit"/><path d="M9.69995 15.12C13.0799 15.12 15.82 12.38 15.82 9C15.82 5.62002 13.0799 2.88 9.69995 2.88V15.12Z" fill="inherit"/></svg>',l10n:{de:{buttonTitle:{active:"Erh\xF6hten Kontrast zur\xFCcksetzen",inactive:"Kontrast erh\xF6hen"},svgTitle:"Kontrast"},en:{buttonTitle:{active:"Reset increased contrast",inactive:"Increase contrast"},svgTitle:"Contrast"}},config:{htmlClass:"contrast-intensify"},function:this.toggleContrast}},translation:{de:{containerNotFound:"Es konnte kein Container mit dem Selektor <u>{{selector}}</u> gefunden werden!",accessibilityNote:"BFSG Hinweis"},en:{containerNotFound:"No container with the selector <u>{{selector}}</u> could be found!",accessibilityNote:"BFSG Note"}},defaultIcon:'<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>'},this.tooltip={selector:"[aria-label][data-tooltip]",lastActiveElement:null,lastInputType:null,marginEdges:36},this.buttons={},this.settings=this.merge(this.options,e),this.selector=document.querySelectorAll(this.settings.selector),this.setUpLocalStorage(),this.init()}init(){this.selector&&this.selector.length>0?(this.createMarkup(),this.initTooltips()):this.errorMessage(this.getTranslation("containerNotFound",{selector:this.settings.selector}))}createMarkup(){this.selector.forEach((e,t)=>{let i;e.tagName==="UL"&&(this.settings.position==="afterbegin"||this.settings.position==="beforeend")?(e=this.createElement({tag:"li"},e,this.settings.position),i=this.createElement({tag:"ul"},e,this.settings.position)):i=this.createElement({tag:"ul"},e,this.settings.position),(this.settings.position==="afterbegin"||this.settings.position==="beforeend")&&e.classList.add(`${this.className}__container`),i.classList.add(this.className),Object.entries(this.settings.services).forEac
8h(([s,o])=>{let l=s.replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`),a=this.createElement({tag:"li",className:`${this.className}__item ${this.className}__item--${l}`},i),n=this.createElement({tag:"button",type:"button",tabIndex:e.dataset.tabIndex?e.dataset.tabIndex:0,ariaLabel:this.getTranslation("buttonTitle.inactive",{},s),dataset:{tooltip:""}},a);n.innerHTML=o.icon?o.icon:this.settings.defaultIcon,this.buttons[s]||(this.buttons[s]=[]),this.buttons[s].push(n);let r=n.firstChild;this.createElement({tag:"title",innerText:this.getTranslation("svgTitle",{},s)},r,"afterbegin"),r.setAttribute("role","img"),o.function(n,s,this)})})}toggleContrast(e,t,i){let s=i.getStorage(),o=document.documentElement;if(s[t]){let l=e.classList.toggle("active");i.toggleButtonTitle(l,t,e),o.classList.add(i.settings.services[t].config.htmlClass)}if(window.matchMedia&&(window.matchMedia("(forced-colors: active)").matches||window.matchMedia("(prefers-contrast: high)").matches)){let l=e.classList.add("active");i.toggleButtonTitle(!0,t,e),o.classList.add("system-high-contrast",i.settings.services[t].config.htmlClass)}i.handleButtonListener(e,l=>{o.classList.toggle(i.settings.services[t].config.htmlClass),i.buttons[t].forEach(a=>{let n=a.classList.toggle("active");i.toggleButtonTitle(n,t)}),i.setStorageItem(t,o.classList.contains(i.settings.services[t].config.htmlClass))})}toggleFontSize(e,t,i){let s=()=>i.getStorage()[t]||0,o=(a,n)=>{let r=i.settings.services[t].config.sizes,c=n>=r.length-1;n===0?a.classList.remove("active"):a.classList.add("active");const h=[...document.documentElement.classList].filter(d=>d.startsWith("font-size-"));document.documentElement.classList.remove(...h),n&&document.documentElement.classList.add(`font-size-${l[n].replace(/%/g,"")}`),document.documentElement.style.setProperty("--percent-font-size",l[n]),i.toggleButtonTitle(c,t,a)},l=i.settings.services[t].config.sizes;o(e,s()),i.handleButtonListener(e,a=>{let n=(s()+1)%l.length;i.buttons[t].forEach(r=>o(r,n)),i.setStorageItem(t,n)})}toggleButtonTitle(e,t,i=null){let s=this.getTranslation("buttonTitle.inactive",{},t),o=this.getTranslation("buttonTitle.active",{},t),l=e?o:s;if(i){i.ariaLabel=l;let a=i.querySelector(".tooltip");a&&(a.textContent=l)}else this.buttons[t].forEach(a=>a.ariaLabel=l)}handleButtonListener(e,t){e.addEventListener("click",i=>{i.isTrusted&&t(i)})}initTooltips(){let e=this;this.tooltip.element=e.createElement({tag:"span",dataset:{tooltipElement:""}},document.body),this.tooltip.element.style.opacity=0,document.querySelectorAll(e.tooltip.selector).forEach((t,i)=>{if(!t.classList.contains("tooltip-initialized")){t.classList.add("tooltip-initialized"),t.dataset.tooltipItem=i;const s=t.getAttribute("data-tooltip");(!s||s==="hover"||s==="focus-visible"||s==="focus")&&((s==="hover"||!s)&&(t.addEventListener("mouseenter",o=>e.handleMouseEnter(t)),t.addEventListener("mouseleave",()=>e.hideTooltip()),t.addEventListener("touchstart",o=>e.handleTouchStart(t))),(s==="focus"||s==="focus-visible"||!s)&&(t.addEventListener("focusin",o=>e.handleFocusIn(t)),t.addEventListener("focusout",()=>e.hideTooltip())))}}),document.addEventListener("touchstart",t=>{!e.tooltip.element.contains(t.target)&&!t.target.closest(e.tooltip.selector)&&e.hideTooltip()}),window.addEventListener("scroll",t=>{this.updateTooltipPosition(this.tooltip.lastActiveElement)}),window.addEventListener("resize",t=>{this.updateTooltipPosition(this.tooltip.lastActiveElement)}),window.addEventListener("keydown",t=>{t.key==="Tab"&&(this.tooltip.lastInputType="keyboard")}),window.addEventListener("mousedown",()=>{this.tooltip.lastInputType="mouse"})}handleTouchStart(e){this.tooltip.lastInputType="touch",this.updateTooltipPosition(e)}handleMouseEnter(e){this.tooltip.lastInputType="mouse",this.updateTooltipPosition(e)}handleFocusIn(e){e.getAttribute("data-tooltip")==="focus-visible"?(this.tooltip.lastInputType==="keyboard"||this.tooltip.lastInputType===null)&&this.updateTooltipPosition(e):this.updateTooltipPosition(e)}hideTooltip(){this.tooltip.element.style.opacity=0,this.tooltip.lastActiveElement=null,this.stopMutationObserver()}updateTooltipText(e){this.tooltip.element.innerText=e}updateTooltipPosition(e){if(!e)return;this.tooltip.element.style.width="",this.tooltip.element.className="",this.tooltip.lastActiveElement=e,this.tooltip.element.innerText=e.ariaLabel;let t=e.getBoundingClientRect(),i=this.tooltip.element.getBoundingClientRect(),s=this.tooltip.marginEdges,o,l,a=t.top,n=window.innerHeight-t.bottom,r=window.innerWidth-(t.left+i.width+s),c=t.right-i.width-s;if(a>t.height+s?l=a-(i.height+2):(n>t.height+s,l=a+(t.height+2)),r>0)o=t.left;else if(c>0)o=t.left+t.width-i.width;else{let h=Math.min(i.width,window.innerWidth-((t.right-t.left)*2+s*2));this.tooltip.element.style.width=`${h}px`,window.innerWidth-(t.left+h+s)>0?o=t.left:t.right-h-s>0?o=t.left+t.width-h:o=t.left/2}return this.tooltip.element.style.left=`${o}px`,this.tooltip.element.style.top=`${l}px`,e.dataset.tooltipClass&&this.tooltip.element.classList.add(...e.dataset.tooltipClass.split(" ").filter(
8Boolean)),this.checkElementState()&&(this.tooltip.element.style.opacity=1),this.isObserverActive||this.initMutationObserver(),t}checkElementState(){let e=this.tooltip.lastActiveElement,t=e.dataset.tooltip?e.dataset.tooltip:"default",i=this.tooltip.lastInputType;if(!(e instanceof Element))return!1;switch(!0){case(t==="hover"&&i==="mouse"):case(t==="hover"&&i==="touch"):return!0;case(t==="focus"&&i==="touch"):case(t==="focus"&&i==="mouse"):case(t==="focus"&&i==="keyboard"):return!0;case(t==="focus-visible"&&i==="keyboard"):return!0;case t==="default":return!0;default:return!1}}initMutationObserver(){this.tooltip.lastActiveElement&&(this.observer=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="aria-label"&&setTimeout(()=>{this.updateTooltipPosition(this.tooltip.lastActiveElement)},300)}),this.observer.observe(this.tooltip.lastActiveElement,{attributes:!0,attributeFilter:["aria-label"],subtree:!0}),this.isObserverActive=!0)}stopMutationObserver(){this.observer&&(this.observer.disconnect(),this.isObserverActive=!1)}setStorageItem(e,t){let i=this.getStorage();i[e]=t,this.localStorage.setItem(this.className,JSON.stringify(i))}getStorage(){let e=this.localStorage.getItem(this.className);return e=e===null||e===""||e===!1?{}:JSON.parse(e),e}setUpLocalStorage(){try{window.localStorage,window.localStorage.setItem,window._storageDisabled=!1,this.localStorage=window.localStorage}catch(e){this.localStorage={_items:new Map,setItem(t,i){this._items.set(t,i)},getItem(t){return this._items.has(t)?this._items.get(t):null}},window._storageDisabled=!0,console.log("sessionStorage and/or localStorage not available, falling back to in-memory storage: ",e)}}createElement(e,t,i="beforeend"){let s=document.createElement(e.tag),o=e?.dataset?e.dataset:!1;delete e.tag,delete e.dataset;for(let l in e)s[l]=e[l];if(o)for(let l in o)s.dataset[l]=o[l];return t.insertAdjacentElement(i,s),s}errorMessage(e){window.notification?notification.add({id:"formError",classNames:"accessibility-notification",message:`<p class="h6"><strong>${this.getTranslation("accessibilityNote")}</strong></p> <small>${e}</small>`,saveState:!1}):console.error(e)}getTranslation(e,t={},i=""){let s=i?this.settings.services[i].l10n:this.settings.translation;if(this.lang in s){const o=e.split(".");let l=s[this.lang];for(let a of o)if(l=l[a],!l)break;for(let a in t)l=l.replace(`{{${a}}}`,t[a]);return l}return s.en!==void 0&&s.en.hasOwnProperty(e)?s.en[e]:e}merge(...e){let t={};const i=s=>{for(let o in s)s.hasOwnProperty(o)&&(Object.prototype.toString.call(s[o])==="[object Object]"?t[o]=this.merge(t[o],s[o]):t[o]=s[o])};for(let s=0;s<e.length;s++)i(e[s]);return t}}
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.