From b59ffe9c07fa36a8c6247b3236f7790d3b5ea198 Mon Sep 17 00:00:00 2001 From: Denis Obydennykh Date: Tue, 27 Oct 2015 09:19:50 +0300 Subject: [PATCH 01/13] removed legacy jquery include --- lib/okfn-annot-injector.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/okfn-annot-injector.php b/lib/okfn-annot-injector.php index 7a6627a..95b981e 100644 --- a/lib/okfn-annot-injector.php +++ b/lib/okfn-annot-injector.php @@ -16,12 +16,14 @@ class OkfnAnnotInjector extends OkfnBase { // of the annotator (A more fine grained control through the settings can be implemented later). 'javascripts' => array( - array( +/* todo deniso import jquery properly + * array( 'file' => 'javascripts/jquery.min.js' ), +*/ array( 'file' => 'javascripts/annotator/annotator-full.min.js', - 'dependencies' => array('json2','jquery'), + 'dependencies' => array('json2',/*'jquery'*/), ), ), @@ -50,7 +52,10 @@ function __construct($factory,$content_policy){ function load_javascript_dependencies(){ wp_enqueue_script('json2'); //deregister the javascript version used by wordpress - wp_deregister_script('jquery'); +/* + * todo deniso import jquery properly + * wp_deregister_script('jquery'); +*/ } /* From 4cc8949cb61e32b84502c1bb6340aa0b9e182755 Mon Sep 17 00:00:00 2001 From: Denis Obydennykh Date: Tue, 27 Oct 2015 09:20:41 +0300 Subject: [PATCH 02/13] updated Annotator - v1.2.10 --- .../annotator/annotator-full.min.js | 22 +++++++++++++++++-- vendor/stylesheets/annotator.min.css | 2 +- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/vendor/javascripts/annotator/annotator-full.min.js b/vendor/javascripts/annotator/annotator-full.min.js index 2562883..5dc2a42 100644 --- a/vendor/javascripts/annotator/annotator-full.min.js +++ b/vendor/javascripts/annotator/annotator-full.min.js @@ -1,2 +1,20 @@ -((function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v=Array.prototype.slice,w=Object.prototype.hasOwnProperty,x=function(a,b){return function(){return a.apply(b,arguments)}},y=function(a,b){function d(){this.constructor=a}for(var c in b)w.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},z=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b1?"["+d+"]":"",e="/"+c.tagName.toLowerCase()+d+e,c=c.parentNode;return e}),c.get()},a.escape=function(a){return a.replace(/&(?!\w+;)/g,"&").replace(//g,">").replace(/"/g,""")},a.fn.escape=function(b){return arguments.length?this.html(a.escape(b)):this.html()},j=["log","debug","info","warn","exception","assert","dir","dirxml","trace","group","groupEnd","groupCollapsed","time","timeEnd","profile","profileEnd","count","clear","table","error","notifyFirebug","firebug","userObjects"];if(typeof console!="undefined"&&console!==null){console.group==null&&(console.group=function(a){return console.log("GROUP: ",a)}),console.groupCollapsed==null&&(console.groupCollapsed=console.group);for(p=0,r=j.length;p0?h.start.splitText(h.startOffset):h.start,h.start===h.end?(h.endOffset-h.startOffsetr;0<=r?g++:g--){if(l[g]!==f[g])break;d.push(l[g])}c=j+d.join("/"),k.commonAncestorContainer=this._nodeFromXPath(c);if(!k.commonAncestorContainer)return console.error(u("Error deserializing range: can't find XPath '")+c+u("'. Is this the right document?")),null;s=["start","end"];for(n=0,p=s.length;n=this[i+"Offset"]){k[i+"Container"]=m,k[i+"Offset"]=this[i+"Offset"]-h;break}h+=m.nodeValue.length}}return(new e.BrowserRange(k)).normalize(b)},b.prototype.serialize=function(a,b){return this.normalize(a).serialize(a,b)},b.prototype.toObject=function(){return{start:this.start,startOffset:this.startOffset,end:this.end,endOffset:this.endOffset}},b}(),m={uuid:function(){var a;return a=0,function(){return a++}}(),getGlobal:function(){return function(){return this}()},mousePosition:function(b,c){var d;return d=a(c).offset(),{top:b.pageY-d.top,left:b.pageX-d.left}},preventEventDefault:function(a){return a!=null?typeof a.preventDefault=="function"?a.preventDefault():void 0:void 0}},n=this.Annotator,b=function(b){function c(b,d){this.onDeleteAnnotation=x(this.onDeleteAnnotation,this),this.onEditAnnotation=x(this.onEditAnnotation,this),this.onAdderClick=x(this.onAdderClick,this),this.onAdderMousedown=x(this.onAdderMousedown,this),this.onHighlightMouseover=x(this.onHighlightMouseover,this),this.checkForEndSelection=x(this.checkForEndSelection,this),this.checkForStartSelection=x(this.checkForStartSelection,this),this.clearViewerHideTimer=x(this.clearViewerHideTimer,this),this.startViewerHideTimer=x(this.startViewerHideTimer,this),this.showViewer=x(this.showViewer,this),this.onEditorSubmit=x(this.onEditorSubmit,this),this.onEditorHide=x(this.onEditorHide,this),this.showEditor=x(this.showEditor,this);var e,f,g;c.__super__.constructor.apply(this,arguments),this.plugins={};if(!c.supported())return this;this.options.readOnly||this._setupDocumentEvents(),this._setupWrapper()._setupViewer()._setupEditor(),g=this.html;for(e in g)f=g[e],e!=="wrapper"&&(this[e]=a(f).appendTo(this.wrapper).hide())}return y(c,b),c.prototype.events={".annotator-adder button click":"onAdderClick",".annotator-adder button mousedown":"onAdderMousedown",".annotator-hl mouseover":"onHighlightMouseover",".annotator-hl mouseout":"startViewerHideTimer"},c.prototype.html={hl:'',adder:'
",wrapper:'
'},c.prototype.options={readOnly:!1},c.prototype.plugins={},c.prototype.editor=null,c.prototype.viewer=null,c.prototype.selectedRanges=null,c.prototype.mouseIsDown=!1,c.prototype.ignoreMouseup=!1,c.prototype.viewerHideTimer=null,c.prototype._setupWrapper=function(){return this.wrapper=a(this.html.wrapper),this.element.find("script").remove(),this.element.wrapInner(this.wrapper),this.wrapper=this.element.find(".annotator-wrapper"),this},c.prototype._setupViewer=function(){var b=this;return this.viewer=new c.Viewer({readOnly:this.options.readOnly}),this.viewer.hide().on("edit",this.onEditAnnotation).on("delete",this.onDeleteAnnotation).addField({load:function(c,d){return d.text?a(c).escape(d.text):a(c).html(""+u("No Comment")+""),b.publish("annotationViewerTextField",[c,d])}}).element.appendTo(this.wrapper).bind({mouseover:this.clearViewerHideTimer,mouseout:this.startViewerHideTimer}),this},c.prototype._setupEditor=function(){return this.editor=new c.Editor,this.editor.hide().on("hide",this.onEditorHide).on("save",this.onEditorSubmit).addField({type:"textarea",label:u("Comments")+"…",load:function(b,c){return a(b).find("textarea").val(c.text||"")},submit:function(b,c){return c.text=a(b).find("textarea").val()}}),this.editor.element.appendTo(this.wrapper),this},c.prototype._setupDocumentEvents=function(){return a(document).bind({mouseup:this.checkForEndSelection,mousedown:this.checkForStartSelection}),this},c.prototype.getSelectedRanges=function(){var b,c,d,f,g,h,i,j,k;i=m.getGlobal().getSelection(),g=[],h=[],i.isCollapsed||(g=function(){var a,g;g=[];for(c=0,a=i.rangeCount;0<=a?ca;0<=a?c++:c--)f=i.getRangeAt(c),b=new e.BrowserRange(f),d=b.normalize().limit(this.wrapper[0]),d===null&&h.push(f),g.push(d);return g}.call(this),i.removeAllRanges());for(j=0,k=h.length;j0?setTimeout(function(){return c(a)},1):d.publish("annotationsLoaded",[b])},b=a.slice(),a.length&&c(a),this},c.prototype.dumpAnnotations=function(){return this.plugins.Store?this.plugins.Store.dumpAnnotations():console.warn(u("Can't dump annotations without Store plugin."))},c.prototype.highlightRange=function(b){var c,d,e,f,g,h;d=/^\s*$/,g=b.textNodes(),h=[];for(e=0,f=g.length;e tag?"))),this},c.prototype.showEditor=function(a,b){return this.editor.element.css(b),this.editor.load(a),this},c.prototype.onEditorHide=function(){return this.publish("annotationEditorHidden",[this.editor]),this.ignoreMouseup=!1},c.prototype.onEditorSubmit=function(a){return this.publish("annotationEditorSubmit",[this.editor,a]),a.ranges===void 0?this.setupAnnotation(a):this.updateAnnotation(a)},c.prototype.showViewer=function(a,b){return this.viewer.element.css(b),this.viewer.load(a),this.publish("annotationViewerShown",[this.viewer,a])},c.prototype.startViewerHideTimer=function(){if(!this.viewerHideTimer)return this.viewerHideTimer=setTimeout(this.viewer.hide,250)},c.prototype.clearViewerHideTimer=function(){return clearTimeout(this.viewerHideTimer),this.viewerHideTimer=!1},c.prototype.checkForStartSelection=function(a){if(!a||!this.isAnnotator(a.target))return this.startViewerHideTimer(),this.mouseIsDown=!0},c.prototype.checkForEndSelection=function(a){var b,c,d,e,f;this.mouseIsDown=!1;if(this.ignoreMouseup)return;this.selectedRanges=this.getSelectedRanges(),f=this.selectedRanges;for(d=0,e=f.length;d0&&this.invertX(),this},d.prototype.resetOrientation=function(){return this.element.removeClass(this.classes.invert.x).removeClass(this.classes.invert.y),this},d.prototype.invertX=function(){return this.element.addClass(this.classes.invert.x),this},d.prototype.invertY=function(){return this.element.addClass(this.classes.invert.y),this},d.prototype.isInvertedY=function(){return this.element.hasClass(this.classes.invert.y)},d.prototype.isInvertedX=function(){return this.element.hasClass(this.classes.invert.x)},d}(c),b.Editor=function(b){function c(b){this.onCancelButtonMouseover=x(this.onCancelButtonMouseover,this),this.processKeypress=x(this.processKeypress,this),this.submit=x(this.submit,this),this.load=x(this.load,this),this.hide=x(this.hide,this),this.show=x(this.show,this),c.__super__.constructor.call(this,a(this.html)[0],b),this.fields=[],this.annotation={}}return y(c,b),c.prototype.events={"form submit":"submit",".annotator-save click":"submit",".annotator-cancel click":"hide",".annotator-cancel mouseover":"onCancelButtonMouseover","textarea keydown":"processKeypress"},c.prototype.classes={hide:"annotator-hide",focus:"annotator-focus"},c.prototype.html='
\n
\n
    \n \n
    \n
    ",c.prototype.options={},c.prototype.show=function(a){return m.preventEventDefault(a),this.element.removeClass(this.classes.hide),this.element.find(".annotator-save").addClass(this.classes.focus),this.checkOrientation(),this.element.find(":input:first").focus(),this.setupDraggables(),this.publish("show")},c.prototype.hide=function(a){return m.preventEventDefault(a),this.element.addClass(this.classes.hide),this.publish("hide")},c.prototype.load=function(a){var b,c,d,e;this.annotation=a,this.publish("load",[this.annotation]),e=this.fields;for(c=0,d=e.length;c'),d.element=c[0];switch(d.type){case"textarea":e=a("