show keyboard shortcut as tooltip

This commit is contained in:
2020-10-11 21:34:16 +02:00
parent 4c026bd816
commit f198715e45
4 changed files with 17 additions and 156 deletions

View File

@@ -7,6 +7,7 @@ let regions = Array.from(Array(9), x => [])
let suggestionTimer= null
let highlightedValue = ""
let history = []
let accessKeyModifiers = "AccessKey+"
window.onload = function() {
let rowId = 0
@@ -38,6 +39,13 @@ window.onload = function() {
boxes.forEach(showCandidatesOn)
enableButtons()
highlightAndTab()
if (/Win/.test(navigator.platform) || /Linux/.test(navigator.platform)) accessKeyModifiers = "Alt+Maj+"
else if (/Mac/.test(navigator.platform)) accessKeyModifiers = "⌃⌥ "
for(node of document.querySelectorAll("*[accesskey]")) {
node.title += " [" + (node.accessKeyLabel || accessKeyModifiers + "+" + node.accessKey) + "]"
}
suggestionTimer = setTimeout(showSuggestion, 30000)
}