2024-11-04 07:14:52 -05:00
|
|
|
import { Tooltip } from 'bootstrap-5'
|
|
|
|
|
|
|
|
const footerLanguageElement = document.querySelector(
|
|
|
|
'[data-ol-lang-selector-tooltip]'
|
|
|
|
) as Element
|
|
|
|
|
|
|
|
const allTooltips = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
|
|
|
|
2024-11-07 10:28:17 -05:00
|
|
|
const possibleTooltips = document.querySelectorAll(
|
|
|
|
'[data-bs-toggle="tooltip-if-needed"]'
|
|
|
|
)
|
|
|
|
|
2024-11-04 07:14:52 -05:00
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
const footLangTooltip = new Tooltip(footerLanguageElement)
|
|
|
|
|
|
|
|
allTooltips.forEach(element => {
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
const tooltip = new Tooltip(element)
|
|
|
|
})
|
2024-11-07 10:28:17 -05:00
|
|
|
|
|
|
|
possibleTooltips.forEach(element => {
|
|
|
|
// put data-bs-toggle="tooltip-if-needed" on .badge-content
|
|
|
|
// then tooltip is only shown if .badge is clipped due to max-width
|
|
|
|
if (
|
|
|
|
element.parentElement &&
|
|
|
|
element.scrollWidth > element.parentElement?.scrollWidth
|
|
|
|
) {
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
const tooltip = new Tooltip(element)
|
|
|
|
}
|
|
|
|
})
|