diff options
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/christmas/snow.js | 113 | ||||
-rw-r--r-- | public/js/liveClock.js | 10 | ||||
-rw-r--r-- | public/js/neverSaid.js | 35 | ||||
-rw-r--r-- | public/js/schemeSwap.js | 72 |
4 files changed, 0 insertions, 230 deletions
diff --git a/public/js/christmas/snow.js b/public/js/christmas/snow.js deleted file mode 100644 index 3d2d7af..0000000 --- a/public/js/christmas/snow.js +++ /dev/null @@ -1,113 +0,0 @@ -/*! -// Snow.js - v0.0.3 -// kurisubrooks.com -// -// Modified by floppydisk -// - Changed snowflakes to "Heavy chevron snowflake" (U+2746) -// - Made snowflakes randomly rotate slowly either right or left -*/ - -// Amount of Snowflakes -var snowMax = 80; - -// Snowflake Colours -var snowColor = [ - "#cad3f5", - "#a5adcb", - "#5b6078" -]; - -// Snow Entity -var snowEntity = "❆" //"•"; - -// Falling Velocity -var snowSpeed = 0.5; - -// Minimum Flake Size -var snowMinSize = 8; - -// Maximum Flake Size -var snowMaxSize = 24; - -// Refresh Rate (in milliseconds) -var snowRefresh = 50; - -// Additional Styles -var snowStyles = "cursor: default; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -o-user-select: none; user-select: none;"; - -/* -// End of Configuration -// ---------------------------------------- -// Do not modify the code below this line -*/ - -var snow = [], - pos = [], - coords = [], - lefr = [], - marginBottom, - marginRight; - -function randomise(range) { - rand = Math.floor(range * Math.random()); - return rand; -} - -function initSnow() { - var snowSize = snowMaxSize - snowMinSize; - marginBottom = Math.max(document.body.scrollHeight, window.innerHeight) - 5; - marginRight = document.body.clientWidth - 15; - - for (i = 0; i <= snowMax; i++) { - coords[i] = 0; - lefr[i] = Math.random() * 15; - pos[i] = 0.03 + Math.random() / 10; - snow[i] = document.getElementById("flake" + i); - snow[i].style.fontFamily = "inherit"; - snow[i].size = randomise(snowSize) + snowMinSize; - snow[i].style.fontSize = snow[i].size + "px"; - snow[i].style.color = snowColor[randomise(snowColor.length)]; - snow[i].style.zIndex = 1000; - snow[i].sink = snowSpeed * snow[i].size / 5; - snow[i].posX = randomise(marginRight - snow[i].size); - snow[i].posY = randomise(2 * marginBottom - marginBottom - 2 * snow[i].size); - snow[i].style.left = snow[i].posX + "px"; - snow[i].style.top = snow[i].posY + "px"; - snow[i].rotation = Math.random() * 360; // add a random initial rotation - snow[i].direction = Math.random() > 0.5 ? 1 : -1; // add a random direction - } - - moveSnow(); -} - -function resize() { - marginBottom = Math.max(document.body.scrollHeight, window.innerHeight) - 5; - marginRight = document.body.clientWidth - 15; -} - -function moveSnow() { - for (i = 0; i <= snowMax; i++) { - coords[i] += pos[i]; - snow[i].posY += snow[i].sink; - snow[i].style.left = snow[i].posX + lefr[i] * Math.sin(coords[i]) + "px"; - snow[i].style.top = snow[i].posY + "px"; - - - if (snow[i].posY >= marginBottom - 2 * snow[i].size || parseInt(snow[i].style.left) > (marginRight - 3 * lefr[i])) { - snow[i].posX = randomise(marginRight - snow[i].size); - snow[i].posY = 0; - } - snow[i].rotation += snow[i].sink * snow[i].direction; // increment rotation based on direction - snow[i].style.transform = "rotate(" + snow[i].rotation + "deg)"; // rotate the snowflake - } - - setTimeout("moveSnow()", snowRefresh); -} - -for (i = 0; i <= snowMax; i++) { - document.write("<span id='flake" + i + "' style='" + snowStyles + "position:absolute;top:-" + snowMaxSize + "'>" + snowEntity + "</span>"); -} - -window.addEventListener('resize', resize); -window.addEventListener('load', initSnow); - diff --git a/public/js/liveClock.js b/public/js/liveClock.js deleted file mode 100644 index 07c9eae..0000000 --- a/public/js/liveClock.js +++ /dev/null @@ -1,10 +0,0 @@ -function time() { - var span = document.getElementById("clock"); - var d = new Date(); - var s = d.getSeconds(); - var m = d.getMinutes(); - var h = d.getHours(); - span.textContent = - ("0" + h).substr(-2) + ":" + ("0" + m).substr(-2) + ":" + ("0" + s).substr(-2); -} -setInterval(time, 1000); diff --git a/public/js/neverSaid.js b/public/js/neverSaid.js deleted file mode 100644 index ac0e6ae..0000000 --- a/public/js/neverSaid.js +++ /dev/null @@ -1,35 +0,0 @@ -// Define an array of strings -const neverSaid = [ - "<strong>ASM:</strong> The Director liked all the props we got today.", - "<strong>PM:</strong> Ah ha, a revolve. Terrific.", - "<strong>Chippie:</strong> I don't know, let's look at the ground plan.", - "<strong>Set Designer:</strong> Well, let's just have whatever is cheaper.", - "<strong>Sound:</strong> Better turn that down a bit. We don't want to deafen them.", - "<strong>Director:</strong> Sorry, my mistake.", - "<strong>Electrics:</strong> This equipment is more complicated than we need.", - "<strong>Performer:</strong> I really think my big scene should be cut.", - "<strong>SM:</strong> Can we do that scene change again please?", - "<strong>LX designer:</strong> Bit more light from those big chaps at the side. Yes that's right, the ones on stalks whatever they are called.", - "<strong>Electrics:</strong> All the equipment works perfectly.", - "<strong>Musicians:</strong> So what if that's the end of a call. Let's just finish this bit off.", - "<strong>Wardrobe:</strong> Now, when exactly is the first dress rehearsal?", - "<strong>Workshop:</strong> I don't want anyone to know, but if you insist then yes, I admit it, I have just done an all-nighter.", - "<strong>Performer:</strong> This costume is so comfortable.", - "<strong>Admin:</strong> The level of overtime payments here are simply unacceptable. Our backstage staff deserve better.", - "<strong>Box Office:</strong> Comps? No problem.", - "<strong>Set Designer:</strong> You're right, it looks dreadful.", - "<strong>Flyman:</strong> No, my lips are sealed. What I may or may not have seen remains a secret.", - "<strong>Electrics:</strong> That had nothing to do with the computer, it was my fault.", - "<strong>Crew:</strong> No, no, I'm sure that's our job.", - "<strong>SMgt:</strong> Thanks, but I don't drink", - "<strong>Performer:</strong> Let me stand down here with my back to the audience.", - "<strong>Chippie:</strong> I can't really manage those big fast power tools myself.", - "<strong>Chippie:</strong> I prefer to use these little hand drills.", - "<strong>All:</strong> Let's go and ask the Production Manager. He'll know." -] - -// Generate a random index into the array -const randomIndex = Math.floor(Math.random() * neverSaid.length); - -// Use document.write to output the random string -document.write(neverSaid[randomIndex]); diff --git a/public/js/schemeSwap.js b/public/js/schemeSwap.js deleted file mode 100644 index 044df0f..0000000 --- a/public/js/schemeSwap.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Retrieves a cookies value - * @param {string} cname Cookie name - * @returns {string} Cookie value - */ -function getCookie(cname) { - let name = cname + "="; - let decodedCookie = decodeURIComponent(document.cookie); - let ca = decodedCookie.split(';'); - for(let i = 0; i <ca.length; i++) { - let c = ca[i]; - while (c.charAt(0) === ' ') { - c = c.substring(1); - } - if (c.indexOf(name) === 0) { - return c.substring(name.length, c.length); - } - } - return ""; -} - -/** - * Sets/creates a cookie - * @param {string} cname Cookie name - * @param {string} cvalue Cookie value - * @param {number} exdays Cookie lifespan (days) - */ -function setCookie(cname, cvalue, exdays) { - const hostname = window.location.hostname; - const d = new Date(); - d.setTime(d.getTime() + (exdays*24*60*60*1000)); - let expires = "expires="+ d.toUTCString(); - document.cookie = `${cname}=${cvalue};${expires};path=/;SameSite=Strict;Domain=${hostname}` -} - -/** - * Checks if a cookie exists - * @param {string} cname Cookie name - * @returns {boolean} If cookie exists or not - */ -function cookieExists(cname) { - const cvalue = getCookie(cname); - return cvalue !== ""; -} - -/** - * Swaps the colorscheme - * @param {string} scheme Color scheme ID - */ -function swapScheme() { - let scheme = document.getElementById('scheme-selector').value ; - setCookie("colorscheme", scheme, 90); - document.getElementById("css-colorscheme").href = `/css/colorschemes/${scheme}.css`; - console.log(`Set colorscheme to ${getCookie("colorscheme")}`) -} - -function setSchemeSelector() { - if (!cookieExists("colorscheme")) { - setCookie("colorscheme", "catppuccin-macchiato", 90); - } else { - const scheme = getCookie("colorscheme"); - const scheme_selector = document.getElementById("scheme-selector"); - if (scheme && scheme_selector) { - for (let option of scheme_selector.options) { - if (option.value === scheme) { - option.selected = true; - break; - } - } - } - } -} |