mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
pikvm/pikvm#1312: Option to close GPIO menu after click
This commit is contained in:
parent
ee982946be
commit
d2bc31d1cd
@ -383,15 +383,19 @@ class UserGpio:
|
|||||||
def __make_item_output(self, parts: list[str]) -> dict:
|
def __make_item_output(self, parts: list[str]) -> dict:
|
||||||
assert len(parts) >= 1
|
assert len(parts) >= 1
|
||||||
confirm = False
|
confirm = False
|
||||||
|
hide = False
|
||||||
text = "Click"
|
text = "Click"
|
||||||
if len(parts) == 2:
|
if len(parts) == 2:
|
||||||
text = parts[1]
|
text = parts[1]
|
||||||
elif len(parts) == 3:
|
elif len(parts) == 3:
|
||||||
confirm = (parts[1] == "confirm")
|
opts = parts[1].split(",")
|
||||||
|
confirm = ("confirm" in opts)
|
||||||
|
hide = ("hide" in opts)
|
||||||
text = parts[2]
|
text = parts[2]
|
||||||
return {
|
return {
|
||||||
"type": UserGpioModes.OUTPUT,
|
"type": UserGpioModes.OUTPUT,
|
||||||
"channel": parts[0],
|
"channel": parts[0],
|
||||||
"confirm": confirm,
|
"confirm": confirm,
|
||||||
|
"hide": hide,
|
||||||
"text": text,
|
"text": text,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,7 +150,10 @@ export function Gpio(__recorder) {
|
|||||||
if (item.scheme.pulse.delay) {
|
if (item.scheme.pulse.delay) {
|
||||||
controls.push(`
|
controls.push(`
|
||||||
<td><button disabled id="gpio-button-${item.channel}" class="gpio-button"
|
<td><button disabled id="gpio-button-${item.channel}" class="gpio-button"
|
||||||
data-channel="${item.channel}" data-confirm="${confirm}">${item.text}</button></td>
|
${item.hide ? "data-force-hide-menu" : ""}
|
||||||
|
data-channel="${item.channel}" data-confirm="${confirm}">
|
||||||
|
${(item.hide ? "• " : "") + item.text}
|
||||||
|
</button></td>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
return `<table><tr>${controls.join("<td> </td>")}</tr></table>`;
|
return `<table><tr>${controls.join("<td> </td>")}</tr></table>`;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user