Files
docuseal/app/javascript/elements/open_modal_mobile.js
T

18 lines
544 B
JavaScript
Raw Normal View History

2026-07-24 21:58:55 +03:00
export default class extends HTMLElement {
connectedCallback () {
2026-07-31 10:57:37 +03:00
if (this.dataset.disabled === 'true') return
2026-07-24 21:58:55 +03:00
if (!this.isMobile()) return
2026-07-30 17:40:54 +03:00
if (window.innerWidth >= 768) return
2026-07-24 21:58:55 +03:00
2026-07-30 17:40:54 +03:00
this.querySelectorAll('a[data-turbo-frame]').forEach((link) => {
2026-07-24 21:58:55 +03:00
link.dataset.turboFrame = '_top'
})
}
isMobile () {
const isTouchWebkit = 'ontouchstart' in window && navigator.maxTouchPoints > 0 && /AppleWebKit|android/i.test(navigator.userAgent)
return isTouchWebkit || /iPhone|iPad|iPod/i.test(navigator.userAgent)
}
}