summaryrefslogtreecommitdiffstats
path: root/assets/js
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-07-24 21:16:59 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-07-24 21:16:59 +0200
commit5c50d1be986dcdd1c92d1e646f2016ea5b61b900 (patch)
treefcf1b0b8f868f8b5e0fb2d349eff447b5b27705f /assets/js
parentf455db5d6f8aaf17f6a80ad69ef84750583ce121 (diff)
downloadgohugo-theme-ed-5c50d1be986dcdd1c92d1e646f2016ea5b61b900.tar.gz
Update documentation
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/ed.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/assets/js/ed.js b/assets/js/ed.js
index e3b844a..60c45ee 100644
--- a/assets/js/ed.js
+++ b/assets/js/ed.js
@@ -1,5 +1,5 @@
-document.addEventListener('DOMContentLoaded', function () {
- // 'Back to top' logic
+// 'Back to top' logic
+function setupBackToTop() {
const intersectionObserver = new IntersectionObserver(function(entries) {
const topBtn = document.querySelector('.top-of-site-link');
if (topBtn === null) return;
@@ -11,8 +11,10 @@ document.addEventListener('DOMContentLoaded', function () {
if (topAnchor !== null) {
intersectionObserver.observe(topAnchor);
}
+}
- // Annotation support
+// Annotation support
+function setupHypothes() {
const hypothesisContainer = document.querySelector('.hypothesis-container');
if (hypothesisContainer !== null) {
hypothesisContainer.addEventListener('click', (e) => {
@@ -31,4 +33,9 @@ document.addEventListener('DOMContentLoaded', function () {
e.preventDefault();
});
}
+}
+
+document.addEventListener('DOMContentLoaded', function () {
+ setupBackToTop();
+ setupHypothes();
});