feat: add help button (?) in reader toolbar with shortcuts modal
- circled ? button in toolbar-right opens modal - modal shows keyboard nav (arrows), bookmark (Ctrl+B), zoom (+/-), theme toggle, fullscreen (F), search (Ctrl+F) - Esc or click outside closes modal - CSS: btn-help circle style + help-overlay/help-modal layout - responsive: max-width 440px, max-height 80vh
This commit is contained in:
1 parent
069d059ef1
commit
2a0a79b19e
3 files changed
+183
No files matched your search
@@ -465,6 +465,134 @@ body {
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
/* Help button */
|
||||
.btn-help {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 700;
|
||||
color: #888;
|
||||
background: #f5f5f7;
|
||||
border: 1px solid #ddd;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-help:hover {
|
||||
background: #007aff;
|
||||
color: #fff;
|
||||
border-color: #007aff;
|
||||
}
|
||||
|
||||
/* Help overlay modal */
|
||||
.help-overlay {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.35);
|
||||
z-index: 200;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.help-overlay.open {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.help-modal {
|
||||
background: #fff;
|
||||
border-radius: 14px;
|
||||
width: min(440px, 90vw);
|
||||
max-height: min(520px, 80vh);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0 12px 40px rgba(0,0,0,0.2);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.help-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 1rem 1.2rem;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.help-header h3 {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.help-body {
|
||||
padding: 0.8rem 1.2rem 1.2rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.help-section {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.help-section h4 {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
color: #007aff;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
margin: 0 0 0.5rem;
|
||||
}
|
||||
|
||||
.help-section p {
|
||||
margin: 0;
|
||||
font-size: 0.85rem;
|
||||
color: #555;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.help-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
padding: 0.3rem 0;
|
||||
font-size: 0.85rem;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.help-row span:last-child {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.help-row kbd {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 24px;
|
||||
padding: 1px 6px;
|
||||
font-size: 0.7rem;
|
||||
font-family: inherit;
|
||||
background: #f0f0f0;
|
||||
border: 1px solid #d0d0d5;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 0 #ccc;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.help-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
font-size: 0.75rem;
|
||||
background: #f0f0f0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* Reader Layout */
|
||||
.reader-container {
|
||||
display: flex;
|
||||
|
||||
@@ -307,6 +307,31 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Help modal toggle
|
||||
const helpToggle = document.getElementById("helpToggle");
|
||||
const helpOverlay = document.getElementById("helpOverlay");
|
||||
const helpClose = document.getElementById("helpClose");
|
||||
function toggleHelp(show) {
|
||||
if (!helpOverlay) return;
|
||||
if (show === undefined) show = !helpOverlay.classList.contains("open");
|
||||
helpOverlay.classList.toggle("open", show);
|
||||
}
|
||||
if (helpToggle) {
|
||||
helpToggle.addEventListener("click", () => toggleHelp(true));
|
||||
}
|
||||
if (helpClose) {
|
||||
helpClose.addEventListener("click", () => toggleHelp(false));
|
||||
}
|
||||
if (helpOverlay) {
|
||||
helpOverlay.addEventListener("click", (e) => {
|
||||
if (e.target === helpOverlay) toggleHelp(false);
|
||||
});
|
||||
}
|
||||
// Keyboard: Esc to close help
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Escape") toggleHelp(false);
|
||||
});
|
||||
|
||||
// Bookmark button
|
||||
const bookmarkToggle = document.getElementById("bookmarkToggle");
|
||||
if (bookmarkToggle) {
|
||||
|
||||
@@ -28,6 +28,36 @@
|
||||
<button class="tool-btn" id="searchToggle" title="Cerca">🔍</button>
|
||||
<button class="tool-btn" id="bookmarkToggle" title="Segnalibro (Ctrl+B)">🔖</button>
|
||||
<button class="tool-btn" id="fullscreenToggle" title="Schermo intero">⛶</button>
|
||||
<button class="tool-btn btn-help" id="helpToggle" title="Aiuto e scorciatoie">?</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="help-overlay" id="helpOverlay">
|
||||
<div class="help-modal">
|
||||
<div class="help-header">
|
||||
<h3>Aiuto e scorciatoie</h3>
|
||||
<button class="tool-btn" id="helpClose">✕</button>
|
||||
</div>
|
||||
<div class="help-body">
|
||||
<div class="help-section">
|
||||
<h4>Navigazione</h4>
|
||||
<div class="help-row"><kbd>←</kbd><kbd>→</kbd><span>Pagina precedente/successiva</span></div>
|
||||
<div class="help-row"><kbd>Ctrl</kbd>+<kbd>B</kbd><span>Aggiungi/rimuovi segnalibro</span></div>
|
||||
<div class="help-row"><kbd>Ctrl</kbd>+<kbd>F</kbd><span>Cerca nel libro</span></div>
|
||||
<div class="help-row"><kbd>F</kbd><span>Schermo intero</span></div>
|
||||
</div>
|
||||
<div class="help-section">
|
||||
<h4>Lettura</h4>
|
||||
<div class="help-row"><kbd>+</kbd><kbd>-</kbd><span>Zoom avanti/indietro (testo)</span></div>
|
||||
<div class="help-row"><span class="help-icon">☰</span><span>Mostra/nascondi indice</span></div>
|
||||
<div class="help-row"><span class="help-icon">🔖</span><span>Aggiunge segnalibro alla pagina corrente</span></div>
|
||||
<div class="help-row"><span class="help-icon">🌙 ☀️ 🟤</span><span>Cicla tema: chiaro, scuro, seppia</span></div>
|
||||
</div>
|
||||
<div class="help-section">
|
||||
<h4>Slider larghezza</h4>
|
||||
<p>Regola la larghezza dell'area di lettura dal 40% al 100% dello schermo. Utile per files con righe molto lunghe.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user