diff --git a/examples/hypothesis-spreads.html b/examples/hypothesis-spreads.html
index eff5ee5..67c9376 100644
--- a/examples/hypothesis-spreads.html
+++ b/examples/hypothesis-spreads.html
@@ -20,16 +20,17 @@
-
@@ -235,7 +236,14 @@
var href = window.location.href.slice(loc + 5);
var hash = decodeURIComponent(href);
}
- rendition.display(hash || undefined);
+
+ rendition.display(hash || undefined)
+ .then(function() {
+ var H_EMBED_URL = 'https://hypothes.is/embed.js';
+ var script = document.createElement('script');
+ script.setAttribute('src', H_EMBED_URL);
+ document.head.appendChild(script);
+ });
var next = document.getElementById("next");
@@ -344,12 +352,14 @@
});
+ var tm;
function checkForAnnotator(cb, w) {
if (!w) {
w = window;
}
- setTimeout(function () {
+ tm = setTimeout(function () {
if (w && w.annotator) {
+ clearTimeout(tm);
cb();
} else {
checkForAnnotator(cb, w);
@@ -358,7 +368,6 @@
}
book.rendition.hooks.content.register(function(contents, view) {
-
checkForAnnotator(function () {
var annotator = contents.window.annotator;
@@ -387,41 +396,6 @@
});
- checkForAnnotator(function () {
- var main = document.querySelector('#main');
- var target = document.querySelector('.annotator-frame');
-
-
- if(window.innerWidth < 1400) {
- /*
- window.annotator.on("show", function () {
- main.classList.add("open");
- });
-
- window.annotator.on("hide", function () {
- main.classList.remove("open");
- });
- */
-
- // create an observer instance
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(function(mutation) {
- if (mutation.attributeName === "class") {
- if (target.classList.contains("annotator-collapsed")) {
- main.classList.remove("open");
- } else {
- main.classList.add("open");
- }
- }
- });
- });
-
- observer.observe(target, { attributes: true });
-
- }
-
- });
-