diff --git a/api/random_repo.php b/api/random_repo.php new file mode 100644 index 0000000..f45c85f --- /dev/null +++ b/api/random_repo.php @@ -0,0 +1,6 @@ +data; + $repo = $repos[array_rand($repos)]; + header("Location: $repo->html_url"); + diff --git a/assets/script/navigation.js b/assets/script/navigation.js index 14298c1..7e4cf8c 100644 --- a/assets/script/navigation.js +++ b/assets/script/navigation.js @@ -3,65 +3,66 @@ window.addEventListener("load", makeLinksDynamic, false); function makeLinksDynamic() { - var navLinks = document.getElementsByClassName("nav-button"); - for (var i = 0; i < navLinks.length; i++) { - navLinks[i].onclick = function(e) { + var navLinks = document.getElementsByClassName("js-link"); + for (var i = 0; i < navLinks.length; i++) { + navLinks[i].onclick = function(e) { - var event = e || window.event; - var target = event.target || event.srcElement; + var event = e || window.event; + var target = event.target || event.srcElement; - if (target.nodeName !== "A" || event.ctrlKey || document.body.className.indexOf("loading") !== -1) return; + if (target.nodeName !== "A" || event.ctrlKey || document.body.className.indexOf("loading") !== -1) return; - loadUrl(target.href, function() { - if (window.history && history.pushState) { - history.pushState(null, "", target.href); - } - }); + loadUrl(target.href, function() { + if (window.history && history.pushState) { + history.pushState(null, "", target.href); + } + }); - event.preventDefault(); - event.returnValue = false; + event.preventDefault(); + event.returnValue = false; - } - } + } + } } window.addEventListener("popstate", function() { - loadUrl(location.href); + loadUrl(location.href); }, false); function loadUrl(href, callback) { - document.body.className += " loading"; + document.body.className += " loading"; - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() { - if (this.readyState === 4) { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (this.readyState === 4) { - if (this.status !== 200) location.href = href; + if (this.status !== 200) location.href = href; - try { - var tags = ["main", "nav"]; - for (var i = 0; i < tags.length; i++) { - document.querySelector(tags[i]).innerHTML = this.responseText.match(new RegExp("<" + tags[i] + ">([\\s\\S]+)<\\/" + tags[i] + ">"))[1]; - } - } catch(e) { - location.href = href; - } + try { + var tags = ["main", "nav", "aside", "footer"]; + for (var i = 0; i < tags.length; i++) { + document.querySelector(tags[i]).innerHTML = this.responseText.match(new RegExp("<" + tags[i] + ">([\\s\\S]*)<\\/" + tags[i] + ">"))[1]; + } + } catch(e) { + console.error(e); + location.href = href; + } - // Dispatch load event - var loadEvent = document.createEvent('Event'); - loadEvent.initEvent('load', false, false); - window.dispatchEvent(loadEvent); + // Dispatch load event + var loadEvent = document.createEvent('Event'); + loadEvent.initEvent('load', false, false); + window.dispatchEvent(loadEvent); - if (callback) callback(); + if (callback) callback(); - document.body.className = document.body.className.replace(/\s*loading/g, ""); + document.body.className = document.body.className.replace(/\s*loading/g, ""); - } - } - xhr.open("GET", href); - xhr.send(); + } + } + xhr.open("GET", href); + xhr.send(); } diff --git a/assets/style/dark-mode.css b/assets/style/dark-mode.css index 5b00465..a28090d 100644 --- a/assets/style/dark-mode.css +++ b/assets/style/dark-mode.css @@ -77,3 +77,11 @@ body { display: none !important; } +#typeracer-badge { + filter: grayscale() invert(); +} + +#view-background { + color: rgba(255, 255, 255, 0.3); +} + diff --git a/assets/style/light-mode.css b/assets/style/light-mode.css index ea772db..5eea574 100644 --- a/assets/style/light-mode.css +++ b/assets/style/light-mode.css @@ -77,3 +77,7 @@ body { display: none !important; } +#view-background { + color: rgba(0, 0, 0, 0.3); +} + diff --git a/assets/style/main.css b/assets/style/main.css index 56f757f..853d727 100644 --- a/assets/style/main.css +++ b/assets/style/main.css @@ -8,7 +8,7 @@ body { position: fixed; width: 100%; width: 100vw; - height: 100vh; + max-height: 100vh; font-family: Arial, sans-serif; /* Prevent user from selecting whitespace between containers */ user-select: none; @@ -242,6 +242,13 @@ h1, h2 { image-rendering: pixelated; } +#view-background { + display: inline-block; + font-size: 0.6em; + text-decoration: none; + margin-bottom: 15px; +} + /* Fixes */ /* IE 9-11 has a bug which makes the ch css unit unusable, this will make it use the inputs size attribute instead */ @@ -265,3 +272,4 @@ object { img { border: none; /* Fix ico images on internet explorer */ } + diff --git a/background/index.php b/background/index.php index df25c87..44fa5e3 100644 --- a/background/index.php +++ b/background/index.php @@ -4,6 +4,15 @@
+ + + +