~hristoast/mousikofidi

d49e3097cbf800793c565f848f3c436b29d653e4 — Hristos N. Triantafillou a month ago 60039fd
Be more selective about preventing the default behavior
1 files changed, 9 insertions(+), 1 deletions(-)

M mousikofidi/static/js/player.js
M mousikofidi/static/js/player.js => mousikofidi/static/js/player.js +9 -1
@@ 971,7 971,6 @@ function FidiKeyBindsSetup() {
            return;

        const keyName = e.key;
        e.preventDefault();

        if (e.shiftKey) {
            var interval = 0.1;  // 10/100


@@ 979,6 978,7 @@ function FidiKeyBindsSetup() {

            // Volume up
            if (keyName === "ArrowUp") {
                e.preventDefault();
                if (playArrows.length > 0) {
                    volumeCtl("audio", "up", null, interval);
                } else if (videoArrows.length > 0) {


@@ 987,6 987,7 @@ function FidiKeyBindsSetup() {

            // Volume down
            } else if (keyName === "ArrowDown") {
                e.preventDefault();
                if (playArrows.length > 0) {
                    volumeCtl("audio", "down", null, interval);
                } else if (videoArrows.length > 0) {


@@ 996,6 997,7 @@ function FidiKeyBindsSetup() {

            // Seek ahead
            if (keyName === "ArrowRight") {
                e.preventDefault();
                if (playArrows.length > 0) {
                    audio.currentTime += seekLen;
                } else if (videoArrows.length > 0) {


@@ 1004,6 1006,7 @@ function FidiKeyBindsSetup() {

            // Seek back
            } else if (keyName === "ArrowLeft") {
                e.preventDefault();
                if (playArrows.length > 0) {
                    audio.currentTime -= seekLen;
                } else if (videoArrows.length > 0) {


@@ 1015,6 1018,7 @@ function FidiKeyBindsSetup() {

        // Volume up
        if (keyName === "ArrowUp") {
            e.preventDefault();
            if (playArrows.length > 0) {
                volumeCtl("audio", "up", 1);
            } else if (videoArrows.length > 0) {


@@ 1023,6 1027,7 @@ function FidiKeyBindsSetup() {

        // Volume down
        } else if (keyName === "ArrowDown") {
            e.preventDefault();
            if (playArrows.length > 0) {
                volumeCtl("audio", "down", 1);
            } else if (videoArrows.length > 0) {


@@ 1032,6 1037,7 @@ function FidiKeyBindsSetup() {

        // Skip track
        if (keyName === "ArrowRight") {
            e.preventDefault();
            if (playArrows.length > 0) {
                skipTrack(null, "audio", "fwd");
            } else if (videoArrows.length > 0) {


@@ 1040,6 1046,7 @@ function FidiKeyBindsSetup() {

        // Previous track
        } else if (keyName === "ArrowLeft") {
            e.preventDefault();
            if (playArrows.length > 0) {
                skipTrack(null, "audio", "prev");
            } else if (videoArrows.length > 0) {


@@ 1049,6 1056,7 @@ function FidiKeyBindsSetup() {

        // Play/pause
        if (keyName === " ") {
            e.preventDefault();
            if (playArrows.length > 0) {
                var currentAction = audio.getAttribute("data-action");
                if (currentAction === "Paused:") {