diff --git a/COPYING.annotator b/COPYING.annotator new file mode 100644 index 0000000..d206c9b --- /dev/null +++ b/COPYING.annotator @@ -0,0 +1,27 @@ +Copyright 2014, The Annotator project contributors. +# Annotator licensing terms +http://annotatorjs.org + +Annotator is free software, and you may use it under the terms of either the +MIT or the GNU GPL licenses: + +## GNU GPLv3 + +You can redistribute this program and/or modify it under the terms of the +GNU General Public License as published by the Free Software Foundation, +either version 3 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. See LICENSE-GPL, or, if this file is missing, +. + +## MIT + +You may use the software under the terms of the MIT license, which can be +found in LICENSE-MIT, or, if this file is missing, +. \ No newline at end of file diff --git a/COPYING.showdown b/COPYING.showdown new file mode 100644 index 0000000..e9c8672 --- /dev/null +++ b/COPYING.showdown @@ -0,0 +1,34 @@ +Copyright (c) 2007, John Fraser + +All rights reserved. + +Original Markdown copyright (c) 2004, John Gruber + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +* Neither the name "Markdown" nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +This software is provided by the copyright holders and contributors "as +is" and any express or implied warranties, including, but not limited +to, the implied warranties of merchantability and fitness for a +particular purpose are disclaimed. In no event shall the copyright owner +or contributors be liable for any direct, indirect, incidental, special, +exemplary, or consequential damages (including, but not limited to, +procurement of substitute goods or services; loss of use, data, or +profits; or business interruption) however caused and on any theory of +liability, whether in contract, strict liability, or tort (including +negligence or otherwise) arising in any way out of the use of this +software, even if advised of the possibility of such damage. diff --git a/README.md b/README.md index 7ee7137..b8fe754 100644 --- a/README.md +++ b/README.md @@ -541,3 +541,11 @@ in the COPYING file distributed along with this README. Mustard ships a copy of jQuery in views/public/, which is licensed under the MIT license (see COPYING.jquery for more information about the license). + +Mustard ships a copy of Annotator in views/public/, which is licensed +under the MIT license (see COPYING.annotator for more information about +the license). + +Mustard ships a copy of Showdown.js in views/public/, which is licensed +under a BSD-style license (see COPYING.showdown for more information about +the license). diff --git a/views/layout.tpl b/views/layout.tpl index b48a1fb..3291e09 100644 --- a/views/layout.tpl +++ b/views/layout.tpl @@ -3,9 +3,12 @@ {{tree.project.title or 'Unnamed Mustard Project'}} + + +
@@ -69,5 +72,28 @@

Mustard © 2012-2014 Codethink Ltd{{!' — Content © %s' % tree.project.copyright if tree.project.copyright else ''}}

+ diff --git a/views/public/annotator-full.min.js b/views/public/annotator-full.min.js new file mode 100644 index 0000000..54540cc --- /dev/null +++ b/views/public/annotator-full.min.js @@ -0,0 +1,11 @@ +/* +** Annotator v1.2.7 +** https://github.com/okfn/annotator/ +** +** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning. +** Dual licensed under the MIT and GPLv3 licenses. +** https://github.com/okfn/annotator/blob/master/LICENSE +** +** Built at: 2013-06-27 21:49:35Z +*/((function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F=[].slice,G={}.hasOwnProperty,H=function(a,b){function d(){this.constructor=a}for(var c in b)G.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},I=function(a,b){return function(){return a.apply(b,arguments)}},J=[].indexOf||function(a){for(var b=0,c=this.length;b/g,">").replace(/"/g,""")},f.uuid=function(){var a;return a=0,function(){return a++}}(),f.getGlobal=function(){return function(){return this}()},f.maxZIndex=function(b){var c,d;return c=function(){var c,e,f;f=[];for(c=0,e=b.length;c0?h.start.splitText(h.startOffset):h.start,h.start===h.end?(h.endOffset-h.startOffset=this[i+"Offset"]){j[i+"Container"]=k,j[i+"Offset"]=this[i+"Offset"]-g;break}g+=k.nodeValue.length}if(j[i+"Offset"]==null)throw new e.RangeError(""+i+"offset","Couldn't find offset "+this[i+"Offset"]+" in element "+this[i])}return c=document.compareDocumentPosition==null?function(a,b){return a.contains(b)}:function(a,b){return a.compareDocumentPosition(b)&16},a(j.startContainer).parents().each(function(){if(c(this,j.endContainer))return j.commonAncestorContainer=this,!1}),(new e.BrowserRange(j)).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}(),t=this.Annotator,b=function(b){function c(b,d){this.onDeleteAnnotation=I(this.onDeleteAnnotation,this),this.onEditAnnotation=I(this.onEditAnnotation,this),this.onAdderClick=I(this.onAdderClick,this),this.onAdderMousedown=I(this.onAdderMousedown,this),this.onHighlightMouseover=I(this.onHighlightMouseover,this),this.checkForEndSelection=I(this.checkForEndSelection,this),this.checkForStartSelection=I(this.checkForStartSelection,this),this.clearViewerHideTimer=I(this.clearViewerHideTimer,this),this.startViewerHideTimer=I(this.startViewerHideTimer,this),this.showViewer=I(this.showViewer,this),this.onEditorSubmit=I(this.onEditorSubmit,this),this.onEditorHide=I(this.onEditorHide,this),this.showEditor=I(this.showEditor,this),c.__super__.constructor.apply(this,arguments),this.plugins={};if(!c.supported())return this;this.options.readOnly||this._setupDocumentEvents(),this._setupWrapper()._setupViewer()._setupEditor(),this._setupDynamicStyle(),this.adder=a(this.html.adder).appendTo(this.wrapper).hide()}return H(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={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).html(f.escape(d.text)):a(c).html(""+E("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:E("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._setupDynamicStyle=function(){var b,c,d,e;return d=a("#annotator-dynamic-style"),d.length||(d=a('').appendTo(document.head)),c="*"+function(){var a,b,c,d;c=["adder","outer","notice","filter"],d=[];for(a=0,b=c.length;af;c=0<=f?++a:--a)g=j.getRangeAt(c),b=new e.BrowserRange(g),d=b.normalize().limit(this.wrapper[0]),d===null&&i.push(g),h.push(d);return h}.call(this),j.removeAllRanges());for(k=0,l=i.length;k0?setTimeout(function(){return c(a)},10):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(E("Can't dump annotations without Store plugin.")),!1)},c.prototype.highlightRange=function(b,c){var d,e,f,g,h,i,j;c==null&&(c="annotator-hl"),f=/^\s*$/,d=a(""),i=b.textNodes(),j=[];for(g=0,h=i.length;g tag?"))),this},c.prototype.showEditor=function(a,b){return this.editor.element.css(b),this.editor.load(a),this.publish("annotationEditorShown",[this.editor,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])},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){return(!a||!this.isAnnotator(a.target))&&this.startViewerHideTimer(),this.mouseIsDown=!0},c.prototype.checkForEndSelection=function(b){var c,d,e,g,h;this.mouseIsDown=!1;if(this.ignoreMouseup)return;this.selectedRanges=this.getSelectedRanges(),h=this.selectedRanges;for(e=0,g=h.length;e0&&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(c){function d(b){this.onCancelButtonMouseover=I(this.onCancelButtonMouseover,this),this.processKeypress=I(this.processKeypress,this),this.submit=I(this.submit,this),this.load=I(this.load,this),this.hide=I(this.hide,this),this.show=I(this.show,this),d.__super__.constructor.call(this,a(this.html)[0],b),this.fields=[],this.annotation={}}return H(d,c),d.prototype.events={"form submit":"submit",".annotator-save click":"submit",".annotator-cancel click":"hide",".annotator-cancel mouseover":"onCancelButtonMouseover","textarea keydown":"processKeypress"},d.prototype.classes={hide:"annotator-hide",focus:"annotator-focus"},d.prototype.html='
\n
\n
    \n \n
    \n
    ",d.prototype.options={},d.prototype.show=function(a){return b.Util.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")},d.prototype.hide=function(a){return b.Util.preventEventDefault(a),this.element.addClass(this.classes.hide),this.publish("hide")},d.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'),e.element=d[0];switch(e.type){case"textarea":f=a("