import 'lato-font/css/lato-font.css';
import './global.scss';
-/* Shortcuts*/
+/* Shortcuts */
import './js/shortcuts/entry';
import './js/shortcuts/main';
app.registry.registerUtility(authorization, 'authorizationPolicy');
const x = JSON.parse($('#annotationroutes').html());
- app.include(annotator.storage.http, x);
+ app.include(annotator.storage.http, $.extend({}, x, {
+ onError(msg, xhr) {
+ if (!Object.prototype.hasOwnProperty.call(xhr, 'responseJSON')) {
+ annotator.notification.banner('An error occurred', 'error');
+ return;
+ }
+ $.each(xhr.responseJSON.children, (k, v) => {
+ if (v.errors) {
+ $.each(v.errors, (n, errorText) => {
+ annotator.notification.banner(errorText, 'error');
+ });
+ }
+ });
+ },
+ }));
app.start().then(() => {
app.annotations.load({ entry: x.entryId });
retrievePercent(x.entryId);
$(window).resize(() => {
- retrievePercent(x.entryId);
+ retrievePercent(x.entryId, true);
});
}
});