Add jquery (needs optimizing lol)

This commit is contained in:
bingus_violet 2024-06-25 18:35:58 -05:00
parent c6ddb7fe40
commit 0364cca624
7 changed files with 29 additions and 16 deletions

View file

@ -8,6 +8,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../jquery.js"></script>
<script src="../main.js"></script>
<title>Violet's Purgatory</title> <title>Violet's Purgatory</title>
<meta name="darkreader-lock"> <meta name="darkreader-lock">

View file

@ -5,6 +5,9 @@
<link rel="stylesheet" type="text/css" href="/style.css"> <link rel="stylesheet" type="text/css" href="/style.css">
<link rel="stylesheet" type="text/css" href="/subpage.css"> <link rel="stylesheet" type="text/css" href="/subpage.css">
<script src="../jquery.js"></script>
<script src="../main.js"></script>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">

View file

@ -8,6 +8,7 @@
<link rel="stylesheet" href="./noScript.css"> <link rel="stylesheet" href="./noScript.css">
</noscript> </noscript>
<script src="./jquery.js"></script>
<script src="./main.js"></script> <script src="./main.js"></script>
<meta charset="UTF-8"> <meta charset="UTF-8">

2
static/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -78,13 +78,13 @@ function spinLoop() {
} }
spins += 1/spinSpeed / spinFactor spins += 1/spinSpeed / spinFactor
if (Math.floor(spins) != lastSent && sock && sock.OPEN) { if (Math.floor(spins) != lastSent && sock && sock.OPEN) {
document.querySelector(".globalSpins").innerHTML = globalSpins + 1 $(".globalSpins").innerHTML = globalSpins + 1
lastSent = Math.floor(spins) lastSent = Math.floor(spins)
// resetPFP() // resetPFP()
sock.send(`{"op": 4}`) sock.send(`{"op": 4}`)
if (spins > 1) { if (spins > 1) {
document.querySelector(".spinnyCount").style.display = "block" $(".spinnyCount").css("display", "block")
document.querySelector(".localSpins").innerHTML = lastSent; $(".localSpins").html(lastSent);
} }
} }
} else { } else {
@ -98,7 +98,7 @@ function spinLoop() {
spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3) spins = lerp(spins, Math.round(spins), 1 / spinSpeed * 3)
} }
document.querySelector(".pfp").style.rotate = (spins * 360) + "deg" $(".pfp").css("rotate", (spins * 360) + "deg")
spinLoop() spinLoop()
}, 1/spinSpeed * 1000); }, 1/spinSpeed * 1000);
} }
@ -110,11 +110,11 @@ window.onbeforeunload = function () {
window.onload = function () { window.onload = function () {
window.scrollTo(0, 0); window.scrollTo(0, 0);
pfp = document.querySelector(".pfp") pfp = $(".pfp")
spinLoop() spinLoop()
pfp.addEventListener("mousedown", () => { pfp.on("mousedown", () => {
// if (!spinWaiting) { // if (!spinWaiting) {
// spinLoop(); // spinLoop();
// } // }
@ -122,9 +122,9 @@ window.onload = function () {
spinning = true spinning = true
pfp.style.transition = "" pfp.css("transition", "")
pfp.style.scale = "1.1" pfp.css("scale", "1.1")
}) })
document.body.onmouseup = () => { document.body.onmouseup = () => {
@ -139,7 +139,7 @@ window.onload = function () {
// pfp.style.transition = "all 3s cubic-bezier(0.39, 0.575, 0.565, 1)" // pfp.style.transition = "all 3s cubic-bezier(0.39, 0.575, 0.565, 1)"
pfp.style.scale = "1" pfp.css("scale", "1")
} }
} }
socketeer() socketeer()
@ -185,20 +185,20 @@ function socketeer() {
globalSpins = data.spins globalSpins = data.spins
if (firsttimeDebounce == true) { if (firsttimeDebounce == true) {
firsttimeDebounce = false firsttimeDebounce = false
document.querySelector(".globalSpins").innerHTML = globalSpins + 1; $(".globalSpins").innerHTML = globalSpins + 1;
} else { } else {
document.querySelector(".globalSpins").innerHTML = globalSpins; $(".globalSpins").innerHTML = globalSpins;
} }
} else if (data.op == 0) { } else if (data.op == 0) {
var lanyard = data.d var lanyard = data.d
var statusInfo = discStatuses[lanyard.discord_status] var statusInfo = discStatuses[lanyard.discord_status]
var lastStatus = document.querySelector(".statusColor") var lastStatus = $(".statusColor")
if (lastStatus.innerHTML != statusInfo.text) { if (lastStatus.innerHTML != statusInfo.text) {
lastStatus.innerHTML = statusInfo.text lastStatus.innerHTML = statusInfo.text
lastStatus.style.color = statusInfo.color lastStatus.css("color", statusInfo.color)
pfp.style.borderColor = lastStatus.style.color pfp.css("borderColor", statusInfo.color)
resetPFP() resetPFP()
} }
@ -210,7 +210,7 @@ function socketeer() {
// } // }
var discFetch = await (await fetch("/discHTML")).text() var discFetch = await (await fetch("/discHTML")).text()
document.querySelector("#activityHtml").innerHTML = discFetch $("#activityHtml").html(discFetch)
} else if (data.op == 3) { } else if (data.op == 3) {
lastPong = Date.now() lastPong = Date.now()
} else { } else {

View file

@ -4,6 +4,8 @@
<head> <head>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="stylesheet" type="text/css" href="../subpage.css"> <link rel="stylesheet" type="text/css" href="../subpage.css">
<script src="../jquery.js"></script>
<script src="../main.js"></script> <script src="../main.js"></script>
<meta charset="UTF-8"> <meta charset="UTF-8">

View file

@ -4,6 +4,8 @@
<head> <head>
<link rel="stylesheet" type="text/css" href="../style.css"> <link rel="stylesheet" type="text/css" href="../style.css">
<link rel="stylesheet" type="text/css" href="../subpage.css"> <link rel="stylesheet" type="text/css" href="../subpage.css">
<script src="../jquery.js"></script>
<script src="../main.js"></script> <script src="../main.js"></script>
<meta charset="UTF-8"> <meta charset="UTF-8">
@ -18,7 +20,7 @@
<meta content="https://api.violets-purgatory.dev/v1/pfp" property="og:image" /> <meta content="https://api.violets-purgatory.dev/v1/pfp" property="og:image" />
<meta content="#a200ff" data-react-helmet="true" name="theme-color" /> <meta content="#a200ff" data-react-helmet="true" name="theme-color" />
</head> </head>
<body> <body>
{WEATHER_MODIFIER} {WEATHER_MODIFIER}
<a href="../" class="chip">Home</a> <a href="../" class="chip">Home</a>