~hristoast/mousikofidi

77a0d59287147a6beda919819b55f87c29608dc3 — Hristos N. Triantafillou a month ago 58e633c
Special handling for the queue page

Make those vanishing arrows work here, too.
2 files changed, 26 insertions(+), 16 deletions(-)

M mousikofidi/static/js/player.js
M mousikofidi/static/js/queue.js
M mousikofidi/static/js/player.js => mousikofidi/static/js/player.js +20 -15
@@ 964,6 964,22 @@ function volumeCtl(mediaType, action, val, interv) {
    saveVolume(vol);
}

function FidiScrollListener() {
    window.onscroll = function() {
        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
            downArrow.style.opacity = 0;
        } else if ((window.innerHeight + window.scrollY) <= document.body.offsetHeight) {
            downArrow.style.opacity = 1;
        }

        if (window.scrollY < 200) {
            upArrow.style.opacity = 0;
        } else if (window.scrollY > 200) {
            upArrow.style.opacity = 1;
        }
    };
}

function FidiKeyBindsSetup() {
    document.addEventListener("keydown", function(e) {
        if (document.activeElement.nodeName == 'INPUT') {


@@ 1277,8 1293,9 @@ function FidiPlayerSetUp() {
    if (coverArt)
        coverArt.addEventListener("click", coverArtClickListener);

    if (upArrow) {
        if (!(document.body.clientHeight > document.documentElement.clientHeight)) {
    if ((upArrow) || (pageTitle.textContent.startsWith("Your Queue"))) {
        if (!(document.body.clientHeight > document.documentElement.clientHeight)
            && (!pageTitle.textContent.startsWith("Your Queue"))) {
            downArrow.classList.toggle("hidden");
            return;
        }


@@ 1290,19 1307,7 @@ function FidiPlayerSetUp() {
            window.scrollTo({top: 0, behavior: 'smooth'});
        });

        window.onscroll = function() {
            if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
                downArrow.style.opacity = 0;
            } else if ((window.innerHeight + window.scrollY) <= document.body.offsetHeight) {
                downArrow.style.opacity = 1;
            }

            if (window.scrollY < 200) {
                upArrow.style.opacity = 0;
            } else if (window.scrollY > 200) {
                upArrow.style.opacity = 1;
            }
        };
        FidiScrollListener();
    }

    if (document.getElementById("keyboard-controls-enabled"))

M mousikofidi/static/js/queue.js => mousikofidi/static/js/queue.js +6 -1
@@ 285,6 285,8 @@ function showQueue(queueData) {
    showThis(h1YourQueue);
    showThis(downArrow);
    showThis(upArrow);
    // "Hide" until needed
    upArrow.style.opacity = 0;

    // Show or hide track-type-specific stuff as needed
    if (getQueueLen(queueData, "audio") > 0) {


@@ 310,7 312,6 @@ function showQueue(queueData) {
    }

    showThis(saveQueueDiv);
    showThis(upArrow);
    showThis(trackCountDiv);
    showThis(document.getElementById("replaceLabel"));
    // Special case


@@ 1444,6 1445,10 @@ function FidiQueueSetup() {
                    videoQueueLen
                );
            }
        } else if (queueTable) {
            hideThis(downArrow);
            hideThis(upArrow);
            upArrow.style.opacity = 1;
        }
    }