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

14 lines
481 B
TypeScript
Raw Normal View History

2020-11-22 14:57:25 +01:00
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;
});
}
});