Restyled by clang-format

This commit is contained in:
Restyled.io 2024-06-11 16:59:42 +00:00
parent 3787b539f8
commit 23dff498c8
3 changed files with 97 additions and 93 deletions

View file

@ -1,5 +1,6 @@
// Define an array of strings
const neverSaid = [
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.",
@ -26,10 +27,10 @@ const neverSaid = [
"<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);
// 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]);

View file

@ -1,5 +1,6 @@
// Define an array of strings
const neverSaid = [
const neverSaid =
[
"<td style=\"width: 105px\"><strong>ASM:</strong></td> <td>The Director liked all the props we got today.</td>",
"<td style=\"width: 105px\"><strong>PM:</strong></td> <td>Ah ha, a revolve. Terrific.</td>",
"<td style=\"width: 105px\"><strong>Chippie:</strong></td> <td>I don't know, let's look at the ground plan.</td>",
@ -26,10 +27,10 @@ const neverSaid = [
"<td style=\"width: 105px\"><strong>Chippie:</strong></td> <td>I can't really manage those big fast power tools myself.</td>",
"<td style=\"width: 105px\"><strong>Chippie:</strong></td> <td>I prefer to use these little hand drills.</td>",
"<td style=\"width: 105px\"><strong>All:</strong></td> <td>Let's go and ask the Production Manager. He'll know.</td>"
]
]
// Generate a random index into the array
const randomIndex = Math.floor(Math.random() * neverSaid.length);
// 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]);

View file

@ -7,7 +7,7 @@ function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for(let i = 0; i <ca.length; i++) {
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) === ' ') {
c = c.substring(1);
@ -27,9 +27,10 @@ function getCookie(cname) {
*/
function setCookie(cname, cvalue, exdays) {
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=.diskfloppy.me";
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
let expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires +
";path=/;SameSite=Strict;Domain=.diskfloppy.me";
}
/**
@ -48,7 +49,8 @@ function cookieExists(cname) {
*/
function swapScheme(scheme) {
setCookie("colorscheme", scheme, 90);
document.getElementById("css-colorscheme").href = `/css/colorschemes/${scheme}.css`;
document.getElementById("css-colorscheme").href =
`/css/colorschemes/${scheme}.css`;
console.log(`Set colorscheme to ${getCookie("colorscheme")}`)
}