This commit is contained in:
1 parent
31a7f11827
commit
f25d218756
8 files changed
+77
-27
No files matched your search
+33
-2
@@ -250,7 +250,7 @@ function cardHtml(g, mode = "library") {
|
||||
const matched = mode === "reco" && g.matched && g.matched.length
|
||||
? `<p class="matched">${g.matched.map(esc).join(" · ")}</p>` : "";
|
||||
return `
|
||||
<article class="card" data-appid="${g.appid}" tabindex="0">
|
||||
<article class="card" data-appid="${g.appid}" tabindex="0" role="button" aria-label="Открыть ${esc(g.name)}">
|
||||
<div class="cover">
|
||||
<img data-appid="${g.appid}" loading="lazy" src="${coverUrl(g.appid)}" alt="">
|
||||
<div class="fallback">${esc(initials(g.name))}</div>
|
||||
@@ -1120,9 +1120,40 @@ $("#refreshFull").addEventListener("click", () => {
|
||||
});
|
||||
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.key === "/" && !/input|textarea|select/i.test(document.activeElement.tagName)) {
|
||||
const typing = /input|textarea|select/i.test(document.activeElement.tagName)
|
||||
|| document.activeElement.isContentEditable;
|
||||
if (e.key === "Escape") {
|
||||
if ($("#modal").open) return;
|
||||
const openDetails = document.querySelector("details.multi-select[open]");
|
||||
if (openDetails) {
|
||||
openDetails.open = false;
|
||||
return;
|
||||
}
|
||||
if (state.selectionMode) {
|
||||
$("#selectMode").click();
|
||||
return;
|
||||
}
|
||||
if (filtersState.open && !filtersState.pinned) closeFilters();
|
||||
return;
|
||||
}
|
||||
if (e.key === "/" && !typing) {
|
||||
e.preventDefault();
|
||||
$("#search").focus();
|
||||
return;
|
||||
}
|
||||
if (typing || $("#modal").open || e.ctrlKey || e.metaKey || e.altKey) return;
|
||||
if (e.key === "g") {
|
||||
e.preventDefault();
|
||||
$("#layoutToggle").click();
|
||||
} else if (e.key === "f") {
|
||||
e.preventDefault();
|
||||
toggleFilters();
|
||||
} else if (e.key === "t") {
|
||||
e.preventDefault();
|
||||
themeToggle.click();
|
||||
} else if (e.key === "?") {
|
||||
e.preventDefault();
|
||||
toast("Клавиши: / поиск · f фильтры · g вид · t тема · Esc закрыть");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user