mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 07:00:47 +02:00
4ec437db9e
Migrate B2C js to typescript: contact form, form helpers, and algolia GitOrigin-RevId: b9ec423cdc551123a5b471e4a4c1a482b6a02e16
37 lines
952 B
TypeScript
37 lines
952 B
TypeScript
import { setupSearch } from './search'
|
|
|
|
document
|
|
.querySelectorAll('[data-ol-contact-form-with-search]')
|
|
.forEach(setupSearch)
|
|
|
|
document
|
|
.querySelectorAll('[data-ol-open-contact-form-modal="contact-us"]')
|
|
.forEach(el => {
|
|
el.addEventListener('click', function (e) {
|
|
e.preventDefault()
|
|
})
|
|
})
|
|
|
|
document
|
|
.querySelectorAll('[data-ol-open-contact-form-modal="general"]')
|
|
.forEach(el => {
|
|
el.addEventListener('click', function (e) {
|
|
e.preventDefault()
|
|
})
|
|
})
|
|
|
|
document.querySelectorAll('[data-ol-contact-form]').forEach(el => {
|
|
el.addEventListener('submit', function () {
|
|
const emailInput = document.querySelector<HTMLInputElement>(
|
|
'[data-ol-contact-form-email-input]'
|
|
)
|
|
const thankYouEmailEl = document.querySelector<HTMLElement>(
|
|
'[data-ol-contact-form-thank-you-email]'
|
|
)
|
|
|
|
if (emailInput && thankYouEmailEl) {
|
|
thankYouEmailEl.textContent = emailInput.value
|
|
}
|
|
})
|
|
})
|