検索結果を上下キーで選択するUserScript
code:script.js
function updn() {
if (scrapbox.Layout == "list") {
var n = 1
document.querySelector(#app-container > div > div:nth-child(4) > div > ul:nth-child(2) > li:nth-child(${n}) > a).focus()
window.document.onkeydown = function(event) {
if (event.key === 'ArrowUp') {
n--
document.querySelector(#app-container > div > div:nth-child(4) > div > ul:nth-child(2) > li:nth-child(${n}) > a).focus({preventScroll: true})
} else if (event.key === 'ArrowDown') {
n++
document.querySelector(#app-container > div > div:nth-child(4) > div > ul:nth-child(2) > li:nth-child(${n}) > a).focus({preventScroll: true})
}
}
}
}
scrapbox.on("layout:changed", updn)