This commit is contained in:
Felix Pankratz 2022-11-30 18:52:25 +01:00
parent 29ca51fee3
commit 58a4271c88
3 changed files with 61 additions and 3 deletions

42
img/7-vs-wild-logo.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 286 KiB

View File

@ -50,12 +50,14 @@ let fields = [
]; ];
const FREE_FIELD_TEXT = "Freies Parken"
let shuffled = fields let shuffled = fields
.map(value => ({ value, sort: Math.random() })) .map(value => ({ value, sort: Math.random() }))
.sort((a, b) => a.sort - b.sort) .sort((a, b) => a.sort - b.sort)
.map(({ value }) => value) .map(({ value }) => value)
shuffled.splice(12, 0, "Freies Parken"); shuffled.splice(12, 0, FREE_FIELD_TEXT);
function generateTable() { function generateTable() {
let table = document.querySelector("table"); let table = document.querySelector("table");
@ -68,12 +70,19 @@ function generateTable() {
let cell = row.insertCell(); let cell = row.insertCell();
let text = document.createTextNode(field); let text = document.createTextNode(field);
if (field == FREE_FIELD_TEXT) {
cell.id = 'center-field';
}
cell.appendChild(text); cell.appendChild(text);
}); });
table.addEventListener('click', (ev) => { table.addEventListener('click', (ev) => {
if (ev.target.tagName.toLowerCase() == "td" ) { let cell;
let target_type = ev.target.tagName.toLowerCase();
if (target_type === "td" || target_type === "img") {
let cell = ev.target; let cell = ev.target;
if (target_type === "img") {
cell = ev.target.parentNode;
}
if (cell.style.borderColor == "green") { if (cell.style.borderColor == "green") {
cell.style.borderColor = "black"; cell.style.borderColor = "black";
cell.style.backgroundColor = "white"; cell.style.backgroundColor = "white";
@ -86,4 +95,6 @@ function generateTable() {
} }
generateTable(); generateTable();
const center_field = document.querySelector('#center-field');
center_field.innerHTML = '<img src="img/7-vs-wild-logo.svg" alt="7 vs. Wild Logo"></img>'

View File

@ -13,6 +13,11 @@ td {
font-size: 200%; font-size: 200%;
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
} }
img {
width: 100%;
}
h1 { h1 {
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
text-align: center; text-align: center;