-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgames.js
130 lines (121 loc) · 2.61 KB
/
games.js
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// games.js
const games = [
{
title: "2048",
url: "2048/index.html"
},
{
title: "Snakes",
url: "snakes/index.html"
},
{
title: "Tetris",
url: "tetris/index.html"
},
{
title: "Word Search",
url: "wordsearch/index.html"
},
{
title: "Breakout",
url: "breakout/index.html"
},
{
title: "Maze Runner",
url: "maze/index.html"
},
{
title: "Chess",
url: "chess/build/index.html"
},
{
title: "3D Chess",
url: "chess3d/build/index.html"
},
{
title: "Othello",
url: "othello/index.html"
},
{
title: "Pacman",
url: "pacman/index.html"
},
{
title: "Missle Command",
url: "misslecommand/index.html"
},
{
title: "Space Invaders",
url: "invaders/index.html"
},
{
title: "Mastermind",
url: "mastermind/index.html"
},
{
title: "Space Battle",
url: "spacebattle/index.html"
},
{
title: "Frogger",
url: "frogger/index.html"
},
{
title: "Battleship",
url: "battleship/index.html"
},
{
title: "Memory",
url: "memory/index.html"
},
{
title: "Pong",
url: "pong/index.html"
},
{
title: "Laser Chess",
url: "laserchess/index.html"
},
{
title: "Sudoku",
url: "sudoku/index.html"
},
{
title: "Jeopardy",
url: "jeopardy/index.html"
},
{
title: "Connect Four",
url: "connect4/index.html"
},
{
title: "Scrabble",
url: "scrabble/index.html"
},
{
title: "Billiards",
url: "billiards/index.html"
},
{
title: "Simon",
url: "simon/index.html"
}
];
document.addEventListener('DOMContentLoaded', () => {
const gameGrid = document.getElementById('gameGrid');
games.forEach(game => {
const gameCard = document.createElement('div');
gameCard.classList.add('game-card');
const title = document.createElement('h3');
title.textContent = game.title;
gameCard.appendChild(title);
const thumbnail = document.createElement('img');
thumbnail.src = `${game.url.replace('index.html', '')}thumbnail.png`;
thumbnail.alt = `${game.title} Thumbnail`;
gameCard.appendChild(thumbnail);
gameCard.addEventListener('click', () => {
window.location.href = game.url;
});
gameGrid.appendChild(gameCard);
});
});