random quote fix

This commit is contained in:
sky 2024-08-13 05:06:24 -04:00
parent f18f4a0f0b
commit 6cb7f8d20a
2 changed files with 73 additions and 79 deletions

View File

@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html class="sl-theme-dark" lang="en">
<head>
<!-- initialize theme vars
@ -13,16 +13,33 @@
<script src="/js/main.js"></script>
<script src="/js/widget.js"></script>
<script src="/js/themes.js"></script>
<script src="/js/randomquote.js"></script>
<script>
document.addEventListener("DOMContentLoaded", () => {
fetch("/data/quotes.json")
.then((response) => response.json())
.then((data) => {
const randomQuote = data[Math.floor(Math.random() * data.length)];
if (randomQuote.includes("OGNUM1") && randomQuote.includes("SQRTNUM1")) {
const ognum = Math.floor(Math.random() * 3000);
randomQuote = `the square root of ${ognum} is ${Math.sqrt(ognum)}`;
} else if (randomQuote.includes("CURRENTURL")) {
randomQuote = window.location.hostname;
}
document.getElementById("randomquote").innerHTML = randomQuote;
})
.catch((error) => console.error("Error loading quotes:", error));
});
</script>
<link rel="stylesheet" href="/style.css" />
<link rel="manifest" href="/manifest.json">
<link rel="manifest" href="/manifest.json" />
<!-- seo + other things -->
<title>Selenite</title>
<link rel="icon" href="/favicon.ico" />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415518411898563"
crossorigin="anonymous"></script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415518411898563" crossorigin="anonymous"></script>
</head>
<alerts> </alerts>
<body id="noscroll">
@ -37,24 +54,17 @@
</header>
<main id="main" class="noscroll">
<b style="font-weight: 1000px"><h1 class="chan">selenite.</h1></b>
<noscript
>enable javascript if you want the games to actually
load</noscript
>
<noscript>enable javascript if you want the games to actually load</noscript>
<p id="randomquote">better thank me for this unblocked website</p>
<div class="samerow">
<div class="img-container">
<a href="/users"
><img src="img/user_index.svg"
/></a>
<a href="/users"><img src="img/user_index.svg" /></a>
</div>
<div class="img-container">
<a href="projects.html"><img src="img/games.svg" /></a>
</div>
<div class="img-container">
<a href="https://discord.gg/7jyufnwJNf"
><img src="img/discord.svg"
/></a>
<a href="https://discord.gg/7jyufnwJNf"><img src="img/discord.svg" /></a>
</div>
</div>
</main>

View File

@ -1,16 +0,0 @@
$.getJSON("/data/quotes.json", function (data) {
let index = data[Math.floor(Math.random() * data.length)];
if (index.includes("OGNUM1") && index.includes("SQRTNUM1")) {
let ognum = Math.floor(Math.random() * 3000);
index = "the square root of " + ognum + " is " + Math.sqrt(ognum);
} else if (index.includes("CURRENTURL")) {
index = window.location.hostname;
}
if (document.readyState === "complete") {
document.getElementById("randomquote").innerHTML = index;
} else {
document.addEventListener("DOMContentLoaded", () => {
document.getElementById("randomquote").innerHTML = index;
});
}
});