aboutsummaryrefslogtreecommitdiffstats
path: root/src/assets
diff options
context:
space:
mode:
Diffstat (limited to 'src/assets')
-rw-r--r--src/assets/index.css73
-rw-r--r--src/assets/sw.11tydata.js3
-rw-r--r--src/assets/sw.mjs14
3 files changed, 82 insertions, 8 deletions
diff --git a/src/assets/index.css b/src/assets/index.css
new file mode 100644
index 0000000..7984af2
--- /dev/null
+++ b/src/assets/index.css
@@ -0,0 +1,73 @@
+:root {
+ font-family: serif;
+}
+
+@media screen {
+ body {
+ max-width: 920px;
+ min-height: 98vh;
+ display: flex;
+ flex-direction: column;
+ margin: auto;
+ padding: 0.5rem;
+ }
+ main {
+ flex-grow: 1;
+ }
+ :any-link {
+ color: inherit;
+ text-decoration: underline;
+ }
+ :any-link:hover,
+ :any-link:active {
+ font-style: italic;
+ }
+ #menu {
+ background: darkred;
+ text-decoration: none;
+ font-weight: bold;
+ color: white;
+ padding: 1rem;
+ font-size: 1rem;
+ }
+ @media (max-width: 450px) {
+ #menu a {
+ display: block;
+ text-align: center;
+ margin: auto;
+ padding: 20px;
+ }
+ }
+ #menu :any-link {
+ text-decoration: none;
+ margin-right: 1rem;
+ padding-left: 0rem;
+ padding-right: 0rem;
+ }
+ #menu :any-link:hover {
+ text-decoration: none;
+ }
+ .err {
+ color: darkred;
+ }
+ @media (prefers-color-scheme: dark) {
+ :root {
+ background: black;
+ color: white;
+ }
+ #menu nav {
+ background: red;
+ }
+ .err {
+ color: red;
+ }
+ }
+}
+
+@media print {
+ header,
+ nav,
+ footer {
+ display: none;
+ }
+} \ No newline at end of file
diff --git a/src/assets/sw.11tydata.js b/src/assets/sw.11tydata.js
index 3f89dbf..4a20677 100644
--- a/src/assets/sw.11tydata.js
+++ b/src/assets/sw.11tydata.js
@@ -1,3 +1,4 @@
module.exports = {
- "permalink": "/sw.js"
+ dynamicPermalink: false,
+ permalink: "/sw.js"
} \ No newline at end of file
diff --git a/src/assets/sw.mjs b/src/assets/sw.mjs
index 432e630..88bf684 100644
--- a/src/assets/sw.mjs
+++ b/src/assets/sw.mjs
@@ -2,7 +2,7 @@ const cache_name = "v3"
const install_sw = async event => {
const precache = async() => {
- const cache = await caches.open(cache_name);
+ const cache = await window.caches.open(cache_name);
return cache.addAll([
'/index.css',
'/prism.css',
@@ -20,11 +20,11 @@ const activate_sw = async event => {
const cachepreserve = ['v3'];
const invalidatecache = async() => {
- const keys = await caches.keys()
+ const keys = await window.caches.keys()
Promise.all(
keys.map((key) => {
if (cachepreserve.indexOf(key) === -1) {
- return caches.delete(key)
+ return window.caches.delete(key)
}
}))
}
@@ -36,17 +36,17 @@ const fetch_sw = async event => {
if (event.request.method != 'GET') {
return
}
- const cacheres = await caches.match(event.request)
+ const cacheres = await window.caches.match(event.request)
if (cacheres !== undefined) {
return cacheres
}
try {
- const response = await fetch(event.request)
- const cache = await caches.open(cache_name)
+ const response = await window.fetch(event.request)
+ const cache = await window.caches.open(cache_name)
cache.put(event.request, response.clone())
return response
} catch {
- return caches.match('/offline.html')
+ return window.caches.match('/offline.html')
}
}