diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/www/index.html b/www/index.html index d12b04c..59da2d7 100644 --- a/www/index.html +++ b/www/index.html @@ -1,30 +1,31 @@ - + Locutus + - + - -
+
+
+ +
+ diff --git a/www/res/images/background.jpg b/www/res/images/background.jpg new file mode 100644 index 0000000..49e8f69 Binary files /dev/null and b/www/res/images/background.jpg differ diff --git a/www/res/js/locutus.js b/www/res/js/locutus.js index 8d1c8b6..e347749 100644 --- a/www/res/js/locutus.js +++ b/www/res/js/locutus.js @@ -1 +1,65 @@ - +"use strict"; + +let main, windows; + +function createWelcomeWindow() { + let win = document.createElement("div"); + win.id = "welcome-win"; + + win.innerHTML = ` +

Welcome to Locutus!

+ Login`; + + while (windows.lastChild) windows.removeChild(windows.lastChild); + windows.appendChild(win); +} + +function createLoginWindow() { + let win = document.createElement("div"); + win.id = "login-win"; + + win.innerHTML = ` +

Login to USIMP Account

+
+ + + +
`; + + while (windows.lastChild) windows.removeChild(windows.lastChild); + windows.appendChild(win); +} + +function handleHash(hash) { + if (hash[0] === '#') hash = hash.substr(1); + if (hash === '') hash = '/welcome'; + switch (hash) { + case "/welcome": createWelcomeWindow(); break; + case "/login": createLoginWindow(); break; + default: + console.error(`Invalid url hash "${hash}"`); + hash = "/welcome"; + break; + } + let url = new URL(document.URL); + url.hash = hash; + location.href = url.toString(); +} + +function handleUrl(url) { + handleHash(new URL(url).hash) +} + +window.addEventListener("load", function () { + main = document.getElementsByTagName("main")[0]; + windows = document.getElementById("windows"); + + // Remove