still-alive/assets/js/player.mjs
Victor Westerlund 1185a744f2
Semi-stable release (#1)
* dev21w41a

* Added Monkeydo submodule

Added Monkeydo to .gitmodules

* dev21w41b

* Added functional code before manifest and CSS

The JS-part of this demo is now functional to the point where a Monkeydo manifest can be played on the different windows. CSS styling and an actual manifest will still have to be created.

* Create README.md

* Cake

* Update README.md

* Unsynced working example

Everything is cued up and good to go. Now comes the fun part of syncing the lyrics with the song

* Synchronized lyrics with music

So, yeah this totally didn't take 6 hours to do.

* 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
2021-10-31 12:40:49 +01:00

18 lines
No EOL
576 B
JavaScript

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);