add logo
This commit is contained in:
parent
29ca51fee3
commit
58a4271c88
42
img/7-vs-wild-logo.svg
Normal file
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 |
17
script.js
17
script.js
@ -50,12 +50,14 @@ let fields = [
|
||||
|
||||
];
|
||||
|
||||
const FREE_FIELD_TEXT = "Freies Parken"
|
||||
|
||||
let shuffled = fields
|
||||
.map(value => ({ value, sort: Math.random() }))
|
||||
.sort((a, b) => a.sort - b.sort)
|
||||
.map(({ value }) => value)
|
||||
|
||||
shuffled.splice(12, 0, "Freies Parken");
|
||||
shuffled.splice(12, 0, FREE_FIELD_TEXT);
|
||||
|
||||
function generateTable() {
|
||||
let table = document.querySelector("table");
|
||||
@ -68,12 +70,19 @@ function generateTable() {
|
||||
let cell = row.insertCell();
|
||||
|
||||
let text = document.createTextNode(field);
|
||||
if (field == FREE_FIELD_TEXT) {
|
||||
cell.id = 'center-field';
|
||||
}
|
||||
cell.appendChild(text);
|
||||
});
|
||||
|
||||
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;
|
||||
if (target_type === "img") {
|
||||
cell = ev.target.parentNode;
|
||||
}
|
||||
if (cell.style.borderColor == "green") {
|
||||
cell.style.borderColor = "black";
|
||||
cell.style.backgroundColor = "white";
|
||||
@ -86,4 +95,6 @@ function 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>'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user