This repository was archived by the owner on Feb 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
65 lines (56 loc) · 2.1 KB
/
script.js
File metadata and controls
65 lines (56 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) 2025 hazzuk
// SPDX-License-Identifier: AGPL-3.0-only
async function loadBoardData() {
try {
const response = await fetch('board-data.json');
return await response.json();
} catch (error) {
console.error('Error loading board data:', error);
return null;
}
}
function createBoard(boardData) {
const board = document.getElementById('board');
boardData.columns.forEach(column => {
const columnElement = document.createElement('div');
columnElement.className = 'column';
columnElement.innerHTML = `<h2>${column.title}</h2>`;
column.cards.forEach(card => {
const cardElement = document.createElement('div');
cardElement.className = 'card';
cardElement.innerHTML = `
${card.image ? `<img src="${card.image}" alt="${card.title}">` : ''}
${card.tag ? `<div class="tag ${card.tag}" alt="${card.tag}">${card.tag}</div>` : ''}
<div class="title">${card.title}</div>
`;
cardElement.addEventListener('click', () => showModal(card));
columnElement.appendChild(cardElement);
});
board.appendChild(columnElement);
});
}
function showModal(card) {
const modal = document.getElementById('modal');
const modalTitle = document.getElementById('modalTitle');
const modalDescription = document.getElementById('modalDescription');
modalTitle.textContent = card.title;
modalDescription.textContent = card.description;
modal.style.display = 'block';
}
// close modal when clicking on the close button or outside the modal
document.addEventListener('click', function(event) {
const modal = document.getElementById('modal');
if (event.target === modal || event.target.classList.contains('close')) {
modal.style.display = 'none';
}
});
// initialize the board
async function init() {
const boardData = await loadBoardData();
if (boardData) {
createBoard(boardData);
} else {
console.error('Failed to load board data');
}
}
init();