function getPathSeparator() {
    const isWindows = navigator.platform.toLowerCase() == "win32"
    return isWindows ? "\\" : "/"
}

const separator = getPathSeparator()

function toggleLoadingBar() {
    const loader = document.querySelector("article.frame:not([hidden]) > div.loader")
    if (loader.hasAttribute("hidden")) {
        loader.removeAttribute("hidden")
    } else {
        loader.setAttribute("hidden", "")
    }
}

function showLoadingBar() {
    const loader = document.querySelector("article.frame:not([hidden]) > div.loader")
    if (loader.hasAttribute("hidden")) {
        loader.removeAttribute("hidden")
    }
}

function hideLoadingBar() {
    const loader = document.querySelector("article.frame:not([hidden]) > div.loader")
    if (!loader.hasAttribute("hidden")) {
        loader.setAttribute("hidden", "")
    }
}

window.addEventListener("wheel", (e) => {
    if (e.ctrlKey) {
        e.preventDefault()
    }
}, { passive: false })

window.onpopstate = () => {
    window.history.pushState(null, document.title, window.location.href)
}

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}