From 33bf5c202c94e0542b66f27870ed4f95686289c1 Mon Sep 17 00:00:00 2001 From: perro Date: Mon, 20 Mar 2023 11:44:30 -0700 Subject: [PATCH] =?UTF-8?q?Arreglo=20de=20tecla=20r=C3=A1pida=20'espacio'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/main/static/js/player.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/main/static/js/player.js b/source/main/static/js/player.js index 36dd692..55dcc5a 100644 --- a/source/main/static/js/player.js +++ b/source/main/static/js/player.js @@ -1,9 +1,16 @@ // Deshabilita scroll con la tecla de espacio // Esto es para que en 'player' quede habilitado para reproducción window.addEventListener('keydown', (e) => { - if (e.keyCode === 32 && e.target === document.body) { - e.preventDefault(); - } + if (e.keyCode === 32) { + if (e.target === document.body) { + e.preventDefault(); + } + // Por alguna razón la tecla rápida 'espacio' no funciona en toggle como + // la tecla rápida 'k', así que se fuerza para el mismo comportamiento + window.dispatchEvent(new KeyboardEvent('keydown', { + 'key': 'k' + })); + } }); // Añade un aviso