This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/setup/script.js

23 lines
806 B
JavaScript

document.addEventListener('DOMContentLoaded', () => {
const checkbox = document.getElementById('nice_urls');
const out_span = document.getElementById('nicetest');
if(checkbox !== null && out_span !== null) {
checkbox.disabled = true;
out_span.innerHTML = '(testing...)';
fetch(document.body.getAttribute('data-base-href') + "/nicetest").then(response => {
if(response.ok) {
checkbox.disabled = false;
out_span.innerHTML = '(test passed)';
}
else {
checkbox.disabled = true;
out_span.innerHTML = '(test failed)';
}
}).catch(() => {
checkbox.disabled = true;
out_span.innerHTML = '(request failed)';
});
}
});