Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hypothesis/customized-embedding-example
Customized Embedding - in-progress awesomeness
https://github.com/hypothesis/customized-embedding-example
Last synced: about 1 month ago
JSON representation
Customized Embedding - in-progress awesomeness
- Host: GitHub
- URL: https://github.com/hypothesis/customized-embedding-example
- Owner: hypothesis
- Created: 2015-10-12T19:53:48.000Z (about 9 years ago)
- Default Branch: main
- Last Pushed: 2022-06-02T14:06:35.000Z (over 2 years ago)
- Last Synced: 2024-08-01T12:34:41.361Z (4 months ago)
- Language: JavaScript
- Homepage: http://hypothesis.github.io/customized-embedding-example
- Size: 4.88 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-starred - hypothesis/customized-embedding-example - Customized Embedding - in-progress awesomeness (others)
README
# Hypothes.is Customized Embedding
**NOTE**: it's early days yet...but promising.
This repo contains an example of our very much in progress customized embedding
options as we explore giving external document viewer authors (et al) the
option to customize how [hypothes.is](http://hypothes.is/) works within their
UI.Checkout Issue [hypothesis/h#2584](https://github.com/hypothesis/h/issues/2584)
for discussion.## (Current) Usage
```javascript
window.hypothesisConfig = function() {
var Annotator = window.Annotator;
function MySidebar(elem, options) {
var self = this;options.showHighlights = true;
Annotator.Host.call(this, elem, options);
self._areHighlightsShowing = options.showHighlights;
self.on('panelReady', function() {
var a_highlights = document.createElement('button');
a_highlights.innerHTML = 'toggle highlights';
a_highlights.onclick = function() {
self._areHighlightsShowing = !self._areHighlightsShowing;
self.setVisibleHighlights(self._areHighlightsShowing);
};
document.body.insertBefore(a_highlights,
document.body.firstElementChild);
});
}
MySidebar.prototype = Object.create(Annotator.Host.prototype);return {
constructor: MySidebar,
}
};
```Obviously do something more useful.
Reference
[`Annotator.Host`](https://github.com/hypothesis/h/blob/master/h/static/scripts/annotator/host.coffee)
and
[`Annotator.Sidebar`](https://github.com/hypothesis/h/blob/master/h/static/scripts/annotator/sidebar.coffee)
in the `h` repo for more info.# License
BSD