aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2024-02-24 18:33:47 -0500
committertdro <tdro@noreply.example.com>2024-02-24 18:33:47 -0500
commite68fb9110dde654d5a830a110d20694352b6eaca (patch)
tree607b3040d0e85d5a8bba444fdd6890cf39006ebe
parent0681f6d1d7cff09835bb9ade250fbb490e3ede28 (diff)
downloadcanory-e68fb9110dde654d5a830a110d20694352b6eaca.tar.gz
canory-e68fb9110dde654d5a830a110d20694352b6eaca.tar.bz2
canory-e68fb9110dde654d5a830a110d20694352b6eaca.zip
themes/default/layouts/_default/home.xslt: Add scripts
-rw-r--r--assets/js/index.js2
-rw-r--r--static/js/fixedsearch.ts2
-rw-r--r--static/js/update.ts2
-rw-r--r--themes/default/layouts/_default/home.xslt.rss.xsl3
-rw-r--r--themes/default/layouts/_default/home.xslt.sitemap.xsl3
5 files changed, 10 insertions, 2 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index e1526d8..cc23d2c 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -118,6 +118,7 @@
const modified = Date.parse(document.lastModified) !== Date.parse(remote);
const drift = Date.parse(remote || local) - Date.parse(local);
let indicator = document.querySelector("a[data-update]");
+ if (indicator === null) return;
indicator.cloneNode();
if (drift === 0) return;
if (remote && modified) {
@@ -422,6 +423,7 @@
}));
}
let selected;
+ if (submit === null) return;
submit.addEventListener("click", function(event) {
if (selected) {
event.preventDefault();
diff --git a/static/js/fixedsearch.ts b/static/js/fixedsearch.ts
index 01dd917..f933dd7 100644
--- a/static/js/fixedsearch.ts
+++ b/static/js/fixedsearch.ts
@@ -42,6 +42,8 @@
let selected;
+ if (submit === null) return;
+
submit.addEventListener("click", function (event) {
if (selected) {
event.preventDefault();
diff --git a/static/js/update.ts b/static/js/update.ts
index 94a509a..27b13b5 100644
--- a/static/js/update.ts
+++ b/static/js/update.ts
@@ -20,7 +20,9 @@
const remote = request.getResponseHeader("last-modified") || '';
const modified = Date.parse(document.lastModified) !== Date.parse(remote);
const drift = Date.parse(remote || local) - Date.parse(local);
+
let indicator = document.querySelector("a[data-update]");
+ if (indicator === null) return;
const anchor = indicator.cloneNode();
function reset() {
diff --git a/themes/default/layouts/_default/home.xslt.rss.xsl b/themes/default/layouts/_default/home.xslt.rss.xsl
index 1bde28d..af7bb63 100644
--- a/themes/default/layouts/_default/home.xslt.rss.xsl
+++ b/themes/default/layouts/_default/home.xslt.rss.xsl
@@ -14,13 +14,14 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
{{- partial "head-css.html" . -}}
+ {{- partial "head-js.html" . -}}
</head>
<body>
<column-base position="left"></column-base>
<column-base position="middle">
<nav>
<icon-button>
- <a onclick="window.history.go(-1); return false;">
+ <a id="back" target="_self">
<xsl:choose>
<xsl:when test="/rss/channel/atom:link[@rel='previous']/@href">
<xsl:attribute name="href">
diff --git a/themes/default/layouts/_default/home.xslt.sitemap.xsl b/themes/default/layouts/_default/home.xslt.sitemap.xsl
index 335ce09..e0be723 100644
--- a/themes/default/layouts/_default/home.xslt.sitemap.xsl
+++ b/themes/default/layouts/_default/home.xslt.sitemap.xsl
@@ -12,13 +12,14 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
{{- partial "head-css.html" . -}}
+ {{- partial "head-js.html" . -}}
</head>
<body>
<column-base position="left"></column-base>
<column-base position="middle">
<nav>
<icon-button>
- <a onclick="window.history.go(-1); return false;" href="/">
+ <a id="back" target="_self" href="/">
{{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }}
<small>Back</small>
</a>