mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
Added several usage examples, fixed bugs, turned off restore by default
This commit is contained in:
parent
0e08b734ec
commit
416f7ab6a0
112 changed files with 23903 additions and 3348 deletions
116
libs/annotator/lib/plugin/annotateitpermissions.js
Normal file
116
libs/annotator/lib/plugin/annotateitpermissions.js
Normal file
|
@ -0,0 +1,116 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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);
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=annotateitpermissions.map
|
||||
*/
|
10
libs/annotator/lib/plugin/annotateitpermissions.map
Normal file
10
libs/annotator/lib/plugin/annotateitpermissions.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "annotateitpermissions.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/annotateitpermissions.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AAYA,IAAA;GAAA;;;wJAAA;;AAAM,CAAN,KAAsB,GAAP;CAGb;;;;;;;;;CAAA;;CAAA,EAGE,IAHF;CAGE,CAA6B,EAA7B,uBAAA;CAAA,CAG6B,EAA7B,uBAAA;CAHA,CAOE,EADF,EAAA;CACE,CAAO,GAAP,CAAA,WAAA;CAAA,CACe,IAAf,OAAA,YADA;CAAA,CAEU,IAAV,EAAA,YAFA;MAPF;CAAA,CAWQ,CAAA,CAAR,EAAA,GAAS;CAAc,GAAD,SAAJ;CAXlB,IAWQ;CAXR,CAYY,CAAA,CAAZ,KAAa,CAAb;CAA2B,GAAD,SAAJ;CAZtB,IAYY;CAZZ,CAsBe,CAAA,CAAf,EAAe,GAAC,CAAD,GAAf;CACE,SAAA,2CAAA;CAAA,CAAA,CAAc,CAA0B,EAAxC,IAAwB,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uB;CAAkB,CAAS,IAAR,eAAD;CAAA,CAA6C,EAAC,EAAd,KAAA;CAAtF,KAAa;CACL,CAAgB,EAAtB,CAAK,IAAL,IAAA;MADF;CAGQ,IAAD,IAAL,CAAA,GAAA;MAXoB;CApFxB,EAoFwB;;CApFxB,CA0GoC,CAAP,CAAA,CAAA,IAAC,CAAD,iBAA7B;CACE,MAAA,CAAA;AAAqD,CAArD,GAAA,MAA+D,CAA/D;CAAA,EAAyB,CAAC,EAA1B,CAAiC,GAAvB,CAAV;MAAA;CAAA,EAEU,CAAV,GAAA,OAFA;CAIA,CAAG,EAAH,CAAG,EAAA,GAAA;CACU,EAAoB,CAAR,CAAoB,CAAX,CAA+B,CAAhC,EAArB,CAAa,EAAvB;MADF;CAGa,EAAoB,CAAR,MAAb,CAAa,EAAvB;MARyB;CA1G7B,EA0G6B;;CA1G7B,EA0HmB,EAAA,IAAC,QAApB;CACO,GAAD,CAAJ,EAAA,IAAA;CA3HF,EA0HmB;;CA1HnB;;CAHmD,KAAgB,GAAP"
|
||||
}
|
215
libs/annotator/lib/plugin/auth.js
Normal file
215
libs/annotator/lib/plugin/auth.js
Normal file
|
@ -0,0 +1,215 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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]) * 1000);
|
||||
}
|
||||
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 * 1000);
|
||||
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 & 0xff;
|
||||
o2 = bits >> 8 & 0xff;
|
||||
o3 = bits & 0xff;
|
||||
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) * 1000);
|
||||
}
|
||||
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 * 1000);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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() / 1000;
|
||||
issue = createDateFromISO8601(this._unsafeToken.issuedAt).getTime() / 1000;
|
||||
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);
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=auth.map
|
||||
*/
|
10
libs/annotator/lib/plugin/auth.map
Normal file
10
libs/annotator/lib/plugin/auth.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "auth.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/auth.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AAKA,IAAA,4DAAA;GAAA;kSAAA;;AAAA,CAAA,EAAwB,GAAA,GAAC,YAAzB;CACE,KAAA,6BAAA;CAAA,CAAA,CAAS,GAAT,8BAAS,MAAT,WAAS;CAAT,CAIA,CAAI,CAAiB,CAAjB,CAAM;CAJV,CAMA,CAAS,GAAT;CANA,CAOA,CAAW,CAAX;CAEA,CAAA,EAA2B;CAA3B,EAAqB,CAArB,IAAA;IATA;CAUA,CAAA,EAAsB;CAAtB,GAAA,GAAA;IAVA;CAWA,CAAA,EAAuB;CAAvB,GAAA,IAAA;IAXA;CAYA,CAAA,EAAyB;CAAzB,GAAA,MAAA;IAZA;CAaA,CAAA,EAA0B;CAA1B,CAAkB,EAAlB,MAAA;IAbA;CAcA,CAAA,EAAqD;CAArD,CAAqC,CAAF,CAAnC,EAAqB,SAArB;IAdA;CAgBA,CAAA,EAAG;CACD,CAAmB,CAAV,CAAT,EAAA;CAAA,EAC4B,CAA5B,EAAA;AAAiC,CAAL,CAAI,IAAJ;CAF9B,KACE;IAjBF;CAAA,CAoBA,EAAU,EAAV,WAAU;CApBV,CAqBA,CAAQ,CAAR,EAAQ;CArBR,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J,EAAA,OAAoB;AACb,CAAP,GAAG,EAAH,WAAA;CACO,GAAD,QAAJ,GAAA;QALJ;MAJS;CAvJX,EAuJW;;CAvJX;;CAFkC,QAAS"
|
||||
}
|
259
libs/annotator/lib/plugin/document.js
Normal file
259
libs/annotator/lib/plugin/document.js
Normal file
|
@ -0,0 +1,259 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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.Document = (function(_super) {
|
||||
var $;
|
||||
|
||||
__extends(Document, _super);
|
||||
|
||||
function Document() {
|
||||
this._getFavicon = __bind(this._getFavicon, this);
|
||||
this._getLinks = __bind(this._getLinks, this);
|
||||
this._getTitle = __bind(this._getTitle, this);
|
||||
this._getMetaTags = __bind(this._getMetaTags, this);
|
||||
this._getEprints = __bind(this._getEprints, this);
|
||||
this._getPrism = __bind(this._getPrism, this);
|
||||
this._getDublinCore = __bind(this._getDublinCore, this);
|
||||
this._getTwitter = __bind(this._getTwitter, this);
|
||||
this._getFacebook = __bind(this._getFacebook, this);
|
||||
this._getHighwire = __bind(this._getHighwire, this);
|
||||
this.getDocumentMetadata = __bind(this.getDocumentMetadata, this);
|
||||
this.beforeAnnotationCreated = __bind(this.beforeAnnotationCreated, this);
|
||||
this.uris = __bind(this.uris, this);
|
||||
this.uri = __bind(this.uri, this);
|
||||
_ref = Document.__super__.constructor.apply(this, arguments);
|
||||
return _ref;
|
||||
}
|
||||
|
||||
$ = Annotator.$;
|
||||
|
||||
Document.prototype.events = {
|
||||
'beforeAnnotationCreated': 'beforeAnnotationCreated'
|
||||
};
|
||||
|
||||
Document.prototype.pluginInit = function() {
|
||||
return this.getDocumentMetadata();
|
||||
};
|
||||
|
||||
Document.prototype.uri = function() {
|
||||
var link, uri, _i, _len, _ref1;
|
||||
uri = decodeURIComponent(document.location.href);
|
||||
_ref1 = this.metadata;
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
link = _ref1[_i];
|
||||
if (link.rel === "canonical") {
|
||||
uri = link.href;
|
||||
}
|
||||
}
|
||||
return uri;
|
||||
};
|
||||
|
||||
Document.prototype.uris = function() {
|
||||
var href, link, uniqueUrls, _i, _len, _ref1;
|
||||
uniqueUrls = {};
|
||||
_ref1 = this.metadata.link;
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
link = _ref1[_i];
|
||||
if (link.href) {
|
||||
uniqueUrls[link.href] = true;
|
||||
}
|
||||
}
|
||||
return (function() {
|
||||
var _results;
|
||||
_results = [];
|
||||
for (href in uniqueUrls) {
|
||||
_results.push(href);
|
||||
}
|
||||
return _results;
|
||||
})();
|
||||
};
|
||||
|
||||
Document.prototype.beforeAnnotationCreated = function(annotation) {
|
||||
return annotation.document = this.metadata;
|
||||
};
|
||||
|
||||
Document.prototype.getDocumentMetadata = function() {
|
||||
this.metadata = {};
|
||||
this._getHighwire();
|
||||
this._getDublinCore();
|
||||
this._getFacebook();
|
||||
this._getEprints();
|
||||
this._getPrism();
|
||||
this._getTwitter();
|
||||
this._getFavicon();
|
||||
this._getTitle();
|
||||
this._getLinks();
|
||||
return this.metadata;
|
||||
};
|
||||
|
||||
Document.prototype._getHighwire = function() {
|
||||
return this.metadata.highwire = this._getMetaTags("citation", "name", "_");
|
||||
};
|
||||
|
||||
Document.prototype._getFacebook = function() {
|
||||
return this.metadata.facebook = this._getMetaTags("og", "property", ":");
|
||||
};
|
||||
|
||||
Document.prototype._getTwitter = function() {
|
||||
return this.metadata.twitter = this._getMetaTags("twitter", "name", ":");
|
||||
};
|
||||
|
||||
Document.prototype._getDublinCore = function() {
|
||||
return this.metadata.dc = this._getMetaTags("dc", "name", ".");
|
||||
};
|
||||
|
||||
Document.prototype._getPrism = function() {
|
||||
return this.metadata.prism = this._getMetaTags("prism", "name", ".");
|
||||
};
|
||||
|
||||
Document.prototype._getEprints = function() {
|
||||
return this.metadata.eprints = this._getMetaTags("eprints", "name", ".");
|
||||
};
|
||||
|
||||
Document.prototype._getMetaTags = function(prefix, attribute, delimiter) {
|
||||
var content, match, meta, n, name, tags, _i, _len, _ref1;
|
||||
tags = {};
|
||||
_ref1 = $("meta");
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
meta = _ref1[_i];
|
||||
name = $(meta).attr(attribute);
|
||||
content = $(meta).prop("content");
|
||||
if (name) {
|
||||
match = name.match(RegExp("^" + prefix + delimiter + "(.+)$", "i"));
|
||||
if (match) {
|
||||
n = match[1];
|
||||
if (tags[n]) {
|
||||
tags[n].push(content);
|
||||
} else {
|
||||
tags[n] = [content];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return tags;
|
||||
};
|
||||
|
||||
Document.prototype._getTitle = function() {
|
||||
if (this.metadata.highwire.title) {
|
||||
return this.metadata.title = this.metadata.highwire.title[0];
|
||||
} else if (this.metadata.eprints.title) {
|
||||
return this.metadata.title = this.metadata.eprints.title;
|
||||
} else if (this.metadata.prism.title) {
|
||||
return this.metadata.title = this.metadata.prism.title;
|
||||
} else if (this.metadata.facebook.title) {
|
||||
return this.metadata.title = this.metadata.facebook.title;
|
||||
} else if (this.metadata.twitter.title) {
|
||||
return this.metadata.title = this.metadata.twitter.title;
|
||||
} else if (this.metadata.dc.title) {
|
||||
return this.metadata.title = this.metadata.dc.title;
|
||||
} else {
|
||||
return this.metadata.title = $("head title").text();
|
||||
}
|
||||
};
|
||||
|
||||
Document.prototype._getLinks = function() {
|
||||
var doi, href, id, l, link, name, rel, type, url, values, _i, _j, _k, _len, _len1, _len2, _ref1, _ref2, _ref3, _results;
|
||||
this.metadata.link = [
|
||||
{
|
||||
href: document.location.href
|
||||
}
|
||||
];
|
||||
_ref1 = $("link");
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
link = _ref1[_i];
|
||||
l = $(link);
|
||||
href = this._absoluteUrl(l.prop('href'));
|
||||
rel = l.prop('rel');
|
||||
type = l.prop('type');
|
||||
if ((rel === "alternate" || rel === "canonical" || rel === "bookmark") && (type !== "application/rss+xml" && type !== "application/atom+xml")) {
|
||||
this.metadata.link.push({
|
||||
href: href,
|
||||
rel: rel,
|
||||
type: type
|
||||
});
|
||||
}
|
||||
}
|
||||
_ref2 = this.metadata.highwire;
|
||||
for (name in _ref2) {
|
||||
values = _ref2[name];
|
||||
if (name === "pdf_url") {
|
||||
for (_j = 0, _len1 = values.length; _j < _len1; _j++) {
|
||||
url = values[_j];
|
||||
this.metadata.link.push({
|
||||
href: this._absoluteUrl(url),
|
||||
type: "application/pdf"
|
||||
});
|
||||
}
|
||||
}
|
||||
if (name === "doi") {
|
||||
for (_k = 0, _len2 = values.length; _k < _len2; _k++) {
|
||||
doi = values[_k];
|
||||
if (doi.slice(0, 4) !== "doi:") {
|
||||
doi = "doi:" + doi;
|
||||
}
|
||||
this.metadata.link.push({
|
||||
href: doi
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
_ref3 = this.metadata.dc;
|
||||
_results = [];
|
||||
for (name in _ref3) {
|
||||
values = _ref3[name];
|
||||
if (name === "identifier") {
|
||||
_results.push((function() {
|
||||
var _l, _len3, _results1;
|
||||
_results1 = [];
|
||||
for (_l = 0, _len3 = values.length; _l < _len3; _l++) {
|
||||
id = values[_l];
|
||||
if (id.slice(0, 4) === "doi:") {
|
||||
_results1.push(this.metadata.link.push({
|
||||
href: id
|
||||
}));
|
||||
} else {
|
||||
_results1.push(void 0);
|
||||
}
|
||||
}
|
||||
return _results1;
|
||||
}).call(this));
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
Document.prototype._getFavicon = function() {
|
||||
var link, _i, _len, _ref1, _ref2, _results;
|
||||
_ref1 = $("link");
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
link = _ref1[_i];
|
||||
if ((_ref2 = $(link).prop("rel")) === "shortcut icon" || _ref2 === "icon") {
|
||||
_results.push(this.metadata["favicon"] = this._absoluteUrl(link.href));
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
Document.prototype._absoluteUrl = function(url) {
|
||||
var img;
|
||||
img = $("<img src='" + url + "'>");
|
||||
url = img.prop('src');
|
||||
img.prop('src', null);
|
||||
return url;
|
||||
};
|
||||
|
||||
return Document;
|
||||
|
||||
})(Annotator.Plugin);
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=document.map
|
||||
*/
|
10
libs/annotator/lib/plugin/document.map
Normal file
10
libs/annotator/lib/plugin/document.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "document.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/document.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AAAA,IAAA;GAAA;;kSAAA;;AAAM,CAAN,KAAsB,GAAP;CAEb,KAAA;;CAAA;;;;;;;;;;;;;;;;;;;CAAA;;CAAA,CAAA,CAAI,MAAS;;CAAb,EAGE,GADF;CACE,CAA2B,EAA3B,qBAAA;CAHF,GAAA;;CAAA,EAKY,MAAA,CAAZ;CACO,GAAD,OAAJ,QAAA;CANF,EAKY;;CALZ,EAUA,MAAK;CACH,OAAA,kBAAA;CAAA,EAAA,CAAA,IAAiC,UAA3B;CACN;CAAA,QAAA,mCAAA;wBAAA;CACE,EAAG,CAAA,CAAY,CAAf,KAAA;CACE,EAAA,CAAU,IAAV;QAFJ;CAAA,IADA;CAIA,EAAA,QAAO;CAfT,EAUK;;CAVL,EAmBM,CAAN,KAAM;CACJ,OAAA,+BAAA;CAAA,CAAA,CAAa,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js
Normal file
|
@ -0,0 +1,282 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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.Filter = (function(_super) {
|
||||
__extends(Filter, _super);
|
||||
|
||||
Filter.prototype.events = {
|
||||
".annotator-filter-property input focus": "_onFilterFocus",
|
||||
".annotator-filter-property input blur": "_onFilterBlur",
|
||||
".annotator-filter-property input keyup": "_onFilterKeyup",
|
||||
".annotator-filter-previous click": "_onPreviousClick",
|
||||
".annotator-filter-next click": "_onNextClick",
|
||||
".annotator-filter-clear click": "_onClearClick"
|
||||
};
|
||||
|
||||
Filter.prototype.classes = {
|
||||
active: 'annotator-filter-active',
|
||||
hl: {
|
||||
hide: 'annotator-hl-filtered',
|
||||
active: 'annotator-hl-active'
|
||||
}
|
||||
};
|
||||
|
||||
Filter.prototype.html = {
|
||||
element: "<div class=\"annotator-filter\">\n <strong>" + Annotator._t('Navigate:') + "</strong>\n<span class=\"annotator-filter-navigation\">\n <button class=\"annotator-filter-previous\">" + Annotator._t('Previous') + "</button>\n<button class=\"annotator-filter-next\">" + Annotator._t('Next') + "</button>\n</span>\n<strong>" + Annotator._t('Filter by:') + "</strong>\n</div>",
|
||||
filter: "<span class=\"annotator-filter-property\">\n <label></label>\n <input/>\n <button class=\"annotator-filter-clear\">" + Annotator._t('Clear') + "</button>\n</span>"
|
||||
};
|
||||
|
||||
Filter.prototype.options = {
|
||||
appendTo: 'body',
|
||||
filters: [],
|
||||
addAnnotationFilter: true,
|
||||
isFiltered: function(input, property) {
|
||||
var keyword, _i, _len, _ref;
|
||||
if (!(input && property)) {
|
||||
return false;
|
||||
}
|
||||
_ref = input.split(/\s*/);
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
keyword = _ref[_i];
|
||||
if (property.indexOf(keyword) === -1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
function Filter(element, options) {
|
||||
this._onPreviousClick = __bind(this._onPreviousClick, this);
|
||||
this._onNextClick = __bind(this._onNextClick, this);
|
||||
this._onFilterKeyup = __bind(this._onFilterKeyup, this);
|
||||
this._onFilterBlur = __bind(this._onFilterBlur, this);
|
||||
this._onFilterFocus = __bind(this._onFilterFocus, this);
|
||||
this.updateHighlights = __bind(this.updateHighlights, this);
|
||||
var _base;
|
||||
element = $(this.html.element).appendTo((options != null ? options.appendTo : void 0) || this.options.appendTo);
|
||||
Filter.__super__.constructor.call(this, element, options);
|
||||
(_base = this.options).filters || (_base.filters = []);
|
||||
this.filter = $(this.html.filter);
|
||||
this.filters = [];
|
||||
this.current = 0;
|
||||
}
|
||||
|
||||
Filter.prototype.pluginInit = function() {
|
||||
var filter, _i, _len, _ref;
|
||||
_ref = this.options.filters;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
filter = _ref[_i];
|
||||
this.addFilter(filter);
|
||||
}
|
||||
this.updateHighlights();
|
||||
this._setupListeners()._insertSpacer();
|
||||
if (this.options.addAnnotationFilter === true) {
|
||||
return this.addFilter({
|
||||
label: Annotator._t('Annotation'),
|
||||
property: 'text'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Filter.prototype.destroy = function() {
|
||||
var currentMargin, html;
|
||||
Filter.__super__.destroy.apply(this, arguments);
|
||||
html = $('html');
|
||||
currentMargin = parseInt(html.css('padding-top'), 10) || 0;
|
||||
html.css('padding-top', currentMargin - this.element.outerHeight());
|
||||
return this.element.remove();
|
||||
};
|
||||
|
||||
Filter.prototype._insertSpacer = function() {
|
||||
var currentMargin, html;
|
||||
html = $('html');
|
||||
currentMargin = parseInt(html.css('padding-top'), 10) || 0;
|
||||
html.css('padding-top', currentMargin + this.element.outerHeight());
|
||||
return this;
|
||||
};
|
||||
|
||||
Filter.prototype._setupListeners = function() {
|
||||
var event, events, _i, _len;
|
||||
events = ['annotationsLoaded', 'annotationCreated', 'annotationUpdated', 'annotationDeleted'];
|
||||
for (_i = 0, _len = events.length; _i < _len; _i++) {
|
||||
event = events[_i];
|
||||
this.annotator.subscribe(event, this.updateHighlights);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Filter.prototype.addFilter = function(options) {
|
||||
var f, filter;
|
||||
filter = $.extend({
|
||||
label: '',
|
||||
property: '',
|
||||
isFiltered: this.options.isFiltered
|
||||
}, options);
|
||||
if (!((function() {
|
||||
var _i, _len, _ref, _results;
|
||||
_ref = this.filters;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
f = _ref[_i];
|
||||
if (f.property === filter.property) {
|
||||
_results.push(f);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
}).call(this)).length) {
|
||||
filter.id = 'annotator-filter-' + filter.property;
|
||||
filter.annotations = [];
|
||||
filter.element = this.filter.clone().appendTo(this.element);
|
||||
filter.element.find('label').html(filter.label).attr('for', filter.id);
|
||||
filter.element.find('input').attr({
|
||||
id: filter.id,
|
||||
placeholder: Annotator._t('Filter by ') + filter.label + '\u2026'
|
||||
});
|
||||
filter.element.find('button').hide();
|
||||
filter.element.data('filter', filter);
|
||||
this.filters.push(filter);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Filter.prototype.updateFilter = function(filter) {
|
||||
var annotation, annotations, input, property, _i, _len, _ref;
|
||||
filter.annotations = [];
|
||||
this.updateHighlights();
|
||||
this.resetHighlights();
|
||||
input = $.trim(filter.element.find('input').val());
|
||||
if (input) {
|
||||
annotations = this.highlights.map(function() {
|
||||
return $(this).data('annotation');
|
||||
});
|
||||
_ref = $.makeArray(annotations);
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
annotation = _ref[_i];
|
||||
property = annotation[filter.property];
|
||||
if (filter.isFiltered(input, property)) {
|
||||
filter.annotations.push(annotation);
|
||||
}
|
||||
}
|
||||
return this.filterHighlights();
|
||||
}
|
||||
};
|
||||
|
||||
Filter.prototype.updateHighlights = function() {
|
||||
this.highlights = this.annotator.element.find('.annotator-hl:visible');
|
||||
return this.filtered = this.highlights.not(this.classes.hl.hide);
|
||||
};
|
||||
|
||||
Filter.prototype.filterHighlights = function() {
|
||||
var activeFilters, annotation, annotations, filtered, highlights, index, uniques, _i, _len, _ref;
|
||||
activeFilters = $.grep(this.filters, function(filter) {
|
||||
return !!filter.annotations.length;
|
||||
});
|
||||
filtered = ((_ref = activeFilters[0]) != null ? _ref.annotations : void 0) || [];
|
||||
if (activeFilters.length > 1) {
|
||||
annotations = [];
|
||||
$.each(activeFilters, function() {
|
||||
return $.merge(annotations, this.annotations);
|
||||
});
|
||||
uniques = [];
|
||||
filtered = [];
|
||||
$.each(annotations, function() {
|
||||
if ($.inArray(this, uniques) === -1) {
|
||||
return uniques.push(this);
|
||||
} else {
|
||||
return filtered.push(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
highlights = this.highlights;
|
||||
for (index = _i = 0, _len = filtered.length; _i < _len; index = ++_i) {
|
||||
annotation = filtered[index];
|
||||
highlights = highlights.not(annotation.highlights);
|
||||
}
|
||||
highlights.addClass(this.classes.hl.hide);
|
||||
this.filtered = this.highlights.not(this.classes.hl.hide);
|
||||
return this;
|
||||
};
|
||||
|
||||
Filter.prototype.resetHighlights = function() {
|
||||
this.highlights.removeClass(this.classes.hl.hide);
|
||||
this.filtered = this.highlights;
|
||||
return this;
|
||||
};
|
||||
|
||||
Filter.prototype._onFilterFocus = function(event) {
|
||||
var input;
|
||||
input = $(event.target);
|
||||
input.parent().addClass(this.classes.active);
|
||||
return input.next('button').show();
|
||||
};
|
||||
|
||||
Filter.prototype._onFilterBlur = function(event) {
|
||||
var input;
|
||||
if (!event.target.value) {
|
||||
input = $(event.target);
|
||||
input.parent().removeClass(this.classes.active);
|
||||
return input.next('button').hide();
|
||||
}
|
||||
};
|
||||
|
||||
Filter.prototype._onFilterKeyup = function(event) {
|
||||
var filter;
|
||||
filter = $(event.target).parent().data('filter');
|
||||
if (filter) {
|
||||
return this.updateFilter(filter);
|
||||
}
|
||||
};
|
||||
|
||||
Filter.prototype._findNextHighlight = function(previous) {
|
||||
var active, annotation, current, index, next, offset, operator, resetOffset;
|
||||
if (!this.highlights.length) {
|
||||
return this;
|
||||
}
|
||||
offset = previous ? 0 : -1;
|
||||
resetOffset = previous ? -1 : 0;
|
||||
operator = previous ? 'lt' : 'gt';
|
||||
active = this.highlights.not('.' + this.classes.hl.hide);
|
||||
current = active.filter('.' + this.classes.hl.active);
|
||||
if (!current.length) {
|
||||
current = active.eq(offset);
|
||||
}
|
||||
annotation = current.data('annotation');
|
||||
index = active.index(current[0]);
|
||||
next = active.filter(":" + operator + "(" + index + ")").not(annotation.highlights).eq(resetOffset);
|
||||
if (!next.length) {
|
||||
next = active.eq(resetOffset);
|
||||
}
|
||||
return this._scrollToHighlight(next.data('annotation').highlights);
|
||||
};
|
||||
|
||||
Filter.prototype._onNextClick = function(event) {
|
||||
return this._findNextHighlight();
|
||||
};
|
||||
|
||||
Filter.prototype._onPreviousClick = function(event) {
|
||||
return this._findNextHighlight(true);
|
||||
};
|
||||
|
||||
Filter.prototype._scrollToHighlight = function(highlight) {
|
||||
highlight = $(highlight);
|
||||
this.highlights.removeClass(this.classes.hl.active);
|
||||
highlight.addClass(this.classes.hl.active);
|
||||
return $('html, body').animate({
|
||||
scrollTop: highlight.offset().top - (this.element.height() + 20)
|
||||
}, 150);
|
||||
};
|
||||
|
||||
Filter.prototype._onClearClick = function(event) {
|
||||
return $(event.target).prev('input').val('').keyup().blur();
|
||||
};
|
||||
|
||||
return Filter;
|
||||
|
||||
})(Annotator.Plugin);
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=filter.map
|
||||
*/
|
10
libs/annotator/lib/plugin/filter.map
Normal file
10
libs/annotator/lib/plugin/filter.map
Normal file
File diff suppressed because one or more lines are too long
67
libs/annotator/lib/plugin/kitchensink.js
Normal file
67
libs/annotator/lib/plugin/kitchensink.js
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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;
|
||||
};
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=kitchensink.map
|
||||
*/
|
10
libs/annotator/lib/plugin/kitchensink.map
Normal file
10
libs/annotator/lib/plugin/kitchensink.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "kitchensink.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/kitchensink.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AA2BA,IAAA;wJAAA;;AAAA,CAAA,CAAsC,CAAZ,GAAA,CAAA,EAAjB,GAAT;CACE,KAAA,yDAAA;;GADgC,CAAP;IACzB;;GAD4C,CAAR;IACpC;CAAA,CAAA,CAAA,CAAoB,KAAL;CAAf,CAGA,CAAU,GAAA,CAAV,CAAU,KAAA,UAAA;CAGV,CAAA,CAAM,CAAH,IAAH;CACE,GAAA,GAAO,GAAP;IAPF;CAAA,CAUA,CAAA,CAAuB,CAAjB,CAAA,EAAY;CAVlB,CAYA,CACE,SADF;CACE,CAAM,EAAN;CAAA,CAEE,EADF,EAAA;CACE,CAAS,IAAT,CAAA;SACE;CAAA,CAAQ,GAAP,CAAO,GAAS,CAAhB;CAAD,CAAwC,IAAxC,EAA8B,EAAA;EAC9B,QAFO;CAEP,CAAQ,GAAP,CAAO,GAAS,CAAhB;CAAD,CAAwC,IAAxC,EAA8B,EAAA;UAFvB;QAAT;MAFF;CAAA,CAOE,EADF;CACE,CAAU,EAAmB,EAA7B,EAAA,yBAAA;MAPF;CAAA,CASE,EADF,CAAA;CACE,CAAQ,EAAmB,EAA3B,EAAQ,mBAAR;CAAA,CAEE,IADF,QAAA;CACE,CAAK,CAAL,KAAA;QAFF;CAAA,CAIE,IADF,QAAA;CACE,CAAK,CAAL,KAAA;QAJF;MATF;CAbF,GAAA;AA4BA,CAAA,MAAA,QAAA;;0BAAA;CACE,CAAG,EAAH,CAAA,EAAG,QAAY;CACb,GAAA,EAAA,CAAO;MAFX;CAAA,EA5BA;CAAA,CAgCA,EAAA,EAAA,CAAA,KAAA;AAEA,CAAA;QAAA,sCAAA;wBAAA;AACK,CAAH,GAAA,QAAG;CACD,CAAqB,EAAjB,KAAJ,GAAkC;MADpC;CAAA;MADF;CAAA;mBAnCwB;CAAA"
|
||||
}
|
39
libs/annotator/lib/plugin/markdown.js
Normal file
39
libs/annotator/lib/plugin/markdown.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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);
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=markdown.map
|
||||
*/
|
10
libs/annotator/lib/plugin/markdown.map
Normal file
10
libs/annotator/lib/plugin/markdown.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "markdown.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/markdown.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AAEA,IAAA;;kSAAA;;AAAM,CAAN,KAAsB,GAAP;CAEb;;CAAA,EACE,GADF;CACE,CAA6B,EAA7B,aAAA,UAAA;CADF,GAAA;;CAaa,CAAA,CAAA,IAAA,WAAC;CACZ,wDAAA;CAAA,GAAA,wFAAA;CACE,KAAA,GAAA,kCAAA;CAAA,EACiB,CAAhB,EAAD,EAAyB,CAAzB;MAFF;CAIE,CAAc,GAAd,CAAA,CAAO,EAAgB,mEAAT;MALL;CAbb,EAaa;;CAbb,CAiCyB,CAAR,EAAA,IAAC,CAAD,KAAjB;CAEE,GAAA,IAAA;CAAA,CAAO,CAAA,CAAP,EAAO,GAAS,CAAuB;CACvC,GAAA,CAAA,EAAc,IAAd;CApCF,EAiCiB;;CAjCjB,EAgDS,CAAA,GAAT,EAAU;CACP,GAAA,IAAD,CAAU,EAAV;CAjDF,EAgDS;;CAhDT;;CAFsC,QAAS"
|
||||
}
|
205
libs/annotator/lib/plugin/permissions.js
Normal file
205
libs/annotator/lib/plugin/permissions.js
Normal file
|
@ -0,0 +1,205 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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 = 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 = this.options.permissions;
|
||||
}
|
||||
dataKey = type + '-permissions';
|
||||
if ($(field).find('input').is(':checked')) {
|
||||
return annotation.permissions[type] = [];
|
||||
} else {
|
||||
return annotation.permissions[type] = [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);
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=permissions.map
|
||||
*/
|
10
libs/annotator/lib/plugin/permissions.map
Normal file
10
libs/annotator/lib/plugin/permissions.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "permissions.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/permissions.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AAcA,IAAA;;kSAAA;;AAAM,CAAN,KAAsB,GAAP;CAIb;;CAAA,EACE,GADF;CACE,CAA2B,EAA3B,mBAAA,EAAA;CADF,GAAA;;CAAA,EAOE,IAHF;CAGE,CAA6B,EAA7B,uBAAA;CAAA,CAG6B,EAA7B,uBAAA;CAHA,CAYQ,CAAA,CAAR,EAAA,GAAS;CAAD,YAAU;CAZlB,IAYQ;CAZR,CAqBY,CAAA,CAAZ,KAAa,CAAb;CAAY,YAAU;CArBtB,IAqBY;CArBZ,CAqEe,CAAA,CAAf,EAAe,GAAC,CAAD,GAAf;CAEE,SAAA,aAAA;CAAA,GAAG,EAAH,IAAa,CAAb;CACE,CAAA,CAAS,CAAkC,EAA3C,EAAA,EAAmB,CAAa;CAEhC,GAAG,CAAiB,CAAX,EAAT;CAEE,GAAA,aAAO;UAJT;AAMA,CAAA,YAAA,gCAAA;8BAAA;CACE,GAAG,CAAqB,CAArB,IAAH;CACE,GAAA,eAAO;YAFX;CAAA,QANA;CAWA,IAAA,UAAO;CAGU,GAAX,EAfR,EAAA,EAekB;CAChB,GAAG,IAAH;CACE,GAAW,CAAiB,CAArB,IAA2C,OAA3C;MADT,IAAA;CAGE,IAAA,YAAO;UAnBX;QAAA;CAFa,YAwBb;CA7FF,IAqEe;CArEf,CAgGM,EAAN;CAhGA,CAoGa,EAAb,OAAA;CAAa,CACD,IAAV;CADW,CAED,IAAV,EAAA;CAFW,CAGD,IAAV,EAAA;CAHW,CAID,IAAV,CAAA;MAxGF;CAPF,GAAA;;CAyHa,CAAA,CAAA,IAAA,cAAC;CACZ,4DAAA;CAAA,kDAAA;CAAA,gFAAA;CAAA,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AV;MAAA;CAAA,EAEU,CAAV,GAAA,OAFA;CAIA,CAAG,EAAH,CAAG,EAAA,GAAA;CACU,EAAoB,CAAR,MAAb,CAAa,EAAvB;MADF;CAOa,EAAoB,CAAR,MAAb,CAAa,EAAvB;MAZyB;CAjQ7B,EAiQ6B;;CAjQ7B,CAuRsB,CAAR,EAAA,GAAA,CAAC,CAAD,EAAd;CACE,OAAA,MAAA;CAAA,EAAQ,CAAR,CAAA;CAAA,EAEW,CAAX,GAAmB,CAAnB,EAAW;AACyB,CAApC,GAAA,CAAuD,CAAnB,EAAjC,EAAU;CACX,EAAO,CAAP,EAAA,CAAqC,EAArB,CAAa;CAA7B,GACA,CAAK,CAAL,EAAA,QAAA;MAFF;CAIE,IAAK,CAAL;MAPF;CASA,GAAA,IAAA;AAC+B,CAA7B,CAAsD,EAAtD,EAAA,EAA6B,CAAA,CAAA;CAA7B,OAAA;QAAA;AAC6B,CAA7B,CAAsD,EAAtD,EAAA,EAA6B,CAAA,CAAA;CAApB,OAAD,EAAR,KAAA;QAFF;MAVY;CAvRd,EAuRc;;CAvRd,EA0SmB,EAAA,IAAC,QAApB;CACO,GAAD,CAAc,CAAlB,CAAA,IAAA;CA3SF,EA0SmB;;CA1SnB;;CAJyC,QAAS"
|
||||
}
|
271
libs/annotator/lib/plugin/store.js
Normal file
271
libs/annotator/lib/plugin/store.js
Normal file
|
@ -0,0 +1,271 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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; },
|
||||
__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.Store = (function(_super) {
|
||||
__extends(Store, _super);
|
||||
|
||||
Store.prototype.events = {
|
||||
'annotationCreated': 'annotationCreated',
|
||||
'annotationDeleted': 'annotationDeleted',
|
||||
'annotationUpdated': 'annotationUpdated'
|
||||
};
|
||||
|
||||
Store.prototype.options = {
|
||||
annotationData: {},
|
||||
emulateHTTP: false,
|
||||
loadFromSearch: false,
|
||||
prefix: '/store',
|
||||
urls: {
|
||||
create: '/annotations',
|
||||
read: '/annotations/:id',
|
||||
update: '/annotations/:id',
|
||||
destroy: '/annotations/:id',
|
||||
search: '/search'
|
||||
}
|
||||
};
|
||||
|
||||
function Store(element, options) {
|
||||
this._onError = __bind(this._onError, this);
|
||||
this._onLoadAnnotationsFromSearch = __bind(this._onLoadAnnotationsFromSearch, this);
|
||||
this._onLoadAnnotations = __bind(this._onLoadAnnotations, this);
|
||||
this._getAnnotations = __bind(this._getAnnotations, this);
|
||||
Store.__super__.constructor.apply(this, arguments);
|
||||
this.annotations = [];
|
||||
}
|
||||
|
||||
Store.prototype.pluginInit = function() {
|
||||
if (!Annotator.supported()) {
|
||||
return;
|
||||
}
|
||||
if (this.annotator.plugins.Auth) {
|
||||
return this.annotator.plugins.Auth.withToken(this._getAnnotations);
|
||||
} else {
|
||||
return this._getAnnotations();
|
||||
}
|
||||
};
|
||||
|
||||
Store.prototype._getAnnotations = function() {
|
||||
if (this.options.loadFromSearch) {
|
||||
return this.loadAnnotationsFromSearch(this.options.loadFromSearch);
|
||||
} else {
|
||||
return this.loadAnnotations();
|
||||
}
|
||||
};
|
||||
|
||||
Store.prototype.annotationCreated = function(annotation) {
|
||||
var _this = this;
|
||||
if (__indexOf.call(this.annotations, annotation) < 0) {
|
||||
this.registerAnnotation(annotation);
|
||||
return this._apiRequest('create', annotation, function(data) {
|
||||
if (data.id == null) {
|
||||
console.warn(Annotator._t("Warning: No ID returned from server for annotation "), annotation);
|
||||
}
|
||||
return _this.updateAnnotation(annotation, data);
|
||||
});
|
||||
} else {
|
||||
return this.updateAnnotation(annotation, {});
|
||||
}
|
||||
};
|
||||
|
||||
Store.prototype.annotationUpdated = function(annotation) {
|
||||
var _this = this;
|
||||
if (__indexOf.call(this.annotations, annotation) >= 0) {
|
||||
return this._apiRequest('update', annotation, (function(data) {
|
||||
return _this.updateAnnotation(annotation, data);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
Store.prototype.annotationDeleted = function(annotation) {
|
||||
var _this = this;
|
||||
if (__indexOf.call(this.annotations, annotation) >= 0) {
|
||||
return this._apiRequest('destroy', annotation, (function() {
|
||||
return _this.unregisterAnnotation(annotation);
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
Store.prototype.registerAnnotation = function(annotation) {
|
||||
return this.annotations.push(annotation);
|
||||
};
|
||||
|
||||
Store.prototype.unregisterAnnotation = function(annotation) {
|
||||
return this.annotations.splice(this.annotations.indexOf(annotation), 1);
|
||||
};
|
||||
|
||||
Store.prototype.updateAnnotation = function(annotation, data) {
|
||||
if (__indexOf.call(this.annotations, annotation) < 0) {
|
||||
console.error(Annotator._t("Trying to update unregistered annotation!"));
|
||||
} else {
|
||||
$.extend(annotation, data);
|
||||
}
|
||||
return $(annotation.highlights).data('annotation', annotation);
|
||||
};
|
||||
|
||||
Store.prototype.loadAnnotations = function() {
|
||||
return this._apiRequest('read', null, this._onLoadAnnotations);
|
||||
};
|
||||
|
||||
Store.prototype._onLoadAnnotations = function(data) {
|
||||
var a, annotation, annotationMap, newData, _i, _j, _len, _len1, _ref;
|
||||
if (data == null) {
|
||||
data = [];
|
||||
}
|
||||
annotationMap = {};
|
||||
_ref = this.annotations;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
a = _ref[_i];
|
||||
annotationMap[a.id] = a;
|
||||
}
|
||||
newData = [];
|
||||
for (_j = 0, _len1 = data.length; _j < _len1; _j++) {
|
||||
a = data[_j];
|
||||
if (annotationMap[a.id]) {
|
||||
annotation = annotationMap[a.id];
|
||||
this.updateAnnotation(annotation, a);
|
||||
} else {
|
||||
newData.push(a);
|
||||
}
|
||||
}
|
||||
this.annotations = this.annotations.concat(newData);
|
||||
return this.annotator.loadAnnotations(newData.slice());
|
||||
};
|
||||
|
||||
Store.prototype.loadAnnotationsFromSearch = function(searchOptions) {
|
||||
return this._apiRequest('search', searchOptions, this._onLoadAnnotationsFromSearch);
|
||||
};
|
||||
|
||||
Store.prototype._onLoadAnnotationsFromSearch = function(data) {
|
||||
if (data == null) {
|
||||
data = {};
|
||||
}
|
||||
return this._onLoadAnnotations(data.rows || []);
|
||||
};
|
||||
|
||||
Store.prototype.dumpAnnotations = function() {
|
||||
var ann, _i, _len, _ref, _results;
|
||||
_ref = this.annotations;
|
||||
_results = [];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
ann = _ref[_i];
|
||||
_results.push(JSON.parse(this._dataFor(ann)));
|
||||
}
|
||||
return _results;
|
||||
};
|
||||
|
||||
Store.prototype._apiRequest = function(action, obj, onSuccess) {
|
||||
var id, options, request, url;
|
||||
id = obj && obj.id;
|
||||
url = this._urlFor(action, id);
|
||||
options = this._apiRequestOptions(action, obj, onSuccess);
|
||||
request = $.ajax(url, options);
|
||||
request._id = id;
|
||||
request._action = action;
|
||||
return request;
|
||||
};
|
||||
|
||||
Store.prototype._apiRequestOptions = function(action, obj, onSuccess) {
|
||||
var data, method, opts;
|
||||
method = this._methodFor(action);
|
||||
opts = {
|
||||
type: method,
|
||||
headers: this.element.data('annotator:headers'),
|
||||
dataType: "json",
|
||||
success: onSuccess || function() {},
|
||||
error: this._onError
|
||||
};
|
||||
if (this.options.emulateHTTP && (method === 'PUT' || method === 'DELETE')) {
|
||||
opts.headers = $.extend(opts.headers, {
|
||||
'X-HTTP-Method-Override': method
|
||||
});
|
||||
opts.type = 'POST';
|
||||
}
|
||||
if (action === "search") {
|
||||
opts = $.extend(opts, {
|
||||
data: obj
|
||||
});
|
||||
return opts;
|
||||
}
|
||||
data = obj && this._dataFor(obj);
|
||||
if (this.options.emulateJSON) {
|
||||
opts.data = {
|
||||
json: data
|
||||
};
|
||||
if (this.options.emulateHTTP) {
|
||||
opts.data._method = method;
|
||||
}
|
||||
return opts;
|
||||
}
|
||||
opts = $.extend(opts, {
|
||||
data: data,
|
||||
contentType: "application/json; charset=utf-8"
|
||||
});
|
||||
return opts;
|
||||
};
|
||||
|
||||
Store.prototype._urlFor = function(action, id) {
|
||||
var url;
|
||||
url = this.options.prefix != null ? this.options.prefix : '';
|
||||
url += this.options.urls[action];
|
||||
url = url.replace(/\/:id/, id != null ? '/' + id : '');
|
||||
url = url.replace(/:id/, id != null ? id : '');
|
||||
return url;
|
||||
};
|
||||
|
||||
Store.prototype._methodFor = function(action) {
|
||||
var table;
|
||||
table = {
|
||||
'create': 'POST',
|
||||
'read': 'GET',
|
||||
'update': 'PUT',
|
||||
'destroy': 'DELETE',
|
||||
'search': 'GET'
|
||||
};
|
||||
return table[action];
|
||||
};
|
||||
|
||||
Store.prototype._dataFor = function(annotation) {
|
||||
var data, highlights;
|
||||
highlights = annotation.highlights;
|
||||
delete annotation.highlights;
|
||||
$.extend(annotation, this.options.annotationData);
|
||||
data = JSON.stringify(annotation);
|
||||
if (highlights) {
|
||||
annotation.highlights = highlights;
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
Store.prototype._onError = function(xhr) {
|
||||
var action, message;
|
||||
action = xhr._action;
|
||||
message = Annotator._t("Sorry we could not ") + action + Annotator._t(" this annotation");
|
||||
if (xhr._action === 'search') {
|
||||
message = Annotator._t("Sorry we could not search the store for annotations");
|
||||
} else if (xhr._action === 'read' && !xhr._id) {
|
||||
message = Annotator._t("Sorry we could not ") + action + Annotator._t(" the annotations from the store");
|
||||
}
|
||||
switch (xhr.status) {
|
||||
case 401:
|
||||
message = Annotator._t("Sorry you are not allowed to ") + action + Annotator._t(" this annotation");
|
||||
break;
|
||||
case 404:
|
||||
message = Annotator._t("Sorry we could not connect to the annotations store");
|
||||
break;
|
||||
case 500:
|
||||
message = Annotator._t("Sorry something went wrong with the annotation store");
|
||||
}
|
||||
Annotator.showNotification(message, Annotator.Notification.ERROR);
|
||||
return console.error(Annotator._t("API request failed:") + (" '" + xhr.status + "'"));
|
||||
};
|
||||
|
||||
return Store;
|
||||
|
||||
})(Annotator.Plugin);
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=store.map
|
||||
*/
|
10
libs/annotator/lib/plugin/store.map
Normal file
10
libs/annotator/lib/plugin/store.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "store.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/store.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AAiBA,IAAA;;;wJAAA;;AAAM,CAAN,KAAsB,GAAP;CAKb;;CAAA,EACE,GADF;CACE,CAAqB,EAArB,eAAA;CAAA,CACqB,EAArB,eAAA;CADA,CAEqB,EAArB,eAAA;CAHF,GAAA;;CAAA,EAUE,IAJF;CAIE,CAAgB,EAAhB,UAAA;CAAA,CAOa,EAAb,CAPA,MAOA;CAPA,CAkBgB,EAAhB,CAlBA,SAkBA;CAlBA,CAsBQ,EAAR,EAAA,EAtBA;CAAA,CAkCE,EADF;CACE,CAAS,IAAT,QAAA;CAAA,CACS,EAAT,EAAA,YADA;CAAA,CAES,IAAT,YAFA;CAAA,CAGS,IAAT,CAAA,WAHA;CAAA,CAIS,IAAT,GAJA;MAlCF;CAVF,GAAA;;CAkEa,CAAA,CAAA,IAAA,QAAC;CACZ,0CAAA;CAAA,kFAAA;CAAA,8DAAA;CAAA,wDAAA;CAAA,GAAA,KAAA,+BAAA;CAAA,CAAA,CACe,CAAf,OAAA;CApEF,EAkEa;;CAlEb,EA+EY,MAAA,CAAZ;AACgB,CAAd,GAAA,KAAuB;CAAvB,WAAA;MAAA;CAEA,GAAA,GAAqB,EAAR;CACV,GAAA,GAAiB,EAAR,IAAV,EAAA;MADF;CAGO,GAAD,SAAJ,EAAA;MANQ;CA/EZ,EA+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AAM,CAAsC,CAAC,CAArD,CAAqD,CAA9C,EAAgB,EAAvB,UAAc;CA5dhB,EA4cU;;CA5cV;;CALmC,QAAS"
|
||||
}
|
123
libs/annotator/lib/plugin/tags.js
Normal file
123
libs/annotator/lib/plugin/tags.js
Normal file
|
@ -0,0 +1,123 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
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') + '\u2026',
|
||||
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;
|
||||
};
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=tags.map
|
||||
*/
|
10
libs/annotator/lib/plugin/tags.map
Normal file
10
libs/annotator/lib/plugin/tags.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "tags.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/tags.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AAEA,IAAA;GAAA;;kSAAA;;AAAM,CAAN,KAAsB,GAAP;CAEb;;;;;;;CAAA;;CAAA,EAIE,IAJF;CAIE,CAAW,CAAA,CAAX,EAAW,GAAX;CACE,GAAA,MAAA;CAAA,EAAS,CAAA,EAAT;CAAA,CAAA,CAEO,CAAP,EAAA;CACA,GAA8B,EAA9B;CAAA,EAAO,CAAP,CAAO,CAAM,EAAb;QAHA;CADS,YAKT;CALF,IAAW;CAAX,CASe,CAAA,CAAf,CAAe,IAAC,IAAhB;CACQ,EAAN,CAAA,CAAK,QAAL;CAVF,IASe;CAbjB,GAAA;;CAAA,EAkBO,CAlBP,CAkBA;;CAlBA,EAsBO,CAtBP,CAsBA;;CAtBA,EA6BY,MAAA,CAAZ;AACgB,CAAd,GAAA,KAAuB;CAAvB,WAAA;MAAA;CAAA,EAES,CAAT,CAAA,CAA0B,EAAjB,CAAU;CAAiB,CAC1B,CAAqC,EAA7C,CAAA,EADkC,CACjB,WAAT;CAD0B,CAE1B,EAAR,EAAA,KAFkC;CAAA,CAG1B,EAAI,EAAZ,WAHkC;CAFpC,KAES;CAFT,GAQA,EAAiB,EAAjB,CAAU;CAAiB,CACnB,EAAN,EAAA,MADyB;CAR3B,KAQA;CAKA,GAAA,EAAA,CAAqB,EAAR;CACX,GAAC,EAAD,CAAkB,EAAR;CACR,CAAO,GAAP,GAAA,CAAgB;CAAhB,CACU,IADV,EACA;CADA,CAEY,EAAqB,EAAL,EAA5B,CAAqB,CAArB,IAFA;CADF,O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CAArB,EAAD,CAAH,CAAwB,EAAxB;CAAlC,GAAW,GAAX,KAAA;YAAA;CAAA;QADF;CAAA,IAFF;IAFA;CAOoB,IAAT,EAAX,CAAmB,CAAnB;CARqC"
|
||||
}
|
36
libs/annotator/lib/plugin/unsupported.js
Normal file
36
libs/annotator/lib/plugin/unsupported.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Generated by CoffeeScript 1.6.3
|
||||
var _ref,
|
||||
__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.Unsupported = (function(_super) {
|
||||
__extends(Unsupported, _super);
|
||||
|
||||
function Unsupported() {
|
||||
_ref = Unsupported.__super__.constructor.apply(this, arguments);
|
||||
return _ref;
|
||||
}
|
||||
|
||||
Unsupported.prototype.options = {
|
||||
message: Annotator._t("Sorry your current browser does not support the Annotator")
|
||||
};
|
||||
|
||||
Unsupported.prototype.pluginInit = function() {
|
||||
var _this = this;
|
||||
if (!Annotator.supported()) {
|
||||
return $(function() {
|
||||
Annotator.showNotification(_this.options.message);
|
||||
if ((window.XMLHttpRequest === void 0) && (ActiveXObject !== void 0)) {
|
||||
return $('html').addClass('ie6');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return Unsupported;
|
||||
|
||||
})(Annotator.Plugin);
|
||||
|
||||
/*
|
||||
//@ sourceMappingURL=unsupported.map
|
||||
*/
|
10
libs/annotator/lib/plugin/unsupported.map
Normal file
10
libs/annotator/lib/plugin/unsupported.map
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 3,
|
||||
"file": "unsupported.js",
|
||||
"sourceRoot": "../..",
|
||||
"sources": [
|
||||
"src/plugin/unsupported.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": ";AAEA,IAAA;GAAA;kSAAA;;AAAM,CAAN,KAAsB,GAAP;CAEb;;;;;CAAA;;CAAA,EACE,IADF;CACE,CAAS,EAAT,GAAA,EAAkB,kDAAT;CADX,GAAA;;CAAA,EAOY,MAAA,CAAZ;CACE,OAAA,IAAA;AAAO,CAAP,GAAA,KAAgB;CACd,EAAE,MAAA,IAAF;CAEE,IAA4B,EAAO,CAAnC,CAAS,OAAT;CAIA,GAAG,CAA0B,CAAnB,EAAV,KAA6C,CAAzC;CACF,IAAA,CAAA,EAAA,SAAA;UAPF;CAAF,MAAE;MAFM;CAPZ,EAOY;;CAPZ;;CAFyC,QAAS"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue