Se agregan anotaciones a propuestas existentes

This commit is contained in:
Abigail Sosa
2015-11-17 16:54:01 -07:00
committed by rgarcia
parent 0d8a233c22
commit 189a6426b1
29 changed files with 638 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
/*
** Annotator v1.2.10
** https://github.com/okfn/annotator/
**
** Copyright 2015, the Annotator project contributors.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2015-02-26 03:26:47Z
*/
//
!function(){var _ref,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child},__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item)return i}return-1};Annotator.Plugin.AnnotateItPermissions=function(_super){__extends(AnnotateItPermissions,_super);function AnnotateItPermissions(){this._setAuthFromToken=__bind(this._setAuthFromToken,this);this.updateAnnotationPermissions=__bind(this.updateAnnotationPermissions,this);this.updatePermissionsField=__bind(this.updatePermissionsField,this);this.addFieldsToAnnotation=__bind(this.addFieldsToAnnotation,this);_ref=AnnotateItPermissions.__super__.constructor.apply(this,arguments);return _ref}AnnotateItPermissions.prototype.options={showViewPermissionsCheckbox:true,showEditPermissionsCheckbox:true,groups:{world:"group:__world__",authenticated:"group:__authenticated__",consumer:"group:__consumer__"},userId:function(user){return user.userId},userString:function(user){return user.userId},userAuthorize:function(action,annotation,user){var action_field,permissions,_ref1,_ref2,_ref3,_ref4;permissions=annotation.permissions||{};action_field=permissions[action]||[];if(_ref1=this.groups.world,__indexOf.call(action_field,_ref1)>=0){return true}else if(user!=null&&user.userId!=null&&user.consumerKey!=null){if(user.userId===annotation.user&&user.consumerKey===annotation.consumer){return true}else if(_ref2=this.groups.authenticated,__indexOf.call(action_field,_ref2)>=0){return true}else if(user.consumerKey===annotation.consumer&&(_ref3=this.groups.consumer,__indexOf.call(action_field,_ref3)>=0)){return true}else if(user.consumerKey===annotation.consumer&&(_ref4=user.userId,__indexOf.call(action_field,_ref4)>=0)){return true}else if(user.consumerKey===annotation.consumer&&user.admin){return true}else{return false}}else{return false}},permissions:{read:["group:__world__"],update:[],"delete":[],admin:[]}};AnnotateItPermissions.prototype.addFieldsToAnnotation=function(annotation){if(annotation){annotation.permissions=this.options.permissions;if(this.user){annotation.user=this.user.userId;return annotation.consumer=this.user.consumerKey}}};AnnotateItPermissions.prototype.updatePermissionsField=function(action,field,annotation){var input;field=$(field).show();input=field.find("input").removeAttr("disabled");if(!this.authorize("admin",annotation)){field.hide()}if(this.user&&this.authorize(action,annotation||{},{userId:"__nonexistentuser__",consumerKey:this.user.consumerKey})){return input.attr("checked","checked")}else{return input.removeAttr("checked")}};AnnotateItPermissions.prototype.updateAnnotationPermissions=function(type,field,annotation){var dataKey;if(!annotation.permissions){annotation.permissions=this.options.permissions}dataKey=type+"-permissions";if($(field).find("input").is(":checked")){return annotation.permissions[type]=[type==="read"?this.options.groups.world:this.options.groups.consumer]}else{return annotation.permissions[type]=[]}};AnnotateItPermissions.prototype._setAuthFromToken=function(token){return this.setUser(token)};return AnnotateItPermissions}(Annotator.Plugin.Permissions)}.call(this);
//
//# sourceMappingURL=annotator.annotateitpermissions.min.map

View File

