add admin ability to double card values

This commit is contained in:
ducklet 2021-03-02 20:08:28 +01:00
parent a4b0297c3f
commit 81ee2200fb
5 changed files with 22 additions and 1 deletions

View file

@ -1,5 +1,7 @@
"use strict"
import { qs } from "./shared.js"
function setup() {
let highlighted
document.addEventListener("click", (event) => {
@ -18,6 +20,18 @@ function setup() {
highlighted = card
card.classList.add("highlight")
})
window.addEventListener("message", ({ data }) => {
if (data !== "double") {
return
}
for (let card of qs(".card")) {
if (card.classList.contains("cat")) {
continue
}
card.textContent = parseInt(card.textContent) * 2
}
})
}
setup()