summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-07-24 20:23:23 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-07-24 20:23:23 +0200
commit18e632aa19f49c1c5750e44d028182dbe18de0b2 (patch)
tree0898456b96b4e274ffd6986fc15c331a8a5e52c1 /assets
parent2db1f9cea249c5b103caeda37f8f27690d5b2774 (diff)
downloadgohugo-theme-ed-18e632aa19f49c1c5750e44d028182dbe18de0b2.tar.gz
Provide annotation support
Diffstat (limited to 'assets')
-rw-r--r--assets/js/ed.js11
-rw-r--r--assets/js/ga.js7
-rw-r--r--assets/sass/_customize.scss4
3 files changed, 22 insertions, 0 deletions
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);
+ });
+ }
});
diff --git a/assets/js/ga.js b/assets/js/ga.js
index f2c6cbe..c7a174c 100644
--- a/assets/js/ga.js
+++ b/assets/js/ga.js
@@ -69,6 +69,13 @@ function onClickCallback(event) {
// Track menu show
if (className === 'sidebar-toggle') {
trackInternalEvent('Sidebar Toggle', 'navigation');
+ return;
+ }
+
+ // Track annotation usage
+ if (className === 'hypothesis-container') {
+ trackInternalEvent('Annotation open', 'navigation');
+ return;
}
// Track feeds click
diff --git a/assets/sass/_customize.scss b/assets/sass/_customize.scss
index 06de02a..85dd213 100644
--- a/assets/sass/_customize.scss
+++ b/assets/sass/_customize.scss
@@ -281,3 +281,7 @@ ul.tags-cloud {
.screen-reader-text {
@include visually-hidden();
}
+
+.hypothesis-container {
+ cursor: pointer;
+}