mirror of
https://github.com/asimonson1125/asimonson1125.github.io.git
synced 2026-02-25 05:09:49 -06:00
Rebuild homepage with Flask
This commit is contained in:
27
src/static/js/checkbox.js
Normal file
27
src/static/js/checkbox.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function toggle(dir) {
|
||||
let toggles = document.querySelectorAll(
|
||||
".checkbox-wrapper input[type=checkbox]"
|
||||
);
|
||||
let allow = [];
|
||||
toggles.forEach(function (x) {
|
||||
if (x.checked) {
|
||||
allow.push(x.id);
|
||||
}
|
||||
});
|
||||
let list = document.querySelectorAll(".checkbox-client > div");
|
||||
if (allow.length === 0) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
list[i].classList.remove("hidden" + dir);
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
list[i].classList.remove("hidden" + dir);
|
||||
for (let x = 0; x < allow.length; x++) {
|
||||
if (!list[i].classList.contains(allow[x])) {
|
||||
list[i].classList.add("hidden" + dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user