Commit 13e5cdcd authored by Aron Carroll's avatar Aron Carroll

Merge pull request #1524 from hypothesis/isolate-bootstrap-js

Rework application bootstrap.
parents 4abf518a 8466608e
var Klass = window.Annotator.Host;
var docs = 'https://github.com/hypothesis/h/blob/master/README.rst#customized-embedding';
var options = {
app: jQuery('link[type="application/annotator+html"]').attr('href'),
Heatmap: {container: '.annotator-frame'},
Toolbar: {container: '.annotator-frame'}
};
if (window.hasOwnProperty('hypothesisRole')) {
if (typeof window.hypothesisRole === 'function') {
Klass = window.hypothesisRole;
} else {
throw new TypeError('hypothesisRole must be a constructor function, see: ' + docs);
}
}
if (window.hasOwnProperty('hypothesisConfig')) {
if (typeof window.hypothesisConfig === 'function') {
options = window.hypothesisConfig();
} else {
throw new TypeError('hypothesisConfig must be a function, see: ' + docs);
}
}
window.annotator = new Klass(document.body, options);
window.Annotator.noConflict().$.noConflict(true);
if (window.annotator) window.annotator.destroy();
delete window.annotator;
delete window.DomTextMapper;
delete window.DomTextMatcher;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment