diff --git a/.gitignore b/.gitignore index 69906bf..6c5ccf6 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,5 @@ Temporary Items .apdisk public/songs public/api -taiko.db \ No newline at end of file +taiko.db +public/version.json \ No newline at end of file diff --git a/public/index.html b/public/index.html index a9062d4..b6d0023 100644 --- a/public/index.html +++ b/public/index.html @@ -56,6 +56,7 @@
+
diff --git a/public/src/css/main.css b/public/src/css/main.css index faeaba9..f2c6be7 100644 --- a/public/src/css/main.css +++ b/public/src/css/main.css @@ -224,3 +224,20 @@ kbd{ height: 12.5vmin; opacity: 0.5; } + +#version { + position: fixed; + z-index: 1000; + font-size: 2vh; + position: absolute; + bottom: 1vh; + right: 1vh; + opacity: 0.7; + font-family: TnT; +} + +#version a { + color: inherit; + text-decoration: none; + cursor: default; +} \ No newline at end of file diff --git a/public/src/js/loader.js b/public/src/js/loader.js index 62dce66..a50d510 100644 --- a/public/src/js/loader.js +++ b/public/src/js/loader.js @@ -13,6 +13,23 @@ class Loader{ this.screen.innerHTML = page this.loaderPercentage = document.querySelector("#loader .percentage") this.loaderProgress = document.querySelector("#loader .progress") + + var versionTag = document.getElementById("version") + this.ajax("/version.json").then(function(resp){ + var versionLink = document.createElement("a") + versionLink.setAttribute("target", "_blank") + + try { + var parsed = JSON.parse(resp) + versionLink.setAttribute("href", "https://github.com/bui/taiko-web/commit/" + parsed.commit) + versionLink.appendChild(document.createTextNode("taiko-web ver." + parsed.version + " (" + parsed.commit_short + ")")) + } catch(SyntaxError) { + versionLink.setAttribute("href", "https://github.com/bui/taiko-web") + versionLink.appendChild(document.createTextNode("taiko-web (unknown version)")) + } finally { + versionTag.appendChild(versionLink) + } + }) snd.buffer = new SoundBuffer() snd.musicGain = snd.buffer.createGain()