summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webmusic.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/webmusic.js b/webmusic.js
index eeea892..cf5ac73 100644
--- a/webmusic.js
+++ b/webmusic.js
@@ -7,12 +7,14 @@ let playerState = 'idle';
let continuous = true;
let repeat = false;
let total = 0;
+let onlyDirs = true;
const handleKeyEvent = (event) => {
if (event.ctrlKey === true || event.altKey === true) return;
switch (event.key) {
case ' ':
case 'p':
+ if (onlyDirs !== false) return;
if (playerState == 'idle' && total !== 0) {
if (document.getElementById(playingItem).classList.contains('dir')) {
return nextTrack();
@@ -72,7 +74,6 @@ const handleKeyEvent = (event) => {
case '9':
audioPlayer.currentTime = audioPlayer.duration / 100 * (event.key * 10);
break;
-
}
};
@@ -116,6 +117,7 @@ const initState = () => {
fileElements.forEach((element) => {
element.id = id++;
+ onlyDirs = false;
element.addEventListener('click', (event) => {
event.preventDefault();