@@ -0,0 +1,18 @@
/*
** Annotator v1.2.10
** https://github.com/okfn/annotator/
**
** Copyright 2015, the Annotator project contributors.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2015-02-26 03:26:47Z
*/
//
!function(){var base64Decode,base64UrlDecode,createDateFromISO8601,parseToken,__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child};createDateFromISO8601=function(string){var d,date,offset,regexp,time,_ref;regexp="([0-9]{4})(-([0-9]{2})(-([0-9]{2})"+"(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\\.([0-9]+))?)?"+"(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";d=string.match(new RegExp(regexp));offset=0;date=new Date(d[1],0,1);if(d[3]){date.setMonth(d[3]-1)}if(d[5]){date.setDate(d[5])}if(d[7]){date.setHours(d[7])}if(d[8]){date.setMinutes(d[8])}if(d[10]){date.setSeconds(d[10])}if(d[12]){date.setMilliseconds(Number("0."+d[12])*1e3)}if(d[14]){offset=Number(d[16])*60+Number(d[17]);offset*=(_ref=d[15]==="-")!=null?_ref:{1:-1}}offset-=date.getTimezoneOffset();time=Number(date)+offset*60*1e3;date.setTime(Number(time));return date};base64Decode=function(data){var ac,b64,bits,dec,h1,h2,h3,h4,i,o1,o2,o3,tmp_arr;if(typeof atob!=="undefined"&&atob!==null){return atob(data)}else{b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";i=0;ac=0;dec="";tmp_arr=[];if(!data){return data}data+="";while(i<data.length){h1=b64.indexOf(data.charAt(i++));h2=b64.indexOf(data.charAt(i++));h3=b64.indexOf(data.charAt(i++));h4=b64.indexOf(data.charAt(i++));bits=h1<<18|h2<<12|h3<<6|h4;o1=bits>>16&255;o2=bits>>8&255;o3=bits&255;if(h3===64){tmp_arr[ac++]=String.fromCharCode(o1)}else if(h4===64){tmp_arr[ac++]=String.fromCharCode(o1,o2)}else{tmp_arr[ac++]=String.fromCharCode(o1,o2,o3)}}return tmp_arr.join("")}};base64UrlDecode=function(data){var i,m,_i,_ref;m=data.length%4;if(m!==0){for(i=_i=0,_ref=4-m;0<=_ref?_i<_ref:_i>_ref;i=0<=_ref?++_i:--_i){data+="="}}data=data.replace(/-/g,"+");data=data.replace(/_/g,"/");return base64Decode(data)};parseToken=function(token){var head,payload,sig,_ref;_ref=token.split("."),head=_ref[0],payload=_ref[1],sig=_ref[2];return JSON.parse(base64UrlDecode(payload))};Annotator.Plugin.Auth=function(_super){__extends(Auth,_super);Auth.prototype.options={token:null,tokenUrl:"/auth/token",autoFetch:true};function Auth(element,options){Auth.__super__.constructor.apply(this,arguments);this.waitingForToken=[];if(this.options.token){this.setToken(this.options.token)}else{this.requestToken()}}Auth.prototype.requestToken=function(){var _this=this;this.requestInProgress=true;return $.ajax({url:this.options.tokenUrl,dataType:"text",xhrFields:{withCredentials:true}}).done(function(data,status,xhr){return _this.setToken(data)}).fail(function(xhr,status,err){var msg;msg=Annotator._t("Couldn't get auth token:");console.error(""+msg+" "+err,xhr);return Annotator.showNotification(""+msg+" "+xhr.responseText,Annotator.Notification.ERROR)}).always(function(){return _this.requestInProgress=false})};Auth.prototype.setToken=function(token){var _results,_this=this;this.token=token;this._unsafeToken=parseToken(token);if(this.haveValidToken()){if(this.options.autoFetch){this.refreshTimeout=setTimeout(function(){return _this.requestToken()},(this.timeToExpiry()-2)*1e3)}this.updateHeaders();_results=[];while(this.waitingForToken.length>0){_results.push(this.waitingForToken.pop()(this._unsafeToken))}return _results}else{console.warn(Annotator._t("Didn't get a valid token."));if(this.options.autoFetch){console.warn(Annotator._t("Getting a new token in 10s."));return setTimeout(function(){return _this.requestToken()},10*1e3)}}};Auth.prototype.haveValidToken=function(){var allFields;allFields=this._unsafeToken&&this._unsafeToken.issuedAt&&this._unsafeToken.ttl&&this._unsafeToken.consumerKey;if(allFields&&this.timeToExpiry()>0){return true}else{return false}};Auth.prototype.timeToExpiry=function(){var expiry,issue,now,timeToExpiry;now=(new Date).getTime()/1e3;issue=createDateFromISO8601(this._unsafeToken.issuedAt).getTime()/1e3;expiry=issue+this._unsafeToken.ttl;timeToExpiry=expiry-now;if(timeToExpiry>0){return timeToExpiry}else{return 0}};Auth.prototype.updateHeaders=function(){var current;current=this.element.data("annotator:headers");return this.element.data("annotator:headers",$.extend(current,{"x-annotator-auth-token":this.token}))};Auth.prototype.withToken=function(callback){if(callback==null){return}if(this.haveValidToken()){return callback(this._unsafeToken)}else{this.waitingForToken.push(callback);if(!this.requestInProgress){return this.requestToken()}}};return Auth}(Annotator.Plugin)}.call(this);
//
//# sourceMappingURL=annotator.auth.min.map

View File

@@ -0,0 +1,283 @@
(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
"use strict";
var annotator = (typeof window !== "undefined" ? window.annotator : typeof global !== "undefined" ? global.annotator : null);
var util = annotator.util;
var $ = util.$;
// isEmpty returns a boolean indicating whether the passed object is empty
function isEmpty(obj) {
// null and undefined objects are empty
if (typeof obj === 'undefined' || obj === null) {
return true;
}
for (var k in obj) {
if (obj.hasOwnProperty(k)) {
return false;
}
}
return true;
}
// absoluteUrl turns a possibly relative URL into an absolute one
function absoluteUrl(url) {
var d = global.document.createElement('a');
d.href = url;
return d.href;
}
function getMetaTags(prefix, attribute, delimiter) {
var tags = {},
matchRe = new RegExp("^" + prefix + delimiter + "(.+)$", "i");
$("meta").each(function (_, meta) {
var name = $(meta).attr(attribute),
content = $(meta).prop("content");
if (name) {
var match = name.match(matchRe);
if (match) {
var n = match[1];
if (tags[n]) {
tags[n].push(content);
} else {
tags[n] = [content];
}
}
}
});
return tags;
}
function getHighwire() {
return getMetaTags("citation", "name", "_");
}
function getFacebook() {
return getMetaTags("og", "property", ":");
}
function getTwitter() {
return getMetaTags("twitter", "name", ":");
}
function getDublinCore() {
return getMetaTags("dc", "name", ".");
}
function getPrism() {
return getMetaTags("prism", "name", ".");
}
function getEprints() {
return getMetaTags("eprints", "name", ".");
}
function getFavicon() {
var result = null;
$("link").each(function (_, link) {
var rel = $(link).prop("rel");
if (rel === "shortcut icon" || rel === "icon") {
result = absoluteUrl(link.href);
return;
}
});
return result;
}
function getTitle(d, keys) {
for (var i = 0, len = keys.length; i < len; i++) {
var k = keys[i];
if (!d.hasOwnProperty(k)) {
continue;
}
if (!d[k].hasOwnProperty('title')) {
continue;
}
if (d[k].title.length === 0) {
continue;
}
return d[k].title[0];
}
// Fall back to document title
return global.document.title;
}
function getLinks() {
// we know our current location is a link for the document
var results = [{href: global.document.location.href}];
// look for some relevant link relations
$("link").each(function (_, link) {
var $l = $(link),
rel = $l.prop('rel');
if (!(rel === "alternate" ||
rel === "canonical" ||
rel === "shortlink" ||
rel === "bookmark")) {
return;
}
var type = $l.prop('type'),
lang = $l.prop('hreflang');
if (rel === 'alternate') {
// Ignore feeds resources
if (type && type.match(/^application\/(rss|atom)\+xml/)) { return; }
// Ignore alternate languages
if (lang) { return; }
}
// get absolute url
var href = absoluteUrl($l.prop('href'));
results.push({href: href, rel: rel, type: type});
});
return results;
}
function getHighwireLinks(meta) {
var i,
len,
results = [];
// kind of a hack to express DOI identifiers as links but it's a
// convenient place to look them up later, and somewhat sane since
// they don't have a type
var dois = meta.doi;
if (typeof dois !== 'undefined' && dois !== null) {
for (i = 0, len = dois.length; i < len; i++) {
var doi = dois[i];
if (doi.slice(0, 4) !== "doi:") {
doi = "doi:" + doi;
}
results.push({href: doi});
}
}
// look for links in scholar metadata
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
var urls = meta.pdf_url;
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
if (typeof urls !== 'undefined' && urls !== null) {
for (i = 0, len = urls.length; i < len; i++) {
results.push({
href: absoluteUrl(urls[i]),
type: "application/pdf"
});
}
}
return results;
}
function getDublinCoreLinks(meta) {
var results = [];
// look for links in dublincore data
var ident = meta.identifier;
if (typeof ident !== 'undefined' && ident !== null) {
for (var i = 0, len = ident.length; i < len; i++) {
if (ident[i].slice(0, 4) === 'doi:') {
results.push({href: ident[i]});
}
}
}
return results;
}
var METADATA_FIELDS = {
dc: getDublinCore,
eprints: getEprints,
facebook: getFacebook,
highwire: getHighwire,
prism: getPrism,
twitter: getTwitter
};
var METADATA_TITLE_ORDER = [
'highwire',
'eprints',
'prism',
'facebook',
'twitter',
'dc'
];
function getDocumentMetadata() {
var out = {};
// first look for some common metadata types
// TODO: look for microdata/rdfa?
for (var name in METADATA_FIELDS) {
var result = METADATA_FIELDS[name]();
if (!isEmpty(result)) {
out[name] = result;
}
}
var favicon = getFavicon();
if (favicon) {
out.favicon = favicon;
}
// extract out/normalize some things
out.title = getTitle(out, METADATA_TITLE_ORDER);
var link = getLinks();
if ('highwire' in out) {
link = link.concat(getHighwireLinks(out.highwire));
}
if ('dc' in out) {
link = link.concat(getDublinCoreLinks(out.dc));
}
if (link.length > 0) {
out.link = link;
}
return out;
}
var doc = function () {
var metadata = getDocumentMetadata();
return {
beforeAnnotationCreated: function (ann) {
// Assign a copy of the document metadata to the annotation
ann.document = JSON.parse(JSON.stringify(metadata));
}
};
};
annotator.ext.document = doc;
exports.document = doc;
exports.absoluteUrl = absoluteUrl;
exports.getDocumentMetadata = getDocumentMetadata;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[1]);

View File

@@ -0,0 +1,11 @@
/*
** Annotator v2.0.0-alpha.3-6a22d86
** https://github.com/okfn/annotator/
**
** Copyright 2015, the Annotator project contributors.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2015-07-03 04:09:40Z
*/
(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(global){"use strict";var annotator=typeof window!=="undefined"?window.annotator:typeof global!=="undefined"?global.annotator:null;var util=annotator.util;var $=util.$;function isEmpty(obj){if(typeof obj==="undefined"||obj===null){return true}for(var k in obj){if(obj.hasOwnProperty(k)){return false}}return true}function absoluteUrl(url){var d=global.document.createElement("a");d.href=url;return d.href}function getMetaTags(prefix,attribute,delimiter){var tags={},matchRe=new RegExp("^"+prefix+delimiter+"(.+)$","i");$("meta").each(function(_,meta){var name=$(meta).attr(attribute),content=$(meta).prop("content");if(name){var match=name.match(matchRe);if(match){var n=match[1];if(tags[n]){tags[n].push(content)}else{tags[n]=[content]}}}});return tags}function getHighwire(){return getMetaTags("citation","name","_")}function getFacebook(){return getMetaTags("og","property",":")}function getTwitter(){return getMetaTags("twitter","name",":")}function getDublinCore(){return getMetaTags("dc","name",".")}function getPrism(){return getMetaTags("prism","name",".")}function getEprints(){return getMetaTags("eprints","name",".")}function getFavicon(){var result=null;$("link").each(function(_,link){var rel=$(link).prop("rel");if(rel==="shortcut icon"||rel==="icon"){result=absoluteUrl(link.href);return}});return result}function getTitle(d,keys){for(var i=0,len=keys.length;i<len;i++){var k=keys[i];if(!d.hasOwnProperty(k)){continue}if(!d[k].hasOwnProperty("title")){continue}if(d[k].title.length===0){continue}return d[k].title[0]}return global.document.title}function getLinks(){var results=[{href:global.document.location.href}];$("link").each(function(_,link){var $l=$(link),rel=$l.prop("rel");if(!(rel==="alternate"||rel==="canonical"||rel==="shortlink"||rel==="bookmark")){return}var type=$l.prop("type"),lang=$l.prop("hreflang");if(rel==="alternate"){if(type&&type.match(/^application\/(rss|atom)\+xml/)){return}if(lang){return}}var href=absoluteUrl($l.prop("href"));results.push({href:href,rel:rel,type:type})});return results}function getHighwireLinks(meta){var i,len,results=[];var dois=meta.doi;if(typeof dois!=="undefined"&&dois!==null){for(i=0,len=dois.length;i<len;i++){var doi=dois[i];if(doi.slice(0,4)!=="doi:"){doi="doi:"+doi}results.push({href:doi})}}var urls=meta.pdf_url;if(typeof urls!=="undefined"&&urls!==null){for(i=0,len=urls.length;i<len;i++){results.push({href:absoluteUrl(urls[i]),type:"application/pdf"})}}return results}function getDublinCoreLinks(meta){var results=[];var ident=meta.identifier;if(typeof ident!=="undefined"&&ident!==null){for(var i=0,len=ident.length;i<len;i++){if(ident[i].slice(0,4)==="doi:"){results.push({href:ident[i]})}}}return results}var METADATA_FIELDS={dc:getDublinCore,eprints:getEprints,facebook:getFacebook,highwire:getHighwire,prism:getPrism,twitter:getTwitter};var METADATA_TITLE_ORDER=["highwire","eprints","prism","facebook","twitter","dc"];function getDocumentMetadata(){var out={};for(var name in METADATA_FIELDS){var result=METADATA_FIELDS[name]();if(!isEmpty(result)){out[name]=result}}var favicon=getFavicon();if(favicon){out.favicon=favicon}out.title=getTitle(out,METADATA_TITLE_ORDER);var link=getLinks();if("highwire"in out){link=link.concat(getHighwireLinks(out.highwire))}if("dc"in out){link=link.concat(getDublinCoreLinks(out.dc))}if(link.length>0){out.link=link}return out}var doc=function(){var metadata=getDocumentMetadata();return{beforeAnnotationCreated:function(ann){ann.document=JSON.parse(JSON.stringify(metadata))}}};annotator.ext.document=doc;exports.document=doc;exports.absoluteUrl=absoluteUrl;exports.getDocumentMetadata=getDocumentMetadata}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
/*
** Annotator v1.2.10
** https://github.com/okfn/annotator/
**
** Copyright 2015, the Annotator project contributors.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2015-02-26 03:26:47Z
*/
//
!function(){var __hasProp={}.hasOwnProperty,__indexOf=[].indexOf||function(item){for(var i=0,l=this.length;i<l;i++){if(i in this&&this[i]===item)return i}return-1};Annotator.prototype.setupPlugins=function(config,options){var name,opts,pluginConfig,plugins,uri,win,_i,_len,_results;if(config==null){config={}}if(options==null){options={}}win=Annotator.Util.getGlobal();plugins=["Unsupported","Auth","Tags","Filter","Store","AnnotateItPermissions"];if(win.Showdown){plugins.push("Markdown")}uri=win.location.href.split(/#|\?/).shift()||"";pluginConfig={Tags:{},Filter:{filters:[{label:Annotator._t("User"),property:"user"},{label:Annotator._t("Tags"),property:"tags"}]},Auth:{tokenUrl:config.tokenUrl||"http://annotateit.org/api/token"},Store:{prefix:config.storeUrl||"http://annotateit.org/api",annotationData:{uri:uri},loadFromSearch:{uri:uri}}};for(name in options){if(!__hasProp.call(options,name))continue;opts=options[name];if(__indexOf.call(plugins,name)<0){plugins.push(name)}}$.extend(true,pluginConfig,options);_results=[];for(_i=0,_len=plugins.length;_i<_len;_i++){name=plugins[_i];if(!(name in pluginConfig)||pluginConfig[name]){_results.push(this.addPlugin(name,pluginConfig[name]))}else{_results.push(void 0)}}return _results}}.call(this);
//
//# sourceMappingURL=annotator.kitchensink.min.map

View File

@@ -0,0 +1,18 @@
/*
** Annotator v1.2.10
** https://github.com/okfn/annotator/
**
** Copyright 2015, the Annotator project contributors.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2015-02-26 03:26:47Z
*/
//
!function(){var __bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child};Annotator.Plugin.Markdown=function(_super){__extends(Markdown,_super);Markdown.prototype.events={annotationViewerTextField:"updateTextField"};function Markdown(element,options){this.updateTextField=__bind(this.updateTextField,this);if((typeof Showdown!=="undefined"&&Showdown!==null?Showdown.converter:void 0)!=null){Markdown.__super__.constructor.apply(this,arguments);this.converter=new Showdown.converter}else{console.error(Annotator._t("To use the Markdown plugin, you must include Showdown into the page first."))}}Markdown.prototype.updateTextField=function(field,annotation){var text;text=Annotator.Util.escape(annotation.text||"");return $(field).html(this.convert(text))};Markdown.prototype.convert=function(text){return this.converter.makeHtml(text)};return Markdown}(Annotator.Plugin)}.call(this);
//
//# sourceMappingURL=annotator.markdown.min.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
/*
** Annotator v1.2.10
** https://github.com/okfn/annotator/
**
** Copyright 2015, the Annotator project contributors.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2015-02-26 03:26:47Z
*/
//
!function(){var __bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child};Annotator.Plugin.Permissions=function(_super){__extends(Permissions,_super);Permissions.prototype.events={beforeAnnotationCreated:"addFieldsToAnnotation"};Permissions.prototype.options={showViewPermissionsCheckbox:true,showEditPermissionsCheckbox:true,userId:function(user){return user},userString:function(user){return user},userAuthorize:function(action,annotation,user){var token,tokens,_i,_len;if(annotation.permissions){tokens=annotation.permissions[action]||[];if(tokens.length===0){return true}for(_i=0,_len=tokens.length;_i<_len;_i++){token=tokens[_i];if(this.userId(user)===token){return true}}return false}else if(annotation.user){if(user){return this.userId(user)===this.userId(annotation.user)}else{return false}}return true},user:"",permissions:{read:[],update:[],"delete":[],admin:[]}};function Permissions(element,options){this._setAuthFromToken=__bind(this._setAuthFromToken,this);this.updateViewer=__bind(this.updateViewer,this);this.updateAnnotationPermissions=__bind(this.updateAnnotationPermissions,this);this.updatePermissionsField=__bind(this.updatePermissionsField,this);this.addFieldsToAnnotation=__bind(this.addFieldsToAnnotation,this);Permissions.__super__.constructor.apply(this,arguments);if(this.options.user){this.setUser(this.options.user);delete this.options.user}}Permissions.prototype.pluginInit=function(){var createCallback,self,_this=this;if(!Annotator.supported()){return}self=this;createCallback=function(method,type){return function(field,annotation){return self[method].call(self,type,field,annotation)}};if(!this.user&&this.annotator.plugins.Auth){this.annotator.plugins.Auth.withToken(this._setAuthFromToken)}if(this.options.showViewPermissionsCheckbox===true){this.annotator.editor.addField({type:"checkbox",label:Annotator._t("Allow anyone to <strong>view</strong> this annotation"),load:createCallback("updatePermissionsField","read"),submit:createCallback("updateAnnotationPermissions","read")})}if(this.options.showEditPermissionsCheckbox===true){this.annotator.editor.addField({type:"checkbox",label:Annotator._t("Allow anyone to <strong>edit</strong> this annotation"),load:createCallback("updatePermissionsField","update"),submit:createCallback("updateAnnotationPermissions","update")})}this.annotator.viewer.addField({load:this.updateViewer});if(this.annotator.plugins.Filter){return this.annotator.plugins.Filter.addFilter({label:Annotator._t("User"),property:"user",isFiltered:function(input,user){var keyword,_i,_len,_ref;user=_this.options.userString(user);if(!(input&&user)){return false}_ref=input.split(/\s*/);for(_i=0,_len=_ref.length;_i<_len;_i++){keyword=_ref[_i];if(user.indexOf(keyword)===-1){return false}}return true}})}};Permissions.prototype.setUser=function(user){return this.user=user};Permissions.prototype.addFieldsToAnnotation=function(annotation){if(annotation){annotation.permissions=$.extend(true,{},this.options.permissions);if(this.user){return annotation.user=this.user}}};Permissions.prototype.authorize=function(action,annotation,user){if(user===void 0){user=this.user}if(this.options.userAuthorize){return this.options.userAuthorize.call(this.options,action,annotation,user)}else{return true}};Permissions.prototype.updatePermissionsField=function(action,field,annotation){var input;field=$(field).show();input=field.find("input").removeAttr("disabled");if(!this.authorize("admin",annotation)){field.hide()}if(this.authorize(action,annotation||{},null)){return input.attr("checked","checked")}else{return input.removeAttr("checked")}};Permissions.prototype.updateAnnotationPermissions=function(type,field,annotation){var dataKey;if(!annotation.permissions){annotation.permissions=$.extend(true,{},this.options.permissions)}dataKey=type+"-permissions";if($(field).find("input").is(":checked")){return annotation.permissions[type]=[]}else{return annotation.permissions[type]=[this.options.userId(this.user)]}};Permissions.prototype.updateViewer=function(field,annotation,controls){var user,username;field=$(field);username=this.options.userString(annotation.user);if(annotation.user&&username&&typeof username==="string"){user=Annotator.Util.escape(this.options.userString(annotation.user));field.html(user).addClass("annotator-user")}else{field.remove()}if(controls){if(!this.authorize("update",annotation)){controls.hideEdit()}if(!this.authorize("delete",annotation)){return controls.hideDelete()}}};Permissions.prototype._setAuthFromToken=function(token){return this.setUser(token.userId)};return Permissions}(Annotator.Plugin)}.call(this);
//
//# sourceMappingURL=annotator.permissions.min.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
/*
** Annotator v1.2.10
** https://github.com/okfn/annotator/
**
** Copyright 2015, the Annotator project contributors.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2015-02-26 03:26:47Z
*/
//
!function(){var _ref,__bind=function(fn,me){return function(){return fn.apply(me,arguments)}},__hasProp={}.hasOwnProperty,__extends=function(child,parent){for(var key in parent){if(__hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child};Annotator.Plugin.Tags=function(_super){__extends(Tags,_super);function Tags(){this.setAnnotationTags=__bind(this.setAnnotationTags,this);this.updateField=__bind(this.updateField,this);_ref=Tags.__super__.constructor.apply(this,arguments);return _ref}Tags.prototype.options={parseTags:function(string){var tags;string=$.trim(string);tags=[];if(string){tags=string.split(/\s+/)}return tags},stringifyTags:function(array){return array.join(" ")}};Tags.prototype.field=null;Tags.prototype.input=null;Tags.prototype.pluginInit=function(){if(!Annotator.supported()){return}this.field=this.annotator.editor.addField({label:Annotator._t("Add some tags here")+"…",load:this.updateField,submit:this.setAnnotationTags});this.annotator.viewer.addField({load:this.updateViewer});if(this.annotator.plugins.Filter){this.annotator.plugins.Filter.addFilter({label:Annotator._t("Tag"),property:"tags",isFiltered:Annotator.Plugin.Tags.filterCallback})}return this.input=$(this.field).find(":input")};Tags.prototype.parseTags=function(string){return this.options.parseTags(string)};Tags.prototype.stringifyTags=function(array){return this.options.stringifyTags(array)};Tags.prototype.updateField=function(field,annotation){var value;value="";if(annotation.tags){value=this.stringifyTags(annotation.tags)}return this.input.val(value)};Tags.prototype.setAnnotationTags=function(field,annotation){return annotation.tags=this.parseTags(this.input.val())};Tags.prototype.updateViewer=function(field,annotation){field=$(field);if(annotation.tags&&$.isArray(annotation.tags)&&annotation.tags.length){return field.addClass("annotator-tags").html(function(){var string;return string=$.map(annotation.tags,function(tag){return'<span class="annotator-tag">'+Annotator.Util.escape(tag)+"</span>"}).join(" ")})}else{return field.remove()}};return Tags}(Annotator.Plugin);Annotator.Plugin.Tags.filterCallback=function(input,tags){var keyword,keywords,matches,tag,_i,_j,_len,_len1;if(tags==null){tags=[]}matches=0;keywords=[];if(input){keywords=input.split(/\s+/g);for(_i=0,_len=keywords.length;_i<_len;_i++){keyword=keywords[_i];if(tags.length){for(_j=0,_len1=tags.length;_j<_len1;_j++){tag=tags[_j];if(tag.indexOf(keyword)!==-1){matches+=1}}}}}return matches===keywords.length}}.call(this);
//
//# sourceMappingURL=annotator.tags.min.map

View File

@@ -0,0 +1,82 @@
(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (global){
"use strict";
var annotator = (typeof window !== "undefined" ? window.annotator : typeof global !== "undefined" ? global.annotator : null);
var _t = annotator.util.gettext;
/**
* function:: checkSupport([scope=window])
*
* Examines `scope` (by default the global window object) to determine if
* Annotator can be used in this environment.
*
* :returns Object:
* - `supported`: Boolean, whether Annotator can be used in `scope`.
* - `details`: Array of String reasons why Annotator cannot be used.
*/
function checkSupport(scope) {
if (typeof scope === 'undefined' || scope === null) {
scope = annotator.global;
}
var errors = [];
if (typeof scope.getSelection !== 'function') {
errors.push(_t("current scope lacks an implementation of the W3C " +
"Range API"));
}
// We require a working JSON implementation.
if (typeof scope.JSON === 'undefined' ||
typeof scope.JSON.parse !== 'function' ||
typeof scope.JSON.stringify !== 'function') {
errors.push(_t("current scope lacks a working JSON implementation"));
}
return {
supported: errors.length === 0,
errors: errors
};
}
// unsupported serves one very simple purpose. It will display a notification to
// the user if Annotator cannot support their current browser.
function unsupported() {
// Reference as exports.checkSupport so that we can stub it for testing.
var result = exports.checkSupport();
function fallback(message, severity) {
if (severity === annotator.notification.ERROR) {
console.error(message);
return;
}
console.log(message);
}
function notifyUser(app) {
if (result.supported) {
return;
}
var notify = app.registry.queryUtility('notifier') || fallback;
var msg;
msg = _t("Sorry, Annotator does not currently support your browser! ");
msg += _t("Errors: ");
msg += result.errors.join(", ");
notify(msg);
}
return {
start: notifyUser
};
}
annotator.ext.unsupported = unsupported;
exports.checkSupport = checkSupport;
exports.unsupported = unsupported;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}]},{},[1]);

View File

@@ -0,0 +1,11 @@
/*
** Annotator v2.0.0-alpha.3-6a22d86
** https://github.com/okfn/annotator/
**
** Copyright 2015, the Annotator project contributors.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2015-07-03 04:09:41Z
*/
(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(global){"use strict";var annotator=typeof window!=="undefined"?window.annotator:typeof global!=="undefined"?global.annotator:null;var _t=annotator.util.gettext;function checkSupport(scope){if(typeof scope==="undefined"||scope===null){scope=annotator.global}var errors=[];if(typeof scope.getSelection!=="function"){errors.push(_t("current scope lacks an implementation of the W3C "+"Range API"))}if(typeof scope.JSON==="undefined"||typeof scope.JSON.parse!=="function"||typeof scope.JSON.stringify!=="function"){errors.push(_t("current scope lacks a working JSON implementation"))}return{supported:errors.length===0,errors:errors}}function unsupported(){var result=exports.checkSupport();function fallback(message,severity){if(severity===annotator.notification.ERROR){console.error(message);return}console.log(message)}function notifyUser(app){if(result.supported){return}var notify=app.registry.queryUtility("notifier")||fallback;var msg;msg=_t("Sorry, Annotator does not currently support your browser! ");msg+=_t("Errors: ");msg+=result.errors.join(", ");notify(msg)}return{start:notifyUser}}annotator.ext.unsupported=unsupported;exports.checkSupport=checkSupport;exports.unsupported=unsupported}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[1]);

File diff suppressed because one or more lines are too long