From 5c50d1be986dcdd1c92d1e646f2016ea5b61b900 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 24 Jul 2022 21:16:59 +0200 Subject: Update documentation --- assets/js/ed.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'assets/js/ed.js') 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(); }); -- cgit v1.2.3