mirror of
https://github.com/TrentSPalmer/hugo_themes_report.git
synced 2025-11-21 02:08:25 -08:00
redesign menus
This commit is contained in:
@@ -1,11 +1,71 @@
|
||||
var menuButton = document.getElementById("selection-button");
|
||||
let closeableMenus = [
|
||||
"sortByRow",
|
||||
"tagSelectionHeadingRow",
|
||||
"tagSelectionRow",
|
||||
"featureSelectionHeadingRow",
|
||||
"featureSelectionRow",
|
||||
];
|
||||
|
||||
menuButton.addEventListener("click", function () {
|
||||
menuButton.classList.toggle("active");
|
||||
var selectionMenu = document.getElementById("selection-menu");
|
||||
if (selectionMenu.style.display === "block") {
|
||||
selectionMenu.style.display = "none";
|
||||
let areAnyCloseAbleMenusOpen = () =>
|
||||
closeableMenus.some(
|
||||
(x) => document.getElementById(x).style.display !== "none"
|
||||
);
|
||||
|
||||
function closeMenus() {
|
||||
closeableMenus.forEach(
|
||||
(x) => (document.getElementById(x).style.display = "none")
|
||||
);
|
||||
}
|
||||
|
||||
function closeOptionMenu() {
|
||||
document.getElementById("selection-options-menu").style.display = "none";
|
||||
}
|
||||
|
||||
document.getElementById("plus-button").onclick = function () {
|
||||
this.style.display = "none";
|
||||
document.getElementById("minus-button").style.display = "inline-block";
|
||||
document.getElementById("selection-options-menu").style.display = "flex";
|
||||
closeMenus();
|
||||
window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
document.getElementById("minus-button").onclick = function () {
|
||||
if (areAnyCloseAbleMenusOpen()) {
|
||||
closeMenus();
|
||||
} else {
|
||||
selectionMenu.style.display = "block";
|
||||
document.getElementById("selection-options-menu").style.display = "none";
|
||||
this.style.display = "none";
|
||||
document.getElementById("plus-button").style.display = "inline-block";
|
||||
}
|
||||
});
|
||||
window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
document.getElementById("button-for-showing-sort-option").onclick =
|
||||
function () {
|
||||
closeMenus();
|
||||
document.getElementById("sortByRow").style.display = "flex";
|
||||
};
|
||||
|
||||
document.getElementById("button-for-showing-columns").onclick = function () {};
|
||||
|
||||
document.getElementById("button-for-filter-by-tags").onclick = function () {
|
||||
closeMenus();
|
||||
document.getElementById("tagSelectionHeadingRow").style.display = "flex";
|
||||
document.getElementById("tagSelectionRow").style.display = "flex";
|
||||
};
|
||||
|
||||
document.getElementById("button-for-filter-by-features").onclick = function () {
|
||||
closeMenus();
|
||||
document.getElementById("featureSelectionHeadingRow").style.display = "flex";
|
||||
document.getElementById("featureSelectionRow").style.display = "flex";
|
||||
};
|
||||
|
||||
document.getElementById("button-for-filter-by-tags-and-features").onclick =
|
||||
function () {
|
||||
closeMenus();
|
||||
document.getElementById("tagSelectionHeadingRow").style.display = "flex";
|
||||
document.getElementById("tagSelectionRow").style.display = "flex";
|
||||
document.getElementById("featureSelectionHeadingRow").style.display =
|
||||
"flex";
|
||||
document.getElementById("featureSelectionRow").style.display = "flex";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user