mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
Update Hypothes.is integration.
This commit is contained in:
parent
3e88ee40af
commit
bcd32ce6ce
4 changed files with 18 additions and 20 deletions
|
@ -53,6 +53,9 @@
|
|||
<script src="../hooks/extensions/highlight.js"></script>
|
||||
|
||||
<!-- Hypothes.is -->
|
||||
<!-- Hypothes.is -->
|
||||
<!-- // <script src="https://hypothes.is/app/embed.js?role=host"></script> -->
|
||||
|
||||
<!-- <script src="https://static.hypothes.is/lib/jquery-21.10.2.min.js"</script>-->
|
||||
<script src="https://static.hypothes.is/lib/jquery.scrollintoview.min.js"></script>
|
||||
<script src="https://static.hypothes.is/lib/jquery.ui.widget.min.js"></script>
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
EPUBJS.Hooks.register("beforeChapterDisplay").example = function(callback, chapter){
|
||||
EpubGuest = function (element, options) {
|
||||
return new Annotator.Guest(element, options);
|
||||
}
|
||||
|
||||
window.hypothesisRole = EpubGuest;
|
||||
|
||||
var s = document.createElement("script");
|
||||
s.type = 'text/javascript';
|
||||
s.src ="https://test.hypothes.is/app/embed.js"
|
||||
|
||||
chapter.doc.body.appendChild(s);
|
||||
|
||||
//-- Continue to other hooks
|
||||
if(callback) callback();}
|
||||
window.hypothesisConfig = function () {
|
||||
return {};
|
||||
};
|
||||
|
|
|
@ -14,7 +14,9 @@ EPUBJS.Hooks.register("beforeChapterDisplay").hypothesis = function(callback, re
|
|||
|
||||
if(!renderer) return;
|
||||
|
||||
EPUBJS.core.addScript("https://hypothes.is/app/embed.js?role=guest&light=true", null, renderer.doc.head);
|
||||
EPUBJS.core.addScript("/hooks/extensions/embedh.js", null, renderer.doc.head);
|
||||
|
||||
EPUBJS.core.addScript("https://hypothes.is/embed.js", null, renderer.doc.head);
|
||||
|
||||
EPUBJS.core.addCss( cssPath + "annotations.css", null, renderer.doc.head);
|
||||
|
||||
|
|
|
@ -37,12 +37,7 @@ EPUBJS.reader.plugins.HypothesisController = function(Book) {
|
|||
};
|
||||
|
||||
var attach = function(){
|
||||
|
||||
annotator = window.annotator = new window.Annotator.Host(body, {
|
||||
"app": "https://hypothes.is/app/",
|
||||
"Toolbar": {container:"#annotator-toolbar"}
|
||||
});
|
||||
|
||||
annotator = window.annotator;
|
||||
annotator.frame.appendTo(element);
|
||||
|
||||
annotator.subscribe('annotationEditorShown', function () {
|
||||
|
@ -83,7 +78,7 @@ EPUBJS.reader.plugins.HypothesisController = function(Book) {
|
|||
reader.book.on("renderer:locationChanged", function(){
|
||||
updateAnnotations();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
var showAnnotations = function(single) {
|
||||
|
@ -106,9 +101,9 @@ EPUBJS.reader.plugins.HypothesisController = function(Book) {
|
|||
|
||||
book.ready.all.then(function() {
|
||||
reader.HypothesisController.attach();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return {
|
||||
"attach" : attach
|
||||
'attach': attach
|
||||
};
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue