Spaces:
Running
Running
Update competitions/templates/index.html
Browse files
competitions/templates/index.html
CHANGED
|
@@ -245,28 +245,28 @@
|
|
| 245 |
});
|
| 246 |
}
|
| 247 |
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
function fetchAndDisplayLeaderboard() {
|
| 271 |
const articleLoadingSpinner = document.getElementById('articleLoadingSpinner');
|
| 272 |
articleLoadingSpinner.classList.remove('hidden');
|
|
@@ -339,10 +339,10 @@
|
|
| 339 |
event.preventDefault(); // Prevent the default link behavior
|
| 340 |
fetchAndDisplaySubmissionInfo(); // Fetch and display info on click
|
| 341 |
});
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
|
| 347 |
|
| 348 |
// Fetch and display info when the page loads
|
|
|
|
| 245 |
});
|
| 246 |
}
|
| 247 |
|
| 248 |
+
function fetchAndDisplayRules() {
|
| 249 |
+
const articleLoadingSpinner = document.getElementById('articleLoadingSpinner');
|
| 250 |
+
articleLoadingSpinner.classList.remove('hidden');
|
| 251 |
+
fetch('/rules')
|
| 252 |
+
.then(response => {
|
| 253 |
+
if (!response.ok) {
|
| 254 |
+
throw new Error('Network response was not ok');
|
| 255 |
+
}
|
| 256 |
+
return response.json(); // Parse the JSON response
|
| 257 |
+
})
|
| 258 |
+
.then(data => {
|
| 259 |
+
// Populate the 'content' div with the HTML from the response
|
| 260 |
+
const contentDiv = document.getElementById('content');
|
| 261 |
+
contentDiv.innerHTML = marked.parse(data.response);
|
| 262 |
+
addTargetBlankToLinks();
|
| 263 |
+
articleLoadingSpinner.classList.add('hidden');
|
| 264 |
+
})
|
| 265 |
+
.catch(error => {
|
| 266 |
+
console.error('There has been a problem with your fetch operation:', error);
|
| 267 |
+
articleLoadingSpinner.classList.add('hidden');
|
| 268 |
+
});
|
| 269 |
+
}
|
| 270 |
function fetchAndDisplayLeaderboard() {
|
| 271 |
const articleLoadingSpinner = document.getElementById('articleLoadingSpinner');
|
| 272 |
articleLoadingSpinner.classList.remove('hidden');
|
|
|
|
| 339 |
event.preventDefault(); // Prevent the default link behavior
|
| 340 |
fetchAndDisplaySubmissionInfo(); // Fetch and display info on click
|
| 341 |
});
|
| 342 |
+
rulesLink.addEventListener('click', function (event) {
|
| 343 |
+
event.preventDefault(); // Prevent the default link behavior
|
| 344 |
+
fetchAndDisplayRules(); // Fetch and display info on click
|
| 345 |
+
});
|
| 346 |
|
| 347 |
|
| 348 |
// Fetch and display info when the page loads
|