1
0
Fork 0

Merge pull request #2457 from viviicat/use-html-templates

make use of templates instead of hidden divs which is more elegant
This commit is contained in:
Mouse Reeve 2022-12-04 11:24:04 -08:00 committed by GitHub
commit 300573e66e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 51 deletions

View file

@ -628,9 +628,9 @@ let BookWyrm = new (class {
}
function toggleStatus(status) {
for (const child of statusNode.children) {
BookWyrm.toggleContainer(child, !child.classList.contains(status));
}
const template = document.querySelector(`#barcode-${status}`);
statusNode.replaceChildren(template ? template.content.cloneNode(true) : null);
}
function initBarcodes(cameraId = null) {