Commit f3cbc661 authored by Jakob Moser's avatar Jakob Moser
Browse files

Allow any element to be an action element

parent ddb50505
Loading
Loading
Loading
Loading
+3 −3
Changes for static/js/yalikejazz.mjs: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ function startExercise(exerciseIndex) {

function initActionLinks() {
    // TODO Replace with something good-looking
    document.querySelectorAll("button[data-action]").forEach(button => {
    document.querySelectorAll("[data-action]").forEach(el => {
        const handler = {
            "hand-in": function () {
                alert("Please send this token to GT: " + getHandInToken())
@@ -101,9 +101,9 @@ function initActionLinks() {
                document.querySelector(".dialog [data-action='continue']").style.display = "block"
                document.body.classList.add("overlay-shown")
            }
        }[button.dataset.action]
        }[el.dataset.action]

        button.onclick = handler
        el.onclick = handler
    })
}