Fix sort order menu display issues.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Captain ALM 2022-07-30 18:05:11 +01:00
parent 5bbd9db71d
commit 18eb65218b
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1
2 changed files with 16 additions and 2 deletions

View File

@ -37,7 +37,7 @@
{{ end }}
{{ end }}
<input class="sort-menu" type="checkbox" id="sort-menu"/>
<label class="sort-button no-dec" for="sort-menu" title="Order and Sort Options"><div><img src="{{ .Data.SortImageLocation }}" width="64px" alt='&#8595;'></div></label>
<label class="sort-button no-dec" for="sort-menu" id="sort-menu-button" title="Order and Sort Options"><div><img src="{{ .Data.SortImageLocation }}" width="64px" alt='&#8595;'></div></label>
<div class="so-pane" id="so-pane">
<form action="?" method="get" id="so-form">
{{ if .Light }}

View File

@ -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