From cf3eecb27f4b10e12e9dfbb240fb3e9f3b63bb4b Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Sun, 31 Oct 2021 12:35:03 +0100 Subject: [PATCH] Style changes and log removal Fixed the scroll direction for lyrics, made the art window's font clamp (and centered) and also removed some loggers. player.html will redirect to the main page if opened without a hash and will no longer be caught by crawlers that care about robots.txt --- assets/css/player.css | 13 +++++++++++++ assets/js/modules/PlayerManager.mjs | 1 - assets/js/modules/StillAlivePlayer.mjs | 1 - assets/js/player.mjs | 14 ++++++++++++++ index.html | 1 + robots.txt | 5 +++++ 6 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 robots.txt diff --git a/assets/css/player.css b/assets/css/player.css index 6155d91..7d59357 100644 --- a/assets/css/player.css +++ b/assets/css/player.css @@ -9,15 +9,28 @@ body { #player { position: absolute; +} + +body.credits #player { bottom: var(--padding); } +body.art { + display: flex; + justify-content: center; + align-items: center; +} + #player pre, #player p { font-size: 16px; color: rgb(var(--color-accent)); } +body.art #player pre { + font-size: clamp(0px,3vw,3vh); +} + #player p { margin: 0; height: 23px; diff --git a/assets/js/modules/PlayerManager.mjs b/assets/js/modules/PlayerManager.mjs index ed07b96..2af9e03 100644 --- a/assets/js/modules/PlayerManager.mjs +++ b/assets/js/modules/PlayerManager.mjs @@ -107,7 +107,6 @@ export default class WindowManager { message(event) { const type = event.data[0]; const data = event.data[1]; - console.log(event); switch(type) { case "PLAY": console.log("PLAY",event); break; diff --git a/assets/js/modules/StillAlivePlayer.mjs b/assets/js/modules/StillAlivePlayer.mjs index 7a177a7..124fb55 100644 --- a/assets/js/modules/StillAlivePlayer.mjs +++ b/assets/js/modules/StillAlivePlayer.mjs @@ -51,7 +51,6 @@ export default class StillAlivePlayer { message(event) { const type = event.data[0]; const data = event.data[1]; - console.log(event); switch(type) { case "LINE_FEED": this.lineFeed(); break; diff --git a/assets/js/player.mjs b/assets/js/player.mjs index d75aed8..2462732 100644 --- a/assets/js/player.mjs +++ b/assets/js/player.mjs @@ -1,4 +1,18 @@ import { default as Player } from "./modules/StillAlivePlayer.mjs"; +// Go to start page if location.hash is omitted +if(!window.location.hash) { + // Close this window, if we can + window.close(); + + // Otherwise redirect to main page + const page = window.location.pathname.split("/"); + const url = window.location.href.replace(page[page.length - 1],""); + window.location.replace(url); +} + +// Add location.hash to body classList +document.body.classList.add(window.location.hash.substring(1)); + const element = document.getElementById("player"); const player = new Player(element); \ No newline at end of file diff --git a/index.html b/index.html index ec8dc93..d5d17c5 100755 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ + Still Alive diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..97b12d0 --- /dev/null +++ b/robots.txt @@ -0,0 +1,5 @@ +User-Agent: * + +Allow: / + +Disallow: /player \ No newline at end of file