# HG changeset patch # User robcast # Date 1394812078 -3600 # Node ID f4fb3482f116fc4c1e5c9a98f18762c32f16e673 # Parent 98265aa699297c24856b0e17662a6cebaac4d457 authentication for annotator plugin works now. diff -r 98265aa69929 -r f4fb3482f116 README.md --- a/README.md Thu Mar 13 16:52:25 2014 +0100 +++ b/README.md Fri Mar 14 16:47:58 2014 +0100 @@ -1,4 +1,4 @@ -digilib - the Digital Image Library +digilib - The Digital Image Library =================================== A versatile image viewing environment for the internet. diff -r 98265aa69929 -r f4fb3482f116 webapp/src/main/webapp/jquery/annotator-dl.js --- a/webapp/src/main/webapp/jquery/annotator-dl.js Thu Mar 13 16:52:25 2014 +0100 +++ b/webapp/src/main/webapp/jquery/annotator-dl.js Fri Mar 14 16:47:58 2014 +0100 @@ -1,12 +1,12 @@ /* -** Annotator v2.0.0-dev-5b27640 +** Annotator v2.0.0-dev-e25ce72 ** https://github.com/okfn/annotator/ ** ** Copyright 2014, the Annotator project contributors. ** Dual licensed under the MIT and GPLv3 licenses. ** https://github.com/okfn/annotator/blob/master/LICENSE ** -** Built at: 2014-03-13 15:20:20Z +** Built at: 2014-03-14 15:39:01Z */ !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.Annotator=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;oo;o++)if(e.call(n,t[o],o,t)===s)return}else for(var i in t)if(this.has(t,i)&&e.call(n,t[i],i,t)===s)return},once:function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}}}}var r,i=this,s={},a=Array.prototype.forEach,u=Object.prototype.hasOwnProperty,l=Array.prototype.slice,h=0,p=e();r={on:function(t,e,n){if(!d(this,"on",t,[e,n])||!e)return this;this._events||(this._events={});var o=this._events[t]||(this._events[t]=[]);return o.push({callback:e,context:n,ctx:n||this}),this},once:function(t,e,n){if(!d(this,"once",t,[e,n])||!e)return this;var o=this,r=p.once(function(){o.off(t,r),e.apply(this,arguments)});return r._callback=e,this.on(t,r,n)},off:function(t,e,n){var o,r,i,s,a,u,l,h;if(!this._events||!d(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events={},this;for(s=t?[t]:p.keys(this._events),a=0,u=s.length;u>a;a++)if(t=s[a],i=this._events[t]){if(this._events[t]=o=[],e||n)for(l=0,h=i.length;h>l;l++)r=i[l],(e&&e!==r.callback&&e!==r.callback._callback||n&&n!==r.context)&&o.push(r);o.length||delete this._events[t]}return this},trigger:function(t){if(!this._events)return this;var e=l.call(arguments,1);if(!d(this,"trigger",t,e))return this;var n=this._events[t],o=this._events.all;return n&&f(n,e),o&&f(o,arguments),this},stopListening:function(t,e,n){var o=this._listeners;if(!o)return this;var r=!e&&!n;"object"==typeof e&&(n=this),t&&((o={})[t._listenerId]=t);for(var i in o)o[i].off(e,n,this),r&&delete this._listeners[i];return this}};var c=/\s+/,d=function(t,e,n,o){if(!n)return!0;if("object"==typeof n){for(var r in n)t[e].apply(t,[r,n[r]].concat(o));return!1}if(c.test(n)){for(var i=n.split(c),s=0,a=i.length;a>s;s++)t[e].apply(t,[i[s]].concat(o));return!1}return!0},f=function(t,e){var n,o=-1,r=t.length,i=e[0],s=e[1],a=e[2];switch(e.length){case 0:for(;++o",wrapper:'
'},e.prototype.options={store:null,readOnly:!1,loadQuery:{}},e.prototype.plugins={},e.prototype.editor=null,e.prototype.viewer=null,e.prototype.selectedRanges=null,e.prototype.mouseIsDown=!1,e.prototype.ignoreMouseup=!1,e.prototype.viewerHideTimer=null,e.extend=c,e.prototype._setupWrapper=function(){return this.wrapper=$(this.html.wrapper),this.element.find("script").remove(),this.element.wrapInner(this.wrapper),this.wrapper=this.element.find(".annotator-wrapper"),this},e.prototype._setupViewer=function(){return this.viewer=new e.Viewer({readOnly:this.options.readOnly}),this.viewer.hide().on("edit",this.onEditAnnotation).on("delete",function(t){return function(e){return t.viewer.hide(),t.publish("beforeAnnotationDeleted",[e]),t.cleanupAnnotation(e),t.annotations["delete"](e).done(function(){return t.publish("annotationDeleted",[e])})}}(this)).addField({load:function(t){return function(e,n){return $(e).html(n.text?l.escape(n.text):""+v("No Comment")+""),t.publish("annotationViewerTextField",[e,n])}}(this)}).element.appendTo(this.wrapper).bind({mouseover:this.clearViewerHideTimer,mouseout:this.startViewerHideTimer}),this},e.prototype._setupEditor=function(){return this.editor=new e.Editor,this.editor.hide().on("hide",this.onEditorHide).on("save",this.onEditorSubmit).addField({type:"textarea",label:v("Comments")+"…",load:function(t,e){return $(t).find("textarea").val(e.text||"")},submit:function(t,e){return e.text=$(t).find("textarea").val()}}),this.editor.element.appendTo(this.wrapper),this},e.prototype._setupDocumentEvents=function(){return $(document).bind({mouseup:this.checkForEndSelection,mousedown:this.checkForStartSelection}),this},e.prototype._setupDynamicStyle=function(){var t,e,n,o;return n=$("#annotator-dynamic-style"),n.length||(n=$('').appendTo(document.head)),e="*"+function(){var t,e,n,r;for(n=["adder","outer","notice","filter"],r=[],t=0,e=n.length;e>t;t++)o=n[t],r.push(":not(.annotator-"+o+")");return r}().join(""),t=l.maxZIndex($(document.body).find(e)),t=Math.max(t,1e3),n.text([".annotator-adder, .annotator-outer, .annotator-notice {"," z-index: "+(t+20)+";","}",".annotator-filter {"," z-index: "+(t+10)+";","}"].join("\n")),this},e.prototype.load=function(t){return this.annotations.load(t).then(function(t){return function(e){return t.loadAnnotations(e)}}(this))},e.prototype.destroy=function(){var t,n,o,r;$(document).unbind({mouseup:this.checkForEndSelection,mousedown:this.checkForStartSelection}),$("#annotator-dynamic-style").remove(),this.adder.remove(),this.viewer.destroy(),this.editor.destroy(),this.wrapper.find(".annotator-hl").each(function(){return $(this).contents().insertBefore(this),$(this).remove()}),this.wrapper.contents().insertBefore(this.wrapper),this.wrapper.remove(),this.element.data("annotator",null),r=this.plugins;for(n in r)o=r[n],this.plugins[n].destroy();return this.removeEvents(),t=e._instances.indexOf(this),-1!==t?e._instances.splice(t,1):void 0},e.prototype.getSelectedRanges=function(){var t,e,n,o,r,i,s,u,h;for(s=l.getGlobal().getSelection(),r=[],i=[],s.isCollapsed||(r=function(){var r,u,l;for(l=[],e=r=0,u=s.rangeCount;u>=0?u>r:r>u;e=u>=0?++r:--r)o=s.getRangeAt(e),t=new a.BrowserRange(o),n=t.normalize().limit(this.wrapper[0]),null===n&&i.push(o),l.push(n);return l}.call(this),s.removeAllRanges()),u=0,h=i.length;h>u;u++)o=i[u],s.addRange(o);return $.grep(r,function(t){return t&&s.addRange(t.toRange()),t})},e.prototype.setupAnnotation=function(t){var e,n,o,r,i,s,u,l,h,p;for(i=this.wrapper[0],o=[],p=t.ranges,s=0,l=p.length;l>s;s++){r=p[s];try{o.push(a.sniff(r).normalize(i))}catch(c){if(e=c,!(e instanceof a.RangeError))throw e;this.publish("rangeNormalizeFail",[t,r,e])}}for(t.quote=[],t.ranges=[],t._local={},t._local.highlights=[],u=0,h=o.length;h>u;u++)n=o[u],t.quote.push($.trim(n.text())),t.ranges.push(n.serialize(this.wrapper[0],".annotator-hl")),$.merge(t._local.highlights,this.highlightRange(n));return t.quote=t.quote.join(" / "),$(t._local.highlights).data("annotation",t),t},e.prototype.cleanupAnnotation=function(t){var e,n,o,r,i;if(null!=(null!=(r=t._local)?r.highlights:void 0)){for(i=t._local.highlights,n=0,o=i.length;o>n;n++)e=i[n],null!=e.parentNode&&$(e).replaceWith(e.childNodes);delete t._local.highlights}return t},e.prototype.loadAnnotations=function(t){var e,n;return null==t&&(t=[]),n=function(t){return function(o){var r,i,s,a;for(null==o&&(o=[]),i=o.splice(0,10),s=0,a=i.length;a>s;s++)r=i[s],t.setupAnnotation(r);return o.length>0?setTimeout(function(){return n(o)},10):t.publish("annotationsLoaded",[e])}}(this),e=t.slice(),n(t),this},e.prototype.dumpAnnotations=function(){return this.plugins.Store?this.plugins.Store.dumpAnnotations():(console.warn(v("Can't dump annotations without Store plugin.")),!1)},e.prototype.highlightRange=function(t,e){var n,o,r,i,s,a,u;for(null==e&&(e="annotator-hl"),r=/^\s*$/,n=$(""),a=t.textNodes(),u=[],i=0,s=a.length;s>i;i++)o=a[i],r.test(o.nodeValue)||u.push($(o).wrapAll(n).parent().show()[0]);return u},e.prototype.highlightRanges=function(t,e){var n,o,r,i;for(null==e&&(e="annotator-hl"),n=[],r=0,i=t.length;i>r;r++)o=t[r],$.merge(n,this.highlightRange(o,e));return n},e.prototype.addPlugin=function(t,n){var o,r;return this.plugins[t]?console.error(v("You cannot have more than one instance of any plugin.")):(o=e.Plugin[t],"function"==typeof o?(this.plugins[t]=new o(this.element[0],n),this.plugins[t].annotator=this,"function"==typeof(r=this.plugins[t]).pluginInit&&r.pluginInit()):console.error(v("Could not load ")+t+v(" plugin. Have you included the appropriate