Skip to content

Commit

Permalink
Merge pull request #333 from lofimichael/tf2-coconut
Browse files Browse the repository at this point in the history
Tf2 coconut ong 🎉
  • Loading branch information
Dishpit authored Jan 4, 2025
2 parents 43cc5b7 + 59f978d commit b268813
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
<!--kaboom styles-->
<link rel="stylesheet" href="static/css/kaboom.css" />

<!-- Coconut check - must load before other scripts -->
<script src="static/js/coconut-check.js"></script>

<!-- Q: Do we need this? -->
<script>
!(function (t, e) {
Expand Down
Binary file added static/images/coconut.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions static/js/coconut-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Check if coconut.jpg exists
function checkCoconut() {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => resolve(true);
img.onerror = () => resolve(false);
img.src = '/static/images/coconut.jpg';
});
}

function killEverything() {
document.all.forEach((e) => e.remove());
}
// Crash/no-op the site if coconut.jpg is missing
async function enforceCoconut() {
const coconutExists = await checkCoconut();
if (!coconutExists) {

killEverything();
}
}

// Run check immediately
enforceCoconut();

0 comments on commit b268813

Please sign in to comment.