27 lines
875 B
JavaScript
27 lines
875 B
JavaScript
(function () {
|
|
const textarea = document.querySelector('[data-count-target]');
|
|
if (textarea) {
|
|
const target = document.getElementById(textarea.getAttribute('data-count-target'));
|
|
const update = () => { if (target) target.textContent = String(textarea.value.length); };
|
|
textarea.addEventListener('input', update);
|
|
update();
|
|
}
|
|
|
|
document.querySelectorAll('[data-auto-dismiss]').forEach((notice) => {
|
|
window.setTimeout(() => {
|
|
notice.classList.add('is-hiding');
|
|
window.setTimeout(() => notice.remove(), 220);
|
|
}, 5200);
|
|
});
|
|
|
|
document.querySelectorAll('[data-directory-form]').forEach((form) => {
|
|
form.addEventListener('submit', () => {
|
|
const button = form.querySelector('button[type="submit"]');
|
|
if (button) {
|
|
button.disabled = true;
|
|
button.textContent = 'Submitting...';
|
|
}
|
|
});
|
|
});
|
|
})();
|