From 18e632aa19f49c1c5750e44d028182dbe18de0b2 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 24 Jul 2022 20:23:23 +0200 Subject: Provide annotation support --- assets/js/ed.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'assets/js/ed.js') diff --git a/assets/js/ed.js b/assets/js/ed.js index dbea865..19b2c96 100644 --- a/assets/js/ed.js +++ b/assets/js/ed.js @@ -11,4 +11,15 @@ document.addEventListener('DOMContentLoaded', function () { if (topAnchor !== null) { intersectionObserver.observe(topAnchor); } + + // Annotation support + const hypothesisContainer = document.querySelector('.hypothesis-container'); + if (hypothesisContainer !== null) { + hypothesisContainer.addEventListener('click', () => { + let script = document.createElement('script'); + script.setAttribute('src', 'https://hypothes.is/embed.js'); + script.type = 'text/javascript'; + document.getElementsByTagName('head')[0].appendChild(script); + }); + } }); -- cgit v1.2.3