gobyexample/public/404.html
2022-12-24 20:01:48 +01:00

69 lines
2.5 KiB
HTML
Generated

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Go by Example: Not Found</title>
<link rel=stylesheet href="site.css">
</head>
<body>
<div id="intro">
<h2><a href="./">Go by Example</a></h2>
<p>Sorry, we couldn't find that! Check out the <a href="./">home page</a>?</p>
<p class="footer">
<script>
window.onload = function() {
function styleAllTags(tag, style, value){
document.querySelectorAll(tag).forEach((tag) => {
tag.style[style] = value
})
}
var themeButton = document.getElementById('theme-button');
var body = document.getElementsByTagName('body')[0];
var lightText = "#ffffffeb";
var darkText = "#252519";
var lightBackground = "white";
var darkBackground = "#1a202c";
var lightCodeBackground = "#f0f0f0";
var darkCodeBackground = "#333333";
function activateTheme(theme) {
if (theme === 'dark') {
body.style.color = lightText;
body.style.backgroundColor = darkBackground;
styleAllTags('a', 'color', lightText)
styleAllTags('td.code', 'background', darkCodeBackground);
styleAllTags('td.code.empty', 'background', darkBackground)
} else {
body.style.color = darkText;
body.style.backgroundColor = lightBackground;
styleAllTags('a', 'color', darkText)
styleAllTags('td.code', 'background', lightCodeBackground)
styleAllTags('td.code.empty', 'background', lightBackground)
}
localStorage.setItem('theme', theme);
}
var currentTheme = localStorage.getItem('theme');
if (currentTheme === 'light' || currentTheme === 'dark') {
activateTheme(currentTheme);
} else {
activateTheme('light');
}
themeButton.onclick = function() {
var newTheme = localStorage.getItem('theme') === 'dark' ? 'light' : 'dark';
activateTheme(newTheme);
}
}
</script>
by <a href="https://markmcgranaghan.com">Mark McGranaghan</a> and <a href="https://eli.thegreenplace.net">Eli Bendersky</a> | <a href="https://github.com/mmcgrana/gobyexample">source</a> | <a href="https://github.com/mmcgrana/gobyexample#license">license</a> | <button id="theme-button">Toggle theme</button>
</p>
</div>
</body>
</html>