Skip to content

Commit 7a858b7

Browse files
committed
eslint
1 parent 8569bd0 commit 7a858b7

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

src/front-end/js/book.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -644,36 +644,38 @@ aria-label="Show hidden lines"></button>';
644644
}
645645
}
646646
function showHelp() {
647-
document.getElementById("help-overlay").style.display = "block";
648-
let help = `<h2 id="help-title">Keyboard shortcuts</h2>`;
649-
help += "<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>";
650-
help += "<p>Press <kbd>s</kbd> to search in the book</p>";
651-
help += "<p>Press <kbd>?</kbd> to show this help</p>";
652-
help += "<p>Press <kbd>Esc</kbd> to hide this help</p>";
653-
654-
document.getElementById("help-overlay").innerHTML = help;
655-
656-
document.addEventListener('keydown', function (e) {
657-
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; }
647+
document.getElementById('help-overlay').style.display = 'block';
648+
let help = '<h2 id="help-title">Keyboard shortcuts</h2>';
649+
help += '<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>';
650+
help += '<p>Press <kbd>s</kbd> to search in the book</p>';
651+
help += '<p>Press <kbd>?</kbd> to show this help</p>';
652+
help += '<p>Press <kbd>Esc</kbd> to hide this help</p>';
653+
654+
document.getElementById('help-overlay').innerHTML = help;
655+
656+
document.addEventListener('keydown', function(e) {
657+
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) {
658+
return;
659+
}
658660

659661
switch (e.key) {
660-
case 'Escape':
661-
e.preventDefault();
662-
hideHelp();
663-
break;
662+
case 'Escape':
663+
e.preventDefault();
664+
hideHelp();
665+
break;
664666
}
665667
});
666668
}
667669
function hideHelp() {
668-
document.getElementById("help-overlay").style.display = "none";
670+
document.getElementById('help-overlay').style.display = 'none';
669671
}
670672

671673
// Usually needs the Shift key to be pressed
672674
switch (e.key) {
673-
case '?':
674-
e.preventDefault();
675-
showHelp();
676-
break;
675+
case '?':
676+
e.preventDefault();
677+
showHelp();
678+
break;
677679
}
678680

679681
// Rest of the keys are only active when the Shift key is not pressed

0 commit comments

Comments
 (0)