eaglelandsonce commited on
Commit
dd0c381
·
verified ·
1 Parent(s): 434619c

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +270 -18
index.html CHANGED
@@ -1,19 +1,271 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Git Terminology Matching Game</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ line-height: 1.6;
11
+ color: #333;
12
+ max-width: 1000px;
13
+ margin: 0 auto;
14
+ padding: 20px;
15
+ }
16
+ h1 {
17
+ color: #0078D4;
18
+ }
19
+ #score {
20
+ font-size: 18px;
21
+ font-weight: bold;
22
+ margin-bottom: 20px;
23
+ }
24
+ .game-container {
25
+ display: flex;
26
+ justify-content: space-between;
27
+ }
28
+ .column {
29
+ padding: 10px;
30
+ }
31
+ #elements {
32
+ width: 30%;
33
+ }
34
+ #descriptions {
35
+ width: 65%;
36
+ }
37
+ .item {
38
+ background-color: #f0f0f0;
39
+ border: 1px solid #ddd;
40
+ padding: 10px;
41
+ margin-bottom: 10px;
42
+ cursor: pointer;
43
+ border-radius: 4px;
44
+ transition: background-color 0.3s ease;
45
+ }
46
+ .item:hover {
47
+ background-color: #e0e0e0;
48
+ }
49
+ .item.selected {
50
+ background-color: #0078D4;
51
+ color: white;
52
+ }
53
+ .item.correct {
54
+ background-color: #107C10;
55
+ color: white;
56
+ }
57
+ .item.incorrect {
58
+ background-color: #D83B01;
59
+ color: white;
60
+ }
61
+ #result {
62
+ margin-top: 20px;
63
+ font-weight: bold;
64
+ }
65
+ button {
66
+ background-color: #0078D4;
67
+ color: white;
68
+ border: none;
69
+ padding: 10px 20px;
70
+ cursor: pointer;
71
+ font-size: 16px;
72
+ margin-top: 20px;
73
+ margin-right: 10px;
74
+ border-radius: 4px;
75
+ transition: background-color 0.3s ease;
76
+ }
77
+ button:hover {
78
+ background-color: #106EBE;
79
+ }
80
+ .modal {
81
+ display: none;
82
+ position: fixed;
83
+ z-index: 1;
84
+ left: 0;
85
+ top: 0;
86
+ width: 100%;
87
+ height: 100%;
88
+ overflow: auto;
89
+ background-color: rgba(0,0,0,0.4);
90
+ }
91
+ .modal-content {
92
+ background-color: #fefefe;
93
+ margin: 15% auto;
94
+ padding: 20px;
95
+ border: 1px solid #888;
96
+ width: 80%;
97
+ max-width: 800px;
98
+ border-radius: 8px;
99
+ }
100
+ .close {
101
+ color: #aaa;
102
+ float: right;
103
+ font-size: 28px;
104
+ font-weight: bold;
105
+ cursor: pointer;
106
+ }
107
+ .close:hover,
108
+ .close:focus {
109
+ color: black;
110
+ text-decoration: none;
111
+ cursor: pointer;
112
+ }
113
+ </style>
114
+ </head>
115
+ <body>
116
+ <h1>Git Terminology Matching Game</h1>
117
+ <div id="score">Score: 0 / 15</div>
118
+ <p>Match the Git terms with their descriptions. Click on an item from each column to make a match.</p>
119
+ <div class="game-container">
120
+ <div class="column" id="elements"></div>
121
+ <div class="column" id="descriptions"></div>
122
+ </div>
123
+ <div id="result"></div>
124
+ <button id="replay">Replay Game</button>
125
+ <button id="showSolution">Show Solution</button>
126
+
127
+ <div id="solutionModal" class="modal">
128
+ <div class="modal-content">
129
+ <span class="close">&times;</span>
130
+ <h2>Solution</h2>
131
+ <div id="solutionContent"></div>
132
+ </div>
133
+ </div>
134
+
135
+ <script>
136
+ const gameData = [
137
+ { element: "Working Tree", description: "A directory structure that contains all of the project's files." },
138
+ { element: "Repository (Repo)", description: "The directory located at the top level of a working tree, hosting all of the project's files along with their version history." },
139
+ { element: "Clone", description: "The action of creating a copy of a remote repository on a local machine to work on a project to which you have access." },
140
+ { element: "Fork", description: "The action of creating a GitHub-hosted copy of a remote repository to work on a project to which you don't have access." },
141
+ { element: "Commit", description: "A snapshot of the changes made to the files in a repository at a specific point in time." },
142
+ { element: "Staging Area", description: "An intermediate location where changes to files in the working tree are prepared before being committed." },
143
+ { element: "Branch", description: "A named series of linked commits representing a distinct version of a project." },
144
+ { element: "Merge", description: "The process of combining changes from one branch (or commit) into another." },
145
+ { element: "Object", description: "One of four types of entities in a repo: blobs, trees, commits, and tags." },
146
+ { element: "Hash", description: "A unique, fixed-length identifier representing the contents of an object." },
147
+ { element: "Remote", description: "A reference to another repository, typically pointing to a service-hosted instance of the repo." },
148
+ { element: "Pull", description: "The action that fetches changes from a remote repository and merges them into the current branch." },
149
+ { element: "Push", description: "The action that sends local commits to a remote repository, updating it with local changes." },
150
+ { element: "Fetch", description: "The action that retrieves changes from a remote repository without automatically merging them." },
151
+ { element: "Pull Request", description: "A feature in Git-based hosting platforms allowing developers to propose changes to be merged into a target branch." }
152
+ ];
153
+ let selectedElement = null;
154
+ let selectedDescription = null;
155
+ let correctMatches = 0;
156
+ function shuffleArray(array) {
157
+ for (let i = array.length - 1; i > 0; i--) {
158
+ const j = Math.floor(Math.random() * (i + 1));
159
+ [array[i], array[j]] = [array[j], array[i]];
160
+ }
161
+ }
162
+ function createGameBoard() {
163
+ const elementsContainer = document.getElementById('elements');
164
+ const descriptionsContainer = document.getElementById('descriptions');
165
+ elementsContainer.innerHTML = '';
166
+ descriptionsContainer.innerHTML = '';
167
+ const shuffledElements = [...gameData];
168
+ const shuffledDescriptions = [...gameData];
169
+ shuffleArray(shuffledElements);
170
+ shuffleArray(shuffledDescriptions);
171
+ shuffledElements.forEach((item, index) => {
172
+ const elementDiv = document.createElement('div');
173
+ elementDiv.className = 'item';
174
+ elementDiv.textContent = item.element;
175
+ elementDiv.dataset.index = index;
176
+ elementDiv.onclick = () => selectItem(elementDiv, 'element');
177
+ elementsContainer.appendChild(elementDiv);
178
+ });
179
+ shuffledDescriptions.forEach((item, index) => {
180
+ const descriptionDiv = document.createElement('div');
181
+ descriptionDiv.className = 'item';
182
+ descriptionDiv.textContent = item.description;
183
+ descriptionDiv.dataset.index = index;
184
+ descriptionDiv.onclick = () => selectItem(descriptionDiv, 'description');
185
+ descriptionsContainer.appendChild(descriptionDiv);
186
+ });
187
+ }
188
+ function selectItem(item, type) {
189
+ if (type === 'element') {
190
+ if (selectedElement && selectedElement.classList) {
191
+ selectedElement.classList.remove('selected');
192
+ }
193
+ selectedElement = item;
194
+ } else {
195
+ if (selectedDescription && selectedDescription.classList) {
196
+ selectedDescription.classList.remove('selected');
197
+ }
198
+ selectedDescription = item;
199
+ }
200
+ item.classList.add('selected');
201
+ if (selectedElement && selectedDescription) {
202
+ checkMatch();
203
+ }
204
+ }
205
+ function checkMatch() {
206
+ const elementIndex = gameData.findIndex(item => item.element === selectedElement.textContent);
207
+ const descriptionIndex = gameData.findIndex(item => item.description === selectedDescription.textContent);
208
+ if (elementIndex === descriptionIndex) {
209
+ selectedElement.classList.add('correct');
210
+ selectedDescription.classList.add('correct');
211
+ correctMatches++;
212
+ updateScore();
213
+ if (correctMatches === gameData.length) {
214
+ document.getElementById('result').textContent = 'Congratulations! You\'ve matched all items correctly!';
215
+ }
216
+ } else {
217
+ selectedElement.classList.add('incorrect');
218
+ selectedDescription.classList.add('incorrect');
219
+ setTimeout(() => {
220
+ if (selectedElement && selectedElement.classList) {
221
+ selectedElement.classList.remove('incorrect');
222
+ }
223
+ if (selectedDescription && selectedDescription.classList) {
224
+ selectedDescription.classList.remove('incorrect');
225
+ }
226
+ }, 1000);
227
+ }
228
+ if (selectedElement && selectedElement.classList) {
229
+ selectedElement.classList.remove('selected');
230
+ }
231
+ if (selectedDescription && selectedDescription.classList) {
232
+ selectedDescription.classList.remove('selected');
233
+ }
234
+ selectedElement = null;
235
+ selectedDescription = null;
236
+ }
237
+ function updateScore() {
238
+ document.getElementById('score').textContent = `Score: ${correctMatches} / ${gameData.length}`;
239
+ }
240
+ function replayGame() {
241
+ correctMatches = 0;
242
+ selectedElement = null;
243
+ selectedDescription = null;
244
+ createGameBoard();
245
+ updateScore();
246
+ document.getElementById('result').textContent = '';
247
+ }
248
+ function showSolution() {
249
+ const modal = document.getElementById('solutionModal');
250
+ const solutionContent = document.getElementById('solutionContent');
251
+ solutionContent.innerHTML = '';
252
+ gameData.forEach(item => {
253
+ solutionContent.innerHTML += `<p><strong>${item.element}:</strong> ${item.description}</p>`;
254
+ });
255
+ modal.style.display = 'block';
256
+ }
257
+ document.getElementById('replay').onclick = replayGame;
258
+ document.getElementById('showSolution').onclick = showSolution;
259
+ document.querySelector('.close').onclick = function() {
260
+ document.getElementById('solutionModal').style.display = 'none';
261
+ }
262
+ window.onclick = function(event) {
263
+ if (event.target == document.getElementById('solutionModal')) {
264
+ document.getElementById('solutionModal').style.display = 'none';
265
+ }
266
+ }
267
+ createGameBoard();
268
+ updateScore();
269
+ </script>
270
+ </body>
271
  </html>