Fix a bug that caused the easter egg to not work on site load

This commit is contained in:
Chloe Fontenot 🏳️‍⚧️ 2024-08-12 12:59:37 -05:00
parent 7d5c6d3b20
commit 8220685bfd

View File

@ -73,6 +73,23 @@
<input class="button" type="button" onclick="drawDesign();" value="Draw design"> <input class="button" type="button" onclick="drawDesign();" value="Draw design">
<input class="button" id="toggleEasterEgg" type="button" onclick="easterEgg(false);" value="Disable Easter Egg" style="display: none;"> <input class="button" id="toggleEasterEgg" type="button" onclick="easterEgg(false);" value="Disable Easter Egg" style="display: none;">
</div> </div>
<p id="jsOutput"></p>
<!--img id=riitag src="https://tag.rc24.xyz/294976590658666497/tag.max.png" alt="My RiiTag" width=1024-->
<button id=DiscordButton class=button onClick="toggleDiscordWidget()">Show Discord Widget</button>
<div id="DiscordWidget" style="display: none">
<iframe src="https://discord.com/widget?id=475327576110268466&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>
</div>
<p>
<a href="https://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px" src="https://jigsaw.w3.org/css-validator/images/vcss"
alt="Valid CSS!" />
</a>
</p>
<footer>
<a href=https://gitea.calebfontenot.com/CCF_100/frontpage class="button info">Caleb Fontenot, 2024</a>
</footer>
<script> <script>
function getCookie(cname) { function getCookie(cname) {
let name = cname + "="; let name = cname + "=";
@ -92,12 +109,6 @@
} }
function easterEgg(easterEggState) { function easterEgg(easterEggState) {
console.log("Easter egg state is: " + easterEggState); console.log("Easter egg state is: " + easterEggState);
// Check existing site state before updating it (prevents the site from hanging when you use the drawDesign function)
if ((/true/).test(getCookie("easterEggState") == easterEggState)) {
console("Easter egg state already set! Ignoring request...");
return;
}
if (easterEggState) { if (easterEggState) {
document.cookie = "easterEggState=true"; document.cookie = "easterEggState=true";
document.body.style.backgroundImage = "url(https://files.calebfontenot.com/blahaj-bl%C3%A5haj.gif)"; document.body.style.backgroundImage = "url(https://files.calebfontenot.com/blahaj-bl%C3%A5haj.gif)";
@ -285,7 +296,7 @@
//console.log(i, j, outputLine); //console.log(i, j, outputLine);
if (lineHasInput) { if (lineHasInput) {
console.log("outputLine", outputLine); //console.log("outputLine", outputLine);
outputString += outputLine + "<br>"; outputString += outputLine + "<br>";
} }
outputLine = ""; outputLine = "";
@ -303,7 +314,7 @@
let stringEval = undefined, stringEvalIndex = undefined; let stringEval = undefined, stringEvalIndex = undefined;
while ((stringEval = surrogatePairs.exec(compareString)) !== null) { while ((stringEval = surrogatePairs.exec(compareString)) !== null) {
stringEvalIndex = stringEval.index; stringEvalIndex = stringEval.index;
console.log("emoji is at index", stringEvalIndex); //console.log("emoji is at index", stringEvalIndex);
} }
if (stringEvalIndex == i) { if (stringEvalIndex == i) {
stringLength--; stringLength--;
@ -336,7 +347,7 @@
} else { } else {
var spaceOffset = ""; var spaceOffset = "";
} }
console.log(radius, mid); //console.log(radius, mid);
// dist represents distance to the center // dist represents distance to the center
let dist = parseFloat(0); let dist = parseFloat(0);
let space = "" let space = ""
@ -425,23 +436,6 @@
} }
} }
</script> </script>
<p id="jsOutput"></p>
<!--img id=riitag src="https://tag.rc24.xyz/294976590658666497/tag.max.png" alt="My RiiTag" width=1024-->
<button id=DiscordButton class=button onClick="toggleDiscordWidget()">Show Discord Widget</button>
<div id="DiscordWidget" style="display: none">
<iframe src="https://discord.com/widget?id=475327576110268466&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>
</div>
<p>
<a href="https://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px" src="https://jigsaw.w3.org/css-validator/images/vcss"
alt="Valid CSS!" />
</a>
</p>
<footer>
<a href=https://gitea.calebfontenot.com/CCF_100/frontpage class="button info">Caleb Fontenot, 2024</a>
</footer>
</div> </div>
</body> </body>