[view] use vanilla JS to change info box edit/view modes

This commit is contained in:
Shish
2023-12-30 03:45:21 +00:00
parent cc69ecb74a
commit 8f143a6bac
3 changed files with 23 additions and 11 deletions

View File

@ -6,7 +6,20 @@ function joinUrlSegments(base, query) {
return base + separatorChar + query;
}
function clearViewMode() {
document.querySelectorAll('.image_info').forEach((element) => {
element.classList.remove('infomode-view');
});
}
document.addEventListener('DOMContentLoaded', () => {
// find elements with class image_info and set them to view mode
// (by default, with no js, they are in edit mode - so that no-js
// users can still edit them)
document.querySelectorAll('.image_info').forEach((element) => {
element.classList.add('infomode-view');
});
if(document.location.hash.length > 3) {
var query = document.location.hash.substring(1);