Commit 8cf2ecec authored by Jakob Moser's avatar Jakob Moser
Browse files

Add hiddenUntil property for buttons

parent 0c97a48e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -26,9 +26,10 @@
    <main>
        <h1>Was möchtest du tun?</h1>
        <a href="./test.html?id=practice" class="btn big">Linux üben</a>
        <a href="./test.html?id=pooltest" class="btn primary big">Den Pooltest ablegen</a>
        <a href="./test.html?id=pooltest" class="btn primary big" data-hidden-until="2022-10-15" display="none">Den Pooltest ablegen</a>
    </main>
    <div class="ribbon">Beta</div>
    <script type="module" src="./js/index.mjs"></script>
</body>

</html>

static/js/index.mjs

0 → 100644
+7 −0
Original line number Diff line number Diff line
const now = Date.now()

document.querySelectorAll("[data-hidden-until]").forEach(element => {
    const hiddenUntil = Date.parse(element.dataset.hiddenUntil)

    element.style.display = now < hiddenUntil ? "none" : "inherit"
})