diff options
| -rw-r--r-- | assets/js/ed.js | 11 | ||||
| -rw-r--r-- | assets/js/ga.js | 7 | ||||
| -rw-r--r-- | assets/sass/_customize.scss | 4 | ||||
| -rw-r--r-- | i18n/en.toml | 3 | ||||
| -rw-r--r-- | i18n/ru.toml | 3 | ||||
| -rw-r--r-- | layouts/partials/sidebar.html | 6 | ||||
| -rw-r--r-- | resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content | 3 |
7 files changed, 36 insertions, 1 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; +} diff --git a/i18n/en.toml b/i18n/en.toml index eb86647..2f44e07 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -69,3 +69,6 @@ [back_to_top_label] other = 'Back to top of the page' + +[annotate] + other = 'Annotate me' diff --git a/i18n/ru.toml b/i18n/ru.toml index 1920721..6a782ef 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -69,3 +69,6 @@ [back_to_top_label] other = 'Вернуться в начало страницы' + +[annotate] + other = 'Добавить аннотацию' diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 62c93c5..22c8405 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -22,7 +22,11 @@ </a> {{- end }} - {{- /* TODO: Add hypothesis support */ -}} + <span class="hypothesis-container"> + <a class="sidebar-nav-item" id="hypothesis-link"> + {{ i18n "annotate" }} + </a> + </span> {{- with site.Menus.feeds }} <div class="sidebar-nav-item"> diff --git a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content index bffa49d..72c8a9e 100644 --- a/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content +++ b/resources/_gen/assets/scss/sass/style.scss_f300667da4f5b5f84e1a9e0702b2fdde.content @@ -1126,6 +1126,9 @@ ul.tags-cloud { -ms-clip-path: inset(50%); clip-path: inset(50%); } +.hypothesis-container { + cursor: pointer; } + /* Themes */ /* Red */ .theme-base-red .post-tags a { |
