hugo_themes_report/templates/js/selectionMenuCollapse.js

121 lines
3.9 KiB
JavaScript
Raw Normal View History

2021-08-14 17:42:01 -07:00
function showSelectionOptionsButtons() {
[
"button-for-showing-sort-option",
"button-for-showing-columns",
"button-for-filter-by-tags",
"button-for-filter-by-features",
2021-08-18 15:09:33 -07:00
"button-for-filter-by-minver",
2021-08-17 17:23:51 -07:00
"button-for-filter-by-license",
2021-08-14 17:42:01 -07:00
"button-for-filter-by-tags-and-features",
].forEach((x) => (document.getElementById(x).style.display = "inline-block"));
}
2021-08-14 07:21:26 -07:00
let closeableMenus = [
"sortByRow",
2021-08-17 17:23:51 -07:00
"licenseSelectionHeadingRow",
"licenseSelectionRow",
2021-08-14 17:42:01 -07:00
"columnSelectionHeadingRow",
"columnSelectionRow",
2021-08-14 07:21:26 -07:00
"tagSelectionHeadingRow",
"tagSelectionRow",
"featureSelectionHeadingRow",
"featureSelectionRow",
2021-08-18 15:09:33 -07:00
"minVerSelectionHeadingRow",
"minVerSelectionRow",
2021-08-14 07:21:26 -07:00
];
2021-08-11 11:58:10 -07:00
2021-08-14 07:21:26 -07:00
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();
2021-08-16 10:35:36 -07:00
showSelectionOptionsButtons();
2021-08-11 11:58:10 -07:00
} else {
2021-08-14 07:21:26 -07:00
document.getElementById("selection-options-menu").style.display = "none";
this.style.display = "none";
document.getElementById("plus-button").style.display = "inline-block";
2021-08-11 11:58:10 -07:00
}
2021-08-14 07:21:26 -07:00
window.scrollTo(0, 0);
};
document.getElementById("button-for-showing-sort-option").onclick =
function () {
closeMenus();
2021-08-14 17:42:01 -07:00
showSelectionOptionsButtons();
this.style.display = "none";
2021-08-14 07:21:26 -07:00
document.getElementById("sortByRow").style.display = "flex";
};
2021-08-14 17:42:01 -07:00
document.getElementById("button-for-showing-columns").onclick = function () {
closeMenus();
showSelectionOptionsButtons();
this.style.display = "none";
document.getElementById("columnSelectionHeadingRow").style.display = "flex";
document.getElementById("columnSelectionRow").style.display = "flex";
};
2021-08-14 07:21:26 -07:00
document.getElementById("button-for-filter-by-tags").onclick = function () {
closeMenus();
2021-08-14 17:42:01 -07:00
showSelectionOptionsButtons();
this.style.display = "none";
2021-08-14 07:21:26 -07:00
document.getElementById("tagSelectionHeadingRow").style.display = "flex";
document.getElementById("tagSelectionRow").style.display = "flex";
};
document.getElementById("button-for-filter-by-features").onclick = function () {
closeMenus();
2021-08-14 17:42:01 -07:00
showSelectionOptionsButtons();
this.style.display = "none";
2021-08-14 07:21:26 -07:00
document.getElementById("featureSelectionHeadingRow").style.display = "flex";
document.getElementById("featureSelectionRow").style.display = "flex";
};
2021-08-18 15:09:33 -07:00
document.getElementById("button-for-filter-by-minver").onclick = function () {
closeMenus();
showSelectionOptionsButtons();
this.style.display = "none";
document.getElementById("minVerSelectionHeadingRow").style.display = "flex";
document.getElementById("minVerSelectionRow").style.display = "flex";
};
2021-08-17 17:23:51 -07:00
document.getElementById("button-for-filter-by-license").onclick = function () {
closeMenus();
showSelectionOptionsButtons();
this.style.display = "none";
document.getElementById("licenseSelectionHeadingRow").style.display = "flex";
document.getElementById("licenseSelectionRow").style.display = "flex";
};
2021-08-14 07:21:26 -07:00
document.getElementById("button-for-filter-by-tags-and-features").onclick =
function () {
closeMenus();
2021-08-14 17:42:01 -07:00
showSelectionOptionsButtons();
this.style.display = "none";
2021-08-14 07:21:26 -07:00
document.getElementById("tagSelectionHeadingRow").style.display = "flex";
document.getElementById("tagSelectionRow").style.display = "flex";
document.getElementById("featureSelectionHeadingRow").style.display =
"flex";
document.getElementById("featureSelectionRow").style.display = "flex";
};