ily.li/assets/ts/url-shrinker.ts

14 lines
481 B
TypeScript

document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('url-shrink-form');
if (!form) return;
const autogenUrlCheckbox = document.querySelector<HTMLInputElement>('#field-autogen_url');
const slugField = document.querySelector<HTMLInputElement>('#field-slug');
if (slugField) {
autogenUrlCheckbox?.addEventListener('change', () => {
slugField.disabled = autogenUrlCheckbox.checked;
});
}
});