From 18eb65218bdac7c92d77e9ca5e68c567157fd408 Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Sat, 30 Jul 2022 18:05:11 +0100 Subject: [PATCH] Fix sort order menu display issues. --- index.go.html | 2 +- index.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/index.go.html b/index.go.html index 21e34a5..416756c 100644 --- a/index.go.html +++ b/index.go.html @@ -37,7 +37,7 @@ {{ end }} {{ end }} - +
{{ if .Light }} diff --git a/index.js b/index.js index c4257cf..d1faca4 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,7 @@ Under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 Internati */ const EntryData = [] var SortOrderStateI = true +var SortOrderBStateI = true function SetupJS() { SetupJSTheme() SetupJSHSO() @@ -107,22 +108,35 @@ function ToggleTheme() { } } function SetupJSHSO() { + let pb = document.getElementById("sort-menu-button") let pane = document.getElementById("so-pane") if (document.addEventListener) { document.addEventListener("click", HandleGlobalClick) + pb.addEventListener("mouseover", HandleSortOrderBEnter) + pb.addEventListener("mouseout", HandleSortOrderBLeave) pane.addEventListener("mouseover", HandleSortOrderEnter) pane.addEventListener("mouseout", HandleSortOrderLeave) } else { document.parentElement.setAttribute("onclick", "HandleGlobalClick();") + pb.setAttribute("onmouseover", "HandleSortOrderBEnter();") + pb.setAttribute("onmouseout", "HandleSortOrderBLeave();") pane.setAttribute("onmouseover", "HandleSortOrderEnter();") pane.setAttribute("onmouseout", "HandleSortOrderLeave();") document.parentElement.onclick = HandleGlobalClick + pb.onmouseover = HandleSortOrderBEnter + pb.onmouseout = HandleSortOrderBLeave pane.onmouseover = HandleSortOrderEnter pane.onmouseout = HandleSortOrderLeave } } function HandleGlobalClick() { - if (SortOrderStateI) {document.getElementById("sort-menu").checked = false;} + if (SortOrderStateI && SortOrderBStateI) {document.getElementById("sort-menu").checked = false;} +} +function HandleSortOrderBEnter() { + SortOrderBStateI = false +} +function HandleSortOrderBLeave(){ + SortOrderBStateI = true } function HandleSortOrderEnter() { SortOrderStateI = false