PageSourceSearch

https://www.glomm-spedition.de/js/vendor/quickButtons.min.js

js glomm-spedition.de collected 2026-10-09 23:21:53 UTC 5,602 bytes, 10 lines download raw bytes

1/**
2 * @name QuickButtons
3 * @author Bartosz Adamski
4 * @editor Sami El-Younsi
5 * @version 1.3.2
6 * @date 24.05.2025
7 * @param {string} selector - A CSS selector string to identify the CTA container element.
8 * @param {Object} [options={}] - Optional settings to customize the component behavior.
9*/
10class QuickButtons{constructor(t,e={}){this.ctaContainer=document.querySelector(t),this.ctaItems=this.ctaContainer.querySelectorAll(".cta-item"),this.lang=document.documentElement.lang.split(/[-_]/)[0].toLowerCase(),this.options={resizeDelay:275,scrollUpdate:!0,resizeUpdate:!0,observeBodyClassChanges:!0,dayConversion:{de:{"Mo:":"Montag","Di:":"Dienstag","Mi:":"Mittwoch","Do:":"Donnerstag","Fr:":"Freitag","Sa:":"Samstag","So:":"Sonntag"},en:{"Mon:":"Monday","Tue:":"Tuesday","Wed:":"Wednesday","Thu:":"Thursday","Fri:":"Friday","Sat:":"Saturday","Sun:":"Sunday"}},heightsToMonitor:[],translation:{de:{locationAnnouncement:"Adresse",times:{openTimesAnnouncement:"Öffnungszeiten",untilText:"bis"},contact:{phoneNumber:"Telefonnummer",emailAdress:"E-Mail Adresse"}},en:{locationAnnouncement:"Address",times:{openTimesAnnouncement:"Open times",untilText:"to"},contact:{phoneNumber:"Phonenumber",emailAdress:"Mailadress"}}}},this.defaultHeightsToMonitor=[{selectors:["#navigation"],cssVar:"--navigation-height-dynamic"},{selectors:[".widgetFlex"],cssVar:"--yourrate-mobile"}],this.settings=this.merge(this.options,e),this.settings.heightsToMonitor=this.settings.heightsToMonitor.concat(this.defaultHeightsToMonitor),this.init()}init(){this.applyAccessibilityEnhancements(),this.startMonitoring()}startMonitoring(){let t;const e=()=>{this.settings.heightsToMonitor.forEach((t=>{let e=0;t.selectors.forEach((t=>{if("#navigation"===t){const s=document.querySelector(t);s&&(e+=s.offsetHeight)}else document.querySelectorAll(t).forEach((t=>{t&&(e+=t.offsetHeight)}))})),document.documentElement.style.setProperty(t.cssVar,`${e}px`)}))},s=(s=this.settings.resizeDelay)=>{clearTimeout(t),t=setTimeout(e,s)};e();const i={attributes:!0,childList:!0,subtree:!0};if((()=>{this.settings.heightsToMonitor.forEach((t=>{t.selectors.forEach((t=>{document.querySelectorAll(t).forEach((t=>{if(t){new MutationObserver((()=>s())).observe(t,i)}}))}))}))})(),this.settings.resizeUpdate&&window.addEventListener("resize",s),this.settings.scrollUpdate&&window.addEventListener("scroll",e),this.settings.observeBodyClassChanges){(()=>{new MutationObserver((t=>{t.forEach((t=>{"attributes"===t.type&&"class"===t.attributeName&&s()}))})).observe(document.body,{attributes:!0})})(),document.body.classList.contains("scrolled")&&s()}}applyAccessibilityEnhancements(){this.ctaItems.forEach((t=>{t.setAttribute("tabindex","0");const e=t.querySelector(".cta-icon");e&&e.setAttribute("aria-hidden","true");t.querySelectorAll("a.phone, a[href^='tel:'], a.email, a[href^='mailto:']").forEach((t=>{t.classList.contains("phone")||t.href.startsWith("tel:")?t.setAttribute("aria-label",`${this.getTranslation("contact.phoneNumber")}: ${t.textContent}`):t.classList.contains("email")||t.href.startsWith("mailto:")?t.setAttribute("aria-label",`${this.getTranslation("contact.emailAdress")}: ${t.textContent}`):t.title?t.setAttribute("aria-label",t.title):t.setAttribute("aria-label",t.textContent)}));if(t.querySelectorAll("dl dt").forEach((t=>{t.setAttribute("role","definition")})),t.classList.contains("opening-hours-suffix")||t.classList.contains("cta-times")){let e=`${this.getTranslation("times.openTimesAnnouncement")}. `;t.querySelectorAll("dt").forEach((t=>{const s=t.textContent.trim(),i=this.convertDays(s);i&&(t.setAttribute("aria-label",i),e+=`${i} `);const n=t.nextElementSibling;if(n&&"dd"===n.tagName.toLowerCase()){const t=n.textContent.trim(),s=this.translateHours(t);n.setAttribute("aria-label",s),e+=`${s} `}})),t.setAttribute("aria-label",e.trim())}}));this.ctaContainer.querySelectorAll(".cta-list").forEach((t=>{t.setAttribute("tabindex","0")})),document.addEventListener("touchstart",(t=>{const e=document.querySelector(".cta-item:focus-within");if(e&&!e.contains(t.target)){const t=e.querySelector(":focus");t?t.blur():e.blur?.()}}),{passive:!0}
10),this.ctaItems.forEach((t=>{if(!t.hasAttribute("tabindex"))return;const e=t.querySelector(":scope > a, :scope > .accessibility__item");e&&(t.addEventListener("focus",(()=>{setTimeout((()=>{e.focus({preventScroll:!0})}),10)})),e.addEventListener("keydown",(e=>{"Tab"===e.key&&e.shiftKey&&(e.preventDefault(),t.focus(),setTimeout((()=>{const e=Array.from(document.querySelectorAll('a, button, input, [tabindex]:not([tabindex="-1"])')).filter((t=>!t.disabled&&null!==t.offsetParent)),s=e.indexOf(t);s>0&&e[s-1].focus()}),10))})))}))}translateHours(t){return t.replace("-",this.getTranslation("times.untilText"))}convertDays(t){const e=t.replace(":","").split(/[,\-]/).map((t=>t.trim()));return 1===e.length?this.settings.dayConversion[this.lang][e[0]+":"]||e[0]:2===e.length&&t.includes("-")?`${this.settings.dayConversion[this.lang][e[0]+":"]} ${this.getTranslation("times.untilText")} ${this.settings.dayConversion[this.lang][e[1]+":"]}`:e.map((t=>this.settings.dayConversion[this.lang][t+":"])).join(", ")}getTranslation(t,e={}){let s=this.settings.translation;if(this.lang in s){const i=t.split(".");let n=s[this.lang];for(let t of i)if(n=n[t],!n)break;for(let t in e)n=n.replace(`{{${t}}}`,e[t]);return n}return void 0!==s.en&&s.en.hasOwnProperty(t)?s.en[t]:t}merge(...t){let e={};const s=t=>{for(let s in t)t.hasOwnProperty(s)&&("[object Object]"===Object.prototype.toString.call(t[s])?e[s]=this.merge(e[s],t[s]):e[s]=t[s])};for(let e=0;e<t.length;e++)s(t[e]);return e}}

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.