Skip to content

Instantly share code, notes, and snippets.

@zahqresh
Created July 19, 2021 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zahqresh/e81234587ee15f9be59847f8d4b07a41 to your computer and use it in GitHub Desktop.
Save zahqresh/e81234587ee15f9be59847f8d4b07a41 to your computer and use it in GitHub Desktop.
//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