cosmic/templates/webheader.tmpl
James Tomasino 3e0b2c3f2d
Some checks reported errors
continuous-integration/drone/push Build encountered an error
who cares about ie?
2019-10-31 16:54:01 +00:00

49 lines
1.8 KiB
Cheetah

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=edge">
<meta name=viewport content="shrink-to-fit=no,width=device-width,height=device-height,initial-scale=1,user-scalable=1">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<meta name="msapplication-TileColor" content="#00a300">
<meta name="theme-color" content="#ffffff">
<!-- Rocket favicon by Adrien Coquet from the Noun Project -->
<!-- I'm sorry you have to see JavaScript on this site, but it's here to
enable a manual dark mode toggle. When dark mode support improves I
can probably remove this again. -->
<script type="text/javascript">
var params = new URLSearchParams(window.location.search)
function setMode(mode, val) {
if (val) document.body.classList.add(mode)
else document.body.classList.remove(mode)
Array.from(document.querySelectorAll('a'))
.filter( el => el.href.indexOf('cosmic.voyage') !== -1)
.map( el => {
var url = el.href
var p = url.indexOf('?') !== -1 ? url.substr(url.indexOf('?')) : ''
var baseURL = url.split('?')[0]
const params = new URLSearchParams(p)
if (val) {
params.append(mode, 1)
} else {
params.delete(mode)
}
p = params.toString()
el.href = baseURL + (p ? '?' + p : '')
})
}
window.addEventListener('DOMContentLoaded', function() {
if (params.has('dark')) {
setMode('dark', true)
} else if (params.has('light')) {
setMode('light', true)
}
})
</script>