Created
July 19, 2021 04:18
-
-
Save zahqresh/e81234587ee15f9be59847f8d4b07a41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Our custom function to add uri into annotations | |
var pageUri = function () { | |
return { | |
beforeAnnotationCreated: function (ann) { | |
ann.uri = window.location.href; | |
} | |
}; | |
}; | |
//Init Annotatorjs | |
var app = new annotator.App() | |
//Include Annotatorjs UI | |
.include(annotator.ui.main, { | |
element: document.body | |
}) | |
//storage Plugin | |
.include(annotator.storage.http, { | |
prefix: "https://localhost:3000/api", | |
//URLs to use in the Annotatorjs for crud opertations of API | |
urls: { | |
create: `/annotations/${window.btoa(file_name)}`, | |
search: `/search/${window.btoa(file_name)}` | |
} | |
}) | |
.include(pageUri); | |
app.start() | |
.then(function () { | |
app.annotations.load({ | |
uri: window.location.href | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment