/*
 * Generated JS for @emi's profile on Hjonker
 * Generated on 2025-11-15 11:01:44
 *
 * Thanks to @captbaritone on GitHub!
 */


$().ready(function() {    
    const webamp = new Webamp({
        initialTracks: [
            {
                metaData: {
                    artist: "Nicholas Creus",
                    title: "Watchin"
                },
                url: "https://hjonk.me/cdn/song/skul?d=1763204423",
            }
        ],
        windowLayout: {
            main: {
                position: { top: 0, left: 0 },
                shadeMode: false,
                closed: false,
            },
            equalizer: {
                position: { top: 0, left: 0 },
                shadeMode: true,
                closed: true,
            },
            playlist: {
                position: { top: 0, left: 0 },
                shadeMode: true,
                size: { extraHeight: 1, extraHeight: 10 },
                closed: true,
            },
        },
        enableHotkeys: false,
        initialSkin: {
            url: "https://hjonk.me/cdn/skin/skul?d=1763204423",
        },
    });

    function waitForSelector(selector, callback, interval = 100) {
        const checkExist = setInterval(() => {
            if ($(selector).length) {
                clearInterval(checkExist);
                callback($(selector));
            }
        }, interval);
    }

    const app = document.getElementById("app");
    webamp.renderWhenReady(app).then(() => {
        waitForSelector(".selected.draggable", (element) => {
            console.log(element);
            console.log(element[0]);
            element = element[0];

            $(".webamp-not-moving")[0].appendChild(element);

            if ($(".webamp-not-moving").length) {
const container = $(".webamp-not-moving")[0];
const webampDiv = $("<div>", { id: "webamp", role: "application", class: "should-not-remove", css: { "z-index": 0, "right": "auto", "bottom": "auto", "overflow": "visible" } }).appendTo(container);
$("<div>").appendTo(webampDiv);
const lvl2 = $("<div>").attr("style", "width:100%;height:100%;touch-action:none;").appendTo(webampDiv.children().first());
$(lvl2).append(element);
            }
        });
    });
});
