Commit 52e5fe22 by Arthur Barrett

update annotator.js library and fix the annotator-adder button hover state in courseware.

parent e89cd7a3
/*
** Annotator 1.2.6-dev-dc18206
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-05-16 18:01:57Z
*/
(function() {
var $, Annotator, Delegator, LinkParser, Range, findChild, fn, functions, g, getNodeName, getNodePosition, gettext, simpleXPathJQuery, simpleXPathPure, util, _Annotator, _gettext, _i, _j, _len, _len1, _ref, _ref1, _t,
__slice = [].slice,
__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; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
simpleXPathJQuery = function(relativeRoot) {
var jq;
jq = this.map(function() {
var elem, idx, path, tagName;
path = '';
elem = this;
while (elem && elem.nodeType === 1 && elem !== relativeRoot) {
tagName = elem.tagName.replace(":", "\\:");
idx = $(elem.parentNode).children(tagName).index(elem) + 1;
idx = "[" + idx + "]";
path = "/" + elem.tagName.toLowerCase() + idx + path;
elem = elem.parentNode;
}
return path;
});
return jq.get();
};
simpleXPathPure = function(relativeRoot) {
var getPathSegment, getPathTo, jq, rootNode;
getPathSegment = function(node) {
var name, pos;
name = getNodeName(node);
pos = getNodePosition(node);
return "" + name + "[" + pos + "]";
};
rootNode = relativeRoot;
getPathTo = function(node) {
var xpath;
xpath = '';
while (node !== rootNode) {
if (node == null) {
throw new Error("Called getPathTo on a node which was not a descendant of @rootNode. " + rootNode);
}
xpath = (getPathSegment(node)) + '/' + xpath;
node = node.parentNode;
}
xpath = '/' + xpath;
xpath = xpath.replace(/\/$/, '');
return xpath;
};
jq = this.map(function() {
var path;
path = getPathTo(this);
return path;
});
return jq.get();
};
findChild = function(node, type, index) {
var child, children, found, name, _i, _len;
if (!node.hasChildNodes()) {
throw new Error("XPath error: node has no children!");
}
children = node.childNodes;
found = 0;
for (_i = 0, _len = children.length; _i < _len; _i++) {
child = children[_i];
name = getNodeName(child);
if (name === type) {
found += 1;
if (found === index) {
return child;
}
}
}
throw new Error("XPath error: wanted child not found.");
};
getNodeName = function(node) {
var nodeName;
nodeName = node.nodeName.toLowerCase();
switch (nodeName) {
case "#text":
return "text()";
case "#comment":
return "comment()";
case "#cdata-section":
return "cdata-section()";
default:
return nodeName;
}
};
getNodePosition = function(node) {
var pos, tmp;
pos = 0;
tmp = node;
while (tmp) {
if (tmp.nodeName === node.nodeName) {
pos++;
}
tmp = tmp.previousSibling;
}
return pos;
};
gettext = null;
if (typeof Gettext !== "undefined" && Gettext !== null) {
_gettext = new Gettext({
domain: "annotator"
});
gettext = function(msgid) {
return _gettext.gettext(msgid);
};
} else {
gettext = function(msgid) {
return msgid;
};
}
_t = function(msgid) {
return gettext(msgid);
};
if (!(typeof jQuery !== "undefined" && jQuery !== null ? (_ref = jQuery.fn) != null ? _ref.jquery : void 0 : void 0)) {
console.error(_t("Annotator requires jQuery: have you included lib/vendor/jquery.js?"));
}
if (!(JSON && JSON.parse && JSON.stringify)) {
console.error(_t("Annotator requires a JSON implementation: have you included lib/vendor/json2.js?"));
}
$ = jQuery.sub();
$.flatten = function(array) {
var flatten;
flatten = function(ary) {
var el, flat, _i, _len;
flat = [];
for (_i = 0, _len = ary.length; _i < _len; _i++) {
el = ary[_i];
flat = flat.concat(el && $.isArray(el) ? flatten(el) : el);
}
return flat;
};
return flatten(array);
};
$.plugin = function(name, object) {
return jQuery.fn[name] = function(options) {
var args;
args = Array.prototype.slice.call(arguments, 1);
return this.each(function() {
var instance;
instance = $.data(this, name);
if (instance) {
return options && instance[options].apply(instance, args);
} else {
instance = new object(this, options);
return $.data(this, name, instance);
}
});
};
};
$.fn.textNodes = function() {
var getTextNodes;
getTextNodes = function(node) {
var nodes;
if (node && node.nodeType !== 3) {
nodes = [];
if (node.nodeType !== 8) {
node = node.lastChild;
while (node) {
nodes.push(getTextNodes(node));
node = node.previousSibling;
}
}
return nodes.reverse();
} else {
return node;
}
};
return this.map(function() {
return $.flatten(getTextNodes(this));
});
};
$.fn.xpath = function(relativeRoot) {
var exception, result;
try {
result = simpleXPathJQuery.call(this, relativeRoot);
} catch (_error) {
exception = _error;
console.log("jQuery-based XPath construction failed! Falling back to manual.");
result = simpleXPathPure.call(this, relativeRoot);
}
return result;
};
$.xpath = function(xp, root) {
var idx, name, node, step, steps, _i, _len, _ref1;
steps = xp.substring(1).split("/");
node = root;
for (_i = 0, _len = steps.length; _i < _len; _i++) {
step = steps[_i];
_ref1 = step.split("["), name = _ref1[0], idx = _ref1[1];
idx = idx != null ? parseInt((idx != null ? idx.split("]") : void 0)[0]) : 1;
node = findChild(node, name.toLowerCase(), idx);
}
return node;
};
$.escape = function(html) {
return html.replace(/&(?!\w+;)/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
};
$.fn.escape = function(html) {
if (arguments.length) {
return this.html($.escape(html));
}
return this.html();
};
$.fn.reverse = []._reverse || [].reverse;
functions = ["log", "debug", "info", "warn", "exception", "assert", "dir", "dirxml", "trace", "group", "groupEnd", "groupCollapsed", "time", "timeEnd", "profile", "profileEnd", "count", "clear", "table", "error", "notifyFirebug", "firebug", "userObjects"];
if (typeof console !== "undefined" && console !== null) {
if (console.group == null) {
console.group = function(name) {
return console.log("GROUP: ", name);
};
}
if (console.groupCollapsed == null) {
console.groupCollapsed = console.group;
}
for (_i = 0, _len = functions.length; _i < _len; _i++) {
fn = functions[_i];
if (console[fn] == null) {
console[fn] = function() {
return console.log(_t("Not implemented:") + (" console." + name));
};
}
}
} else {
this.console = {};
for (_j = 0, _len1 = functions.length; _j < _len1; _j++) {
fn = functions[_j];
this.console[fn] = function() {};
}
this.console['error'] = function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return alert("ERROR: " + (args.join(', ')));
};
this.console['warn'] = function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return alert("WARNING: " + (args.join(', ')));
};
}
Delegator = (function() {
Delegator.prototype.events = {};
Delegator.prototype.options = {};
Delegator.prototype.element = null;
function Delegator(element, options) {
this.options = $.extend(true, {}, this.options, options);
this.element = $(element);
this.on = this.subscribe;
this.addEvents();
}
Delegator.prototype.addEvents = function() {
var event, functionName, sel, selector, _k, _ref1, _ref2, _results;
_ref1 = this.events;
_results = [];
for (sel in _ref1) {
functionName = _ref1[sel];
_ref2 = sel.split(' '), selector = 2 <= _ref2.length ? __slice.call(_ref2, 0, _k = _ref2.length - 1) : (_k = 0, []), event = _ref2[_k++];
_results.push(this.addEvent(selector.join(' '), event, functionName));
}
return _results;
};
Delegator.prototype.addEvent = function(bindTo, event, functionName) {
var closure, isBlankSelector,
_this = this;
closure = function() {
return _this[functionName].apply(_this, arguments);
};
isBlankSelector = typeof bindTo === 'string' && bindTo.replace(/\s+/g, '') === '';
if (isBlankSelector) {
bindTo = this.element;
}
if (typeof bindTo === 'string') {
this.element.delegate(bindTo, event, closure);
} else {
if (this.isCustomEvent(event)) {
this.subscribe(event, closure);
} else {
$(bindTo).bind(event, closure);
}
}
return this;
};
Delegator.prototype.isCustomEvent = function(event) {
event = event.split('.')[0];
return $.inArray(event, Delegator.natives) === -1;
};
Delegator.prototype.publish = function() {
this.element.triggerHandler.apply(this.element, arguments);
return this;
};
Delegator.prototype.subscribe = function(event, callback) {
var closure;
closure = function() {
return callback.apply(this, [].slice.call(arguments, 1));
};
closure.guid = callback.guid = ($.guid += 1);
this.element.bind(event, closure);
return this;
};
Delegator.prototype.unsubscribe = function() {
this.element.unbind.apply(this.element, arguments);
return this;
};
return Delegator;
})();
Delegator.natives = (function() {
var key, specials, val;
specials = (function() {
var _ref1, _results;
_ref1 = jQuery.event.special;
_results = [];
for (key in _ref1) {
if (!__hasProp.call(_ref1, key)) continue;
val = _ref1[key];
_results.push(key);
}
return _results;
})();
return "blur focus focusin focusout load resize scroll unload click dblclick\nmousedown mouseup mousemove mouseover mouseout mouseenter mouseleave\nchange select submit keydown keypress keyup error".split(/[^a-z]+/).concat(specials);
})();
Range = {};
Range.sniff = function(r) {
if (r.commonAncestorContainer != null) {
return new Range.BrowserRange(r);
} else if (typeof r.start === "string") {
return new Range.SerializedRange(r);
} else if (r.start && typeof r.start === "object") {
return new Range.NormalizedRange(r);
} else {
console.error(_t("Could not sniff range type"));
return false;
}
};
Range.nodeFromXPath = function(xpath, root) {
var customResolver, evaluateXPath, namespace, node, segment;
if (root == null) {
root = document;
}
evaluateXPath = function(xp, nsResolver) {
var exception;
if (nsResolver == null) {
nsResolver = null;
}
try {
return document.evaluate('.' + xp, root, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
} catch (_error) {
exception = _error;
console.log("XPath evaluation failed.");
console.log("Trying fallback...");
return $.xpath(xp, root);
}
};
if (!$.isXMLDoc(document.documentElement)) {
return evaluateXPath(xpath);
} else {
customResolver = document.createNSResolver(document.ownerDocument === null ? document.documentElement : document.ownerDocument.documentElement);
node = evaluateXPath(xpath, customResolver);
if (!node) {
xpath = ((function() {
var _k, _len2, _ref1, _results;
_ref1 = xpath.split('/');
_results = [];
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
segment = _ref1[_k];
if (segment && segment.indexOf(':') === -1) {
_results.push(segment.replace(/^([a-z]+)/, 'xhtml:$1'));
} else {
_results.push(segment);
}
}
return _results;
})()).join('/');
namespace = document.lookupNamespaceURI(null);
customResolver = function(ns) {
if (ns === 'xhtml') {
return namespace;
} else {
return document.documentElement.getAttribute('xmlns:' + ns);
}
};
node = evaluateXPath(xpath, customResolver);
}
return node;
}
};
Range.RangeError = (function(_super) {
__extends(RangeError, _super);
function RangeError(type, message, parent) {
this.type = type;
this.message = message;
this.parent = parent != null ? parent : null;
RangeError.__super__.constructor.call(this, this.message);
}
return RangeError;
})(Error);
Range.BrowserRange = (function() {
function BrowserRange(obj) {
this.commonAncestorContainer = obj.commonAncestorContainer;
this.startContainer = obj.startContainer;
this.startOffset = obj.startOffset;
this.endContainer = obj.endContainer;
this.endOffset = obj.endOffset;
}
BrowserRange.prototype.normalize = function(root) {
var it, node, nr, offset, p, r, _k, _len2, _ref1;
if (this.tainted) {
console.error(_t("You may only call normalize() once on a BrowserRange!"));
return false;
} else {
this.tainted = true;
}
r = {};
nr = {};
_ref1 = ['start', 'end'];
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
p = _ref1[_k];
node = this[p + 'Container'];
offset = this[p + 'Offset'];
if (node.nodeType === 1) {
it = node.childNodes[offset];
node = it || node.childNodes[offset - 1];
if (node.nodeType === 1 && !node.firstChild) {
it = null;
node = node.previousSibling;
}
while (node.nodeType !== 3) {
node = node.firstChild;
}
offset = it ? 0 : node.nodeValue.length;
}
r[p] = node;
r[p + 'Offset'] = offset;
}
nr.start = r.startOffset > 0 ? r.start.splitText(r.startOffset) : r.start;
if (r.start === r.end) {
if ((r.endOffset - r.startOffset) < nr.start.nodeValue.length) {
nr.start.splitText(r.endOffset - r.startOffset);
}
nr.end = nr.start;
} else {
if (r.endOffset < r.end.nodeValue.length) {
r.end.splitText(r.endOffset);
}
nr.end = r.end;
}
nr.commonAncestor = this.commonAncestorContainer;
while (nr.commonAncestor.nodeType !== 1) {
nr.commonAncestor = nr.commonAncestor.parentNode;
}
return new Range.NormalizedRange(nr);
};
BrowserRange.prototype.serialize = function(root, ignoreSelector) {
return this.normalize(root).serialize(root, ignoreSelector);
};
return BrowserRange;
})();
Range.NormalizedRange = (function() {
function NormalizedRange(obj) {
this.commonAncestor = obj.commonAncestor;
this.start = obj.start;
this.end = obj.end;
}
NormalizedRange.prototype.normalize = function(root) {
return this;
};
NormalizedRange.prototype.limit = function(bounds) {
var nodes, parent, startParents, _k, _len2, _ref1;
nodes = $.grep(this.textNodes(), function(node) {
return node.parentNode === bounds || $.contains(bounds, node.parentNode);
});
if (!nodes.length) {
return null;
}
this.start = nodes[0];
this.end = nodes[nodes.length - 1];
startParents = $(this.start).parents();
_ref1 = $(this.end).parents();
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
parent = _ref1[_k];
if (startParents.index(parent) !== -1) {
this.commonAncestor = parent;
break;
}
}
return this;
};
NormalizedRange.prototype.serialize = function(root, ignoreSelector) {
var end, serialization, start;
serialization = function(node, isEnd) {
var n, nodes, offset, origParent, textNodes, xpath, _k, _len2;
if (ignoreSelector) {
origParent = $(node).parents(":not(" + ignoreSelector + ")").eq(0);
} else {
origParent = $(node).parent();
}
xpath = origParent.xpath(root)[0];
textNodes = origParent.textNodes();
nodes = textNodes.slice(0, textNodes.index(node));
offset = 0;
for (_k = 0, _len2 = nodes.length; _k < _len2; _k++) {
n = nodes[_k];
offset += n.nodeValue.length;
}
if (isEnd) {
return [xpath, offset + node.nodeValue.length];
} else {
return [xpath, offset];
}
};
start = serialization(this.start);
end = serialization(this.end, true);
return new Range.SerializedRange({
start: start[0],
end: end[0],
startOffset: start[1],
endOffset: end[1]
});
};
NormalizedRange.prototype.text = function() {
var node;
return ((function() {
var _k, _len2, _ref1, _results;
_ref1 = this.textNodes();
_results = [];
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
node = _ref1[_k];
_results.push(node.nodeValue);
}
return _results;
}).call(this)).join('');
};
NormalizedRange.prototype.textNodes = function() {
var end, start, textNodes, _ref1;
textNodes = $(this.commonAncestor).textNodes();
_ref1 = [textNodes.index(this.start), textNodes.index(this.end)], start = _ref1[0], end = _ref1[1];
return $.makeArray(textNodes.slice(start, +end + 1 || 9e9));
};
NormalizedRange.prototype.toRange = function() {
var range;
range = document.createRange();
range.setStartBefore(this.start);
range.setEndAfter(this.end);
return range;
};
return NormalizedRange;
})();
Range.SerializedRange = (function() {
function SerializedRange(obj) {
this.start = obj.start;
this.startOffset = obj.startOffset;
this.end = obj.end;
this.endOffset = obj.endOffset;
}
SerializedRange.prototype.normalize = function(root) {
var contains, e, length, node, p, range, tn, _k, _l, _len2, _len3, _ref1, _ref2;
range = {};
_ref1 = ['start', 'end'];
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
p = _ref1[_k];
try {
node = Range.nodeFromXPath(this[p], root);
} catch (_error) {
e = _error;
throw new Range.RangeError(p, ("Error while finding " + p + " node: " + this[p] + ": ") + e, e);
}
if (!node) {
throw new Range.RangeError(p, "Couldn't find " + p + " node: " + this[p]);
}
length = 0;
_ref2 = $(node).textNodes();
for (_l = 0, _len3 = _ref2.length; _l < _len3; _l++) {
tn = _ref2[_l];
if (length + tn.nodeValue.length >= this[p + 'Offset']) {
range[p + 'Container'] = tn;
range[p + 'Offset'] = this[p + 'Offset'] - length;
break;
} else {
length += tn.nodeValue.length;
}
}
if (range[p + 'Offset'] == null) {
throw new Range.RangeError("" + p + "offset", "Couldn't find offset " + this[p + 'Offset'] + " in element " + this[p]);
}
}
contains = document.compareDocumentPosition == null ? function(a, b) {
return a.contains(b);
} : function(a, b) {
return a.compareDocumentPosition(b) & 16;
};
$(range.startContainer).parents().each(function() {
if (contains(this, range.endContainer)) {
range.commonAncestorContainer = this;
return false;
}
});
return new Range.BrowserRange(range).normalize(root);
};
SerializedRange.prototype.serialize = function(root, ignoreSelector) {
return this.normalize(root).serialize(root, ignoreSelector);
};
SerializedRange.prototype.toObject = function() {
return {
start: this.start,
startOffset: this.startOffset,
end: this.end,
endOffset: this.endOffset
};
};
return SerializedRange;
})();
util = {
uuid: (function() {
var counter;
counter = 0;
return function() {
return counter++;
};
})(),
getGlobal: function() {
return (function() {
return this;
})();
},
maxZIndex: function($elements) {
var all, el;
all = (function() {
var _k, _len2, _results;
_results = [];
for (_k = 0, _len2 = $elements.length; _k < _len2; _k++) {
el = $elements[_k];
if ($(el).css('position') === 'static') {
_results.push(-1);
} else {
_results.push(parseInt($(el).css('z-index'), 10) || -1);
}
}
return _results;
})();
return Math.max.apply(Math, all);
},
mousePosition: function(e, offsetEl) {
var offset;
offset = $(offsetEl).position();
return {
top: e.pageY - offset.top,
left: e.pageX - offset.left
};
},
preventEventDefault: function(event) {
return event != null ? typeof event.preventDefault === "function" ? event.preventDefault() : void 0 : void 0;
}
};
_Annotator = this.Annotator;
Annotator = (function(_super) {
__extends(Annotator, _super);
Annotator.prototype.events = {
".annotator-adder button click": "onAdderClick",
".annotator-adder button mousedown": "onAdderMousedown",
".annotator-hl mouseover": "onHighlightMouseover",
".annotator-hl mouseout": "startViewerHideTimer"
};
Annotator.prototype.html = {
adder: '<div class="annotator-adder"><button>' + _t('Annotate') + '</button></div>',
wrapper: '<div class="annotator-wrapper"></div>'
};
Annotator.prototype.options = {
readOnly: false
};
Annotator.prototype.plugins = {};
Annotator.prototype.editor = null;
Annotator.prototype.viewer = null;
Annotator.prototype.selectedRanges = null;
Annotator.prototype.mouseIsDown = false;
Annotator.prototype.ignoreMouseup = false;
Annotator.prototype.viewerHideTimer = null;
function Annotator(element, options) {
this.onDeleteAnnotation = __bind(this.onDeleteAnnotation, this);
this.onEditAnnotation = __bind(this.onEditAnnotation, this);
this.onAdderClick = __bind(this.onAdderClick, this);
this.onAdderMousedown = __bind(this.onAdderMousedown, this);
this.onHighlightMouseover = __bind(this.onHighlightMouseover, this);
this.checkForEndSelection = __bind(this.checkForEndSelection, this);
this.checkForStartSelection = __bind(this.checkForStartSelection, this);
this.clearViewerHideTimer = __bind(this.clearViewerHideTimer, this);
this.startViewerHideTimer = __bind(this.startViewerHideTimer, this);
this.showViewer = __bind(this.showViewer, this);
this.onEditorSubmit = __bind(this.onEditorSubmit, this);
this.onEditorHide = __bind(this.onEditorHide, this);
this.showEditor = __bind(this.showEditor, this); Annotator.__super__.constructor.apply(this, arguments);
this.plugins = {};
if (!Annotator.supported()) {
return this;
}
if (!this.options.readOnly) {
this._setupDocumentEvents();
}
this._setupWrapper()._setupViewer()._setupEditor();
this._setupDynamicStyle();
this.adder = $(this.html.adder).appendTo(this.wrapper).hide();
}
Annotator.prototype._setupWrapper = function() {
this.wrapper = $(this.html.wrapper);
this.element.find('script').remove();
this.element.wrapInner(this.wrapper);
this.wrapper = this.element.find('.annotator-wrapper');
return this;
};
Annotator.prototype._setupViewer = function() {
var _this = this;
this.viewer = new Annotator.Viewer({
readOnly: this.options.readOnly
});
this.viewer.hide().on("edit", this.onEditAnnotation).on("delete", this.onDeleteAnnotation).addField({
load: function(field, annotation) {
if (annotation.text) {
$(field).escape(annotation.text);
} else {
$(field).html("<i>" + (_t('No Comment')) + "</i>");
}
return _this.publish('annotationViewerTextField', [field, annotation]);
}
}).element.appendTo(this.wrapper).bind({
"mouseover": this.clearViewerHideTimer,
"mouseout": this.startViewerHideTimer
});
return this;
};
Annotator.prototype._setupEditor = function() {
this.editor = new Annotator.Editor();
this.editor.hide().on('hide', this.onEditorHide).on('save', this.onEditorSubmit).addField({
type: 'textarea',
label: _t('Comments') + '\u2026',
load: function(field, annotation) {
return $(field).find('textarea').val(annotation.text || '');
},
submit: function(field, annotation) {
return annotation.text = $(field).find('textarea').val();
}
});
this.editor.element.appendTo(this.wrapper);
return this;
};
Annotator.prototype._setupDocumentEvents = function() {
$(document).bind({
"mouseup": this.checkForEndSelection,
"mousedown": this.checkForStartSelection
});
return this;
};
Annotator.prototype._setupDynamicStyle = function() {
var max, sel, style, x;
style = $('#annotator-dynamic-style');
if (!style.length) {
style = $('<style id="annotator-dynamic-style"></style>').appendTo(document.head);
}
sel = '*' + ((function() {
var _k, _len2, _ref1, _results;
_ref1 = ['adder', 'outer', 'notice', 'filter'];
_results = [];
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
x = _ref1[_k];
_results.push(":not(.annotator-" + x + ")");
}
return _results;
})()).join('');
max = util.maxZIndex($(document.body).find(sel));
max = Math.max(max, 1000);
style.text([".annotator-adder, .annotator-outer, .annotator-notice {", " z-index: " + (max + 20) + ";", "}", ".annotator-filter {", " z-index: " + (max + 10) + ";", "}"].join("\n"));
return this;
};
Annotator.prototype.getSelectedRanges = function() {
var browserRange, i, normedRange, r, ranges, rangesToIgnore, selection, _k, _len2;
selection = util.getGlobal().getSelection();
ranges = [];
rangesToIgnore = [];
if (!selection.isCollapsed) {
ranges = (function() {
var _k, _ref1, _results;
_results = [];
for (i = _k = 0, _ref1 = selection.rangeCount; 0 <= _ref1 ? _k < _ref1 : _k > _ref1; i = 0 <= _ref1 ? ++_k : --_k) {
r = selection.getRangeAt(i);
browserRange = new Range.BrowserRange(r);
normedRange = browserRange.normalize().limit(this.wrapper[0]);
if (normedRange === null) {
rangesToIgnore.push(r);
}
_results.push(normedRange);
}
return _results;
}).call(this);
selection.removeAllRanges();
}
for (_k = 0, _len2 = rangesToIgnore.length; _k < _len2; _k++) {
r = rangesToIgnore[_k];
selection.addRange(r);
}
return $.grep(ranges, function(range) {
if (range) {
selection.addRange(range.toRange());
}
return range;
});
};
Annotator.prototype.createAnnotation = function() {
var annotation;
annotation = {};
this.publish('beforeAnnotationCreated', [annotation]);
return annotation;
};
Annotator.prototype.setupAnnotation = function(annotation) {
var e, normed, normedRanges, r, root, _k, _l, _len2, _len3, _ref1;
root = this.wrapper[0];
annotation.ranges || (annotation.ranges = this.selectedRanges);
normedRanges = [];
_ref1 = annotation.ranges;
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
r = _ref1[_k];
try {
normedRanges.push(Range.sniff(r).normalize(root));
} catch (_error) {
e = _error;
if (e instanceof Range.RangeError) {
this.publish('rangeNormalizeFail', [annotation, r, e]);
} else {
throw e;
}
}
}
annotation.quote = [];
annotation.ranges = [];
annotation.highlights = [];
for (_l = 0, _len3 = normedRanges.length; _l < _len3; _l++) {
normed = normedRanges[_l];
annotation.quote.push($.trim(normed.text()));
annotation.ranges.push(normed.serialize(this.wrapper[0], '.annotator-hl'));
$.merge(annotation.highlights, this.highlightRange(normed));
}
annotation.quote = annotation.quote.join(' / ');
$(annotation.highlights).data('annotation', annotation);
return annotation;
};
Annotator.prototype.updateAnnotation = function(annotation) {
this.publish('beforeAnnotationUpdated', [annotation]);
this.publish('annotationUpdated', [annotation]);
return annotation;
};
Annotator.prototype.deleteAnnotation = function(annotation) {
var child, h, _k, _len2, _ref1;
if (annotation.highlights != null) {
_ref1 = annotation.highlights;
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
h = _ref1[_k];
if (!(h.parentNode != null)) {
continue;
}
child = h.childNodes[0];
$(h).replaceWith(h.childNodes);
}
}
this.publish('annotationDeleted', [annotation]);
return annotation;
};
Annotator.prototype.loadAnnotations = function(annotations) {
var clone, loader,
_this = this;
if (annotations == null) {
annotations = [];
}
loader = function(annList) {
var n, now, _k, _len2;
if (annList == null) {
annList = [];
}
now = annList.splice(0, 10);
for (_k = 0, _len2 = now.length; _k < _len2; _k++) {
n = now[_k];
_this.setupAnnotation(n);
}
if (annList.length > 0) {
return setTimeout((function() {
return loader(annList);
}), 10);
} else {
return _this.publish('annotationsLoaded', [clone]);
}
};
clone = annotations.slice();
if (annotations.length) {
loader(annotations);
}
return this;
};
Annotator.prototype.dumpAnnotations = function() {
if (this.plugins['Store']) {
return this.plugins['Store'].dumpAnnotations();
} else {
console.warn(_t("Can't dump annotations without Store plugin."));
return false;
}
};
Annotator.prototype.highlightRange = function(normedRange, cssClass) {
var hl, node, white, _k, _len2, _ref1, _results;
if (cssClass == null) {
cssClass = 'annotator-hl';
}
white = /^\s*$/;
hl = $("<span class='" + cssClass + "'></span>");
_ref1 = normedRange.textNodes();
_results = [];
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
node = _ref1[_k];
if (!white.test(node.nodeValue)) {
_results.push($(node).wrapAll(hl).parent().show()[0]);
}
}
return _results;
};
Annotator.prototype.highlightRanges = function(normedRanges, cssClass) {
var highlights, r, _k, _len2;
if (cssClass == null) {
cssClass = 'annotator-hl';
}
highlights = [];
for (_k = 0, _len2 = normedRanges.length; _k < _len2; _k++) {
r = normedRanges[_k];
$.merge(highlights, this.highlightRange(r, cssClass));
}
return highlights;
};
Annotator.prototype.addPlugin = function(name, options) {
var klass, _base;
if (this.plugins[name]) {
console.error(_t("You cannot have more than one instance of any plugin."));
} else {
klass = Annotator.Plugin[name];
if (typeof klass === 'function') {
this.plugins[name] = new klass(this.element[0], options);
this.plugins[name].annotator = this;
if (typeof (_base = this.plugins[name]).pluginInit === "function") {
_base.pluginInit();
}
} else {
console.error(_t("Could not load ") + name + _t(" plugin. Have you included the appropriate <script> tag?"));
}
}
return this;
};
Annotator.prototype.showEditor = function(annotation, location) {
this.editor.element.css(location);
this.editor.load(annotation);
this.publish('annotationEditorShown', [this.editor, annotation]);
return this;
};
Annotator.prototype.onEditorHide = function() {
this.publish('annotationEditorHidden', [this.editor]);
return this.ignoreMouseup = false;
};
Annotator.prototype.onEditorSubmit = function(annotation) {
return this.publish('annotationEditorSubmit', [this.editor, annotation]);
};
Annotator.prototype.showViewer = function(annotations, location) {
this.viewer.element.css(location);
this.viewer.load(annotations);
return this.publish('annotationViewerShown', [this.viewer, annotations]);
};
Annotator.prototype.startViewerHideTimer = function() {
if (!this.viewerHideTimer) {
return this.viewerHideTimer = setTimeout(this.viewer.hide, 250);
}
};
Annotator.prototype.clearViewerHideTimer = function() {
clearTimeout(this.viewerHideTimer);
return this.viewerHideTimer = false;
};
Annotator.prototype.checkForStartSelection = function(event) {
if (!(event && this.isAnnotator(event.target))) {
this.startViewerHideTimer();
return this.mouseIsDown = true;
}
};
Annotator.prototype.checkForEndSelection = function(event) {
var container, range, _k, _len2, _ref1;
this.mouseIsDown = false;
if (this.ignoreMouseup) {
return;
}
this.selectedRanges = this.getSelectedRanges();
_ref1 = this.selectedRanges;
for (_k = 0, _len2 = _ref1.length; _k < _len2; _k++) {
range = _ref1[_k];
container = range.commonAncestor;
if ($(container).hasClass('annotator-hl')) {
container = $(container).parents('[class^=annotator-hl]')[0];
}
if (this.isAnnotator(container)) {
return;
}
}
if (event && this.selectedRanges.length) {
return this.adder.css(util.mousePosition(event, this.wrapper[0])).show();
} else {
return this.adder.hide();
}
};
Annotator.prototype.isAnnotator = function(element) {
return !!$(element).parents().andSelf().filter('[class^=annotator-]').not(this.wrapper).length;
};
Annotator.prototype.onHighlightMouseover = function(event) {
var annotations;
this.clearViewerHideTimer();
if (this.mouseIsDown || this.viewer.isShown()) {
return false;
}
annotations = $(event.target).parents('.annotator-hl').andSelf().map(function() {
return $(this).data("annotation");
});
return this.showViewer($.makeArray(annotations), util.mousePosition(event, this.wrapper[0]));
};
Annotator.prototype.onAdderMousedown = function(event) {
if (event != null) {
event.preventDefault();
}
return this.ignoreMouseup = true;
};
Annotator.prototype.onAdderClick = function(event) {
var annotation, cancel, cleanup, position, save,
_this = this;
if (event != null) {
event.preventDefault();
}
position = this.adder.position();
this.adder.hide();
annotation = this.setupAnnotation(this.createAnnotation());
$(annotation.highlights).addClass('annotator-hl-temporary');
save = function() {
cleanup();
$(annotation.highlights).removeClass('annotator-hl-temporary');
return _this.publish('annotationCreated', [annotation]);
};
cancel = function() {
cleanup();
return _this.deleteAnnotation(annotation);
};
cleanup = function() {
_this.unsubscribe('annotationEditorHidden', cancel);
return _this.unsubscribe('annotationEditorSubmit', save);
};
this.subscribe('annotationEditorHidden', cancel);
this.subscribe('annotationEditorSubmit', save);
return this.showEditor(annotation, position);
};
Annotator.prototype.onEditAnnotation = function(annotation) {
var cleanup, offset, update,
_this = this;
offset = this.viewer.element.position();
update = function() {
cleanup();
return _this.updateAnnotation(annotation);
};
cleanup = function() {
_this.unsubscribe('annotationEditorHidden', cleanup);
return _this.unsubscribe('annotationEditorSubmit', update);
};
this.subscribe('annotationEditorHidden', cleanup);
this.subscribe('annotationEditorSubmit', update);
this.viewer.hide();
return this.showEditor(annotation, offset);
};
Annotator.prototype.onDeleteAnnotation = function(annotation) {
this.viewer.hide();
return this.deleteAnnotation(annotation);
};
return Annotator;
})(Delegator);
Annotator.Plugin = (function(_super) {
__extends(Plugin, _super);
function Plugin(element, options) {
Plugin.__super__.constructor.apply(this, arguments);
}
Plugin.prototype.pluginInit = function() {};
return Plugin;
})(Delegator);
g = util.getGlobal();
if (((_ref1 = g.document) != null ? _ref1.evaluate : void 0) == null) {
$.getScript('http://assets.annotateit.org/vendor/xpath.min.js');
}
if (g.getSelection == null) {
$.getScript('http://assets.annotateit.org/vendor/ierange.min.js');
}
if (g.JSON == null) {
$.getScript('http://assets.annotateit.org/vendor/json2.min.js');
}
Annotator.$ = $;
Annotator.Delegator = Delegator;
Annotator.Range = Range;
Annotator._t = _t;
Annotator.supported = function() {
return (function() {
return !!this.getSelection;
})();
};
Annotator.noConflict = function() {
util.getGlobal().Annotator = _Annotator;
return this;
};
$.plugin('annotator', Annotator);
this.Annotator = Annotator;
Annotator.Widget = (function(_super) {
__extends(Widget, _super);
Widget.prototype.classes = {
hide: 'annotator-hide',
invert: {
x: 'annotator-invert-x',
y: 'annotator-invert-y'
}
};
function Widget(element, options) {
Widget.__super__.constructor.apply(this, arguments);
this.classes = $.extend({}, Annotator.Widget.prototype.classes, this.classes);
}
Widget.prototype.checkOrientation = function() {
var current, offset, viewport, widget, window;
this.resetOrientation();
window = $(util.getGlobal());
widget = this.element.children(":first");
offset = widget.offset();
viewport = {
top: window.scrollTop(),
right: window.width() + window.scrollLeft()
};
current = {
top: offset.top,
right: offset.left + widget.width()
};
if ((current.top - viewport.top) < 0) {
this.invertY();
}
if ((current.right - viewport.right) > 0) {
this.invertX();
}
return this;
};
Widget.prototype.resetOrientation = function() {
this.element.removeClass(this.classes.invert.x).removeClass(this.classes.invert.y);
return this;
};
Widget.prototype.invertX = function() {
this.element.addClass(this.classes.invert.x);
return this;
};
Widget.prototype.invertY = function() {
this.element.addClass(this.classes.invert.y);
return this;
};
Widget.prototype.isInvertedY = function() {
return this.element.hasClass(this.classes.invert.y);
};
Widget.prototype.isInvertedX = function() {
return this.element.hasClass(this.classes.invert.x);
};
return Widget;
})(Delegator);
Annotator.Editor = (function(_super) {
__extends(Editor, _super);
Editor.prototype.events = {
"form submit": "submit",
".annotator-save click": "submit",
".annotator-cancel click": "hide",
".annotator-cancel mouseover": "onCancelButtonMouseover",
"textarea keydown": "processKeypress"
};
Editor.prototype.classes = {
hide: 'annotator-hide',
focus: 'annotator-focus'
};
Editor.prototype.html = "<div class=\"annotator-outer annotator-editor\">\n <form class=\"annotator-widget\">\n <ul class=\"annotator-listing\"></ul>\n <div class=\"annotator-controls\">\n <a href=\"#cancel\" class=\"annotator-cancel\">" + _t('Cancel') + "</a>\n<a href=\"#save\" class=\"annotator-save annotator-focus\">" + _t('Save') + "</a>\n </div>\n </form>\n</div>";
Editor.prototype.options = {};
function Editor(options) {
this.onCancelButtonMouseover = __bind(this.onCancelButtonMouseover, this);
this.processKeypress = __bind(this.processKeypress, this);
this.submit = __bind(this.submit, this);
this.load = __bind(this.load, this);
this.hide = __bind(this.hide, this);
this.show = __bind(this.show, this); Editor.__super__.constructor.call(this, $(this.html)[0], options);
this.fields = [];
this.annotation = {};
}
Editor.prototype.show = function(event) {
util.preventEventDefault(event);
this.element.removeClass(this.classes.hide);
this.element.find('.annotator-save').addClass(this.classes.focus);
this.checkOrientation();
this.element.find(":input:first").focus();
this.setupDraggables();
return this.publish('show');
};
Editor.prototype.hide = function(event) {
util.preventEventDefault(event);
this.element.addClass(this.classes.hide);
return this.publish('hide');
};
Editor.prototype.load = function(annotation) {
var field, _k, _len2, _ref2;
this.annotation = annotation;
this.publish('load', [this.annotation]);
_ref2 = this.fields;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
field = _ref2[_k];
field.load(field.element, this.annotation);
}
return this.show();
};
Editor.prototype.submit = function(event) {
var field, _k, _len2, _ref2;
util.preventEventDefault(event);
_ref2 = this.fields;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
field = _ref2[_k];
field.submit(field.element, this.annotation);
}
this.publish('save', [this.annotation]);
return this.hide();
};
Editor.prototype.addField = function(options) {
var element, field, input;
field = $.extend({
id: 'annotator-field-' + util.uuid(),
type: 'input',
label: '',
load: function() {},
submit: function() {}
}, options);
input = null;
element = $('<li class="annotator-item" />');
field.element = element[0];
switch (field.type) {
case 'textarea':
input = $('<textarea />');
break;
case 'input':
case 'checkbox':
input = $('<input />');
}
element.append(input);
input.attr({
id: field.id,
placeholder: field.label
});
if (field.type === 'checkbox') {
input[0].type = 'checkbox';
element.addClass('annotator-checkbox');
element.append($('<label />', {
"for": field.id,
html: field.label
}));
}
this.element.find('ul:first').append(element);
this.fields.push(field);
return field.element;
};
Editor.prototype.checkOrientation = function() {
var controls, list;
Editor.__super__.checkOrientation.apply(this, arguments);
list = this.element.find('ul');
controls = this.element.find('.annotator-controls');
if (this.element.hasClass(this.classes.invert.y)) {
controls.insertBefore(list);
} else if (controls.is(':first-child')) {
controls.insertAfter(list);
}
return this;
};
Editor.prototype.processKeypress = function(event) {
if (event.keyCode === 27) {
return this.hide();
} else if (event.keyCode === 13 && !event.shiftKey) {
return this.submit();
}
};
Editor.prototype.onCancelButtonMouseover = function() {
return this.element.find('.' + this.classes.focus).removeClass(this.classes.focus);
};
Editor.prototype.setupDraggables = function() {
var classes, controls, cornerItem, editor, mousedown, onMousedown, onMousemove, onMouseup, resize, textarea, throttle,
_this = this;
this.element.find('.annotator-resize').remove();
if (this.element.hasClass(this.classes.invert.y)) {
cornerItem = this.element.find('.annotator-item:last');
} else {
cornerItem = this.element.find('.annotator-item:first');
}
if (cornerItem) {
$('<span class="annotator-resize"></span>').appendTo(cornerItem);
}
mousedown = null;
classes = this.classes;
editor = this.element;
textarea = null;
resize = editor.find('.annotator-resize');
controls = editor.find('.annotator-controls');
throttle = false;
onMousedown = function(event) {
if (event.target === this) {
mousedown = {
element: this,
top: event.pageY,
left: event.pageX
};
textarea = editor.find('textarea:first');
$(window).bind({
'mouseup.annotator-editor-resize': onMouseup,
'mousemove.annotator-editor-resize': onMousemove
});
return event.preventDefault();
}
};
onMouseup = function() {
mousedown = null;
return $(window).unbind('.annotator-editor-resize');
};
onMousemove = function(event) {
var diff, directionX, directionY, height, width;
if (mousedown && throttle === false) {
diff = {
top: event.pageY - mousedown.top,
left: event.pageX - mousedown.left
};
if (mousedown.element === resize[0]) {
height = textarea.outerHeight();
width = textarea.outerWidth();
directionX = editor.hasClass(classes.invert.x) ? -1 : 1;
directionY = editor.hasClass(classes.invert.y) ? 1 : -1;
textarea.height(height + (diff.top * directionY));
textarea.width(width + (diff.left * directionX));
if (textarea.outerHeight() !== height) {
mousedown.top = event.pageY;
}
if (textarea.outerWidth() !== width) {
mousedown.left = event.pageX;
}
} else if (mousedown.element === controls[0]) {
editor.css({
top: parseInt(editor.css('top'), 10) + diff.top,
left: parseInt(editor.css('left'), 10) + diff.left
});
mousedown.top = event.pageY;
mousedown.left = event.pageX;
}
throttle = true;
return setTimeout(function() {
return throttle = false;
}, 1000 / 60);
}
};
resize.bind('mousedown', onMousedown);
return controls.bind('mousedown', onMousedown);
};
return Editor;
})(Annotator.Widget);
Annotator.Viewer = (function(_super) {
__extends(Viewer, _super);
Viewer.prototype.events = {
".annotator-edit click": "onEditClick",
".annotator-delete click": "onDeleteClick"
};
Viewer.prototype.classes = {
hide: 'annotator-hide',
showControls: 'annotator-visible'
};
Viewer.prototype.html = {
element: "<div class=\"annotator-outer annotator-viewer\">\n <ul class=\"annotator-widget annotator-listing\"></ul>\n</div>",
item: "<li class=\"annotator-annotation annotator-item\">\n <span class=\"annotator-controls\">\n <a href=\"#\" title=\"View as webpage\" class=\"annotator-link\">View as webpage</a>\n <button title=\"Edit\" class=\"annotator-edit\">Edit</button>\n <button title=\"Delete\" class=\"annotator-delete\">Delete</button>\n </span>\n</li>"
};
Viewer.prototype.options = {
readOnly: false
};
function Viewer(options) {
this.onDeleteClick = __bind(this.onDeleteClick, this);
this.onEditClick = __bind(this.onEditClick, this);
this.load = __bind(this.load, this);
this.hide = __bind(this.hide, this);
this.show = __bind(this.show, this); Viewer.__super__.constructor.call(this, $(this.html.element)[0], options);
this.item = $(this.html.item)[0];
this.fields = [];
this.annotations = [];
}
Viewer.prototype.show = function(event) {
var controls,
_this = this;
util.preventEventDefault(event);
controls = this.element.find('.annotator-controls').addClass(this.classes.showControls);
setTimeout((function() {
return controls.removeClass(_this.classes.showControls);
}), 500);
this.element.removeClass(this.classes.hide);
return this.checkOrientation().publish('show');
};
Viewer.prototype.isShown = function() {
return !this.element.hasClass(this.classes.hide);
};
Viewer.prototype.hide = function(event) {
util.preventEventDefault(event);
this.element.addClass(this.classes.hide);
return this.publish('hide');
};
Viewer.prototype.load = function(annotations) {
var annotation, controller, controls, del, edit, element, field, item, link, links, list, _k, _l, _len2, _len3, _ref2, _ref3;
this.annotations = annotations || [];
list = this.element.find('ul:first').empty();
_ref2 = this.annotations;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
annotation = _ref2[_k];
item = $(this.item).clone().appendTo(list).data('annotation', annotation);
controls = item.find('.annotator-controls');
link = controls.find('.annotator-link');
edit = controls.find('.annotator-edit');
del = controls.find('.annotator-delete');
links = new LinkParser(annotation.links || []).get('alternate', {
'type': 'text/html'
});
if (links.length === 0 || (links[0].href == null)) {
link.remove();
} else {
link.attr('href', links[0].href);
}
if (this.options.readOnly) {
edit.remove();
del.remove();
} else {
controller = {
showEdit: function() {
return edit.removeAttr('disabled');
},
hideEdit: function() {
return edit.attr('disabled', 'disabled');
},
showDelete: function() {
return del.removeAttr('disabled');
},
hideDelete: function() {
return del.attr('disabled', 'disabled');
}
};
}
_ref3 = this.fields;
for (_l = 0, _len3 = _ref3.length; _l < _len3; _l++) {
field = _ref3[_l];
element = $(field.element).clone().appendTo(item)[0];
field.load(element, annotation, controller);
}
}
this.publish('load', [this.annotations]);
return this.show();
};
Viewer.prototype.addField = function(options) {
var field;
field = $.extend({
load: function() {}
}, options);
field.element = $('<div />')[0];
this.fields.push(field);
field.element;
return this;
};
Viewer.prototype.onEditClick = function(event) {
return this.onButtonClick(event, 'edit');
};
Viewer.prototype.onDeleteClick = function(event) {
return this.onButtonClick(event, 'delete');
};
Viewer.prototype.onButtonClick = function(event, type) {
var item;
item = $(event.target).parents('.annotator-annotation');
return this.publish(type, [item.data('annotation')]);
};
return Viewer;
})(Annotator.Widget);
LinkParser = (function() {
function LinkParser(data) {
this.data = data;
}
LinkParser.prototype.get = function(rel, cond) {
var d, k, keys, match, v, _k, _len2, _ref2, _results;
if (cond == null) {
cond = {};
}
cond = $.extend({}, cond, {
rel: rel
});
keys = (function() {
var _results;
_results = [];
for (k in cond) {
if (!__hasProp.call(cond, k)) continue;
v = cond[k];
_results.push(k);
}
return _results;
})();
_ref2 = this.data;
_results = [];
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
d = _ref2[_k];
match = keys.reduce((function(m, k) {
return m && (d[k] === cond[k]);
}), true);
if (match) {
_results.push(d);
} else {
continue;
}
}
return _results;
};
return LinkParser;
})();
Annotator = Annotator || {};
Annotator.Notification = (function(_super) {
__extends(Notification, _super);
Notification.prototype.events = {
"click": "hide"
};
Notification.prototype.options = {
html: "<div class='annotator-notice'></div>",
classes: {
show: "annotator-notice-show",
info: "annotator-notice-info",
success: "annotator-notice-success",
error: "annotator-notice-error"
}
};
function Notification(options) {
this.hide = __bind(this.hide, this);
this.show = __bind(this.show, this); Notification.__super__.constructor.call(this, $(this.options.html).appendTo(document.body)[0], options);
}
Notification.prototype.show = function(message, status) {
if (status == null) {
status = Annotator.Notification.INFO;
}
$(this.element).addClass(this.options.classes.show).addClass(this.options.classes[status]).escape(message || "");
setTimeout(this.hide, 5000);
return this;
};
Notification.prototype.hide = function() {
$(this.element).removeClass(this.options.classes.show);
return this;
};
return Notification;
})(Delegator);
Annotator.Notification.INFO = 'show';
Annotator.Notification.SUCCESS = 'success';
Annotator.Notification.ERROR = 'error';
$(function() {
var notification;
notification = new Annotator.Notification;
Annotator.showNotification = notification.show;
return Annotator.hideNotification = notification.hide;
});
}).call(this);
/*
** Annotator v1.2.6
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-01-21 09:43:42Z
*/((function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=Array.prototype.slice,u=Object.prototype.hasOwnProperty,v=function(a,b){function d(){this.constructor=a}for(var c in b)u.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a},w=function(a,b){return function(){return a.apply(b,arguments)}};i=null,typeof Gettext!="undefined"&&Gettext!==null?(l=new Gettext({domain:"annotator"}),i=function(a){return l.gettext(a)}):i=function(a){return a},s=function(a){return i(a)},(typeof jQuery!="undefined"&&jQuery!==null?(q=jQuery.fn)!=null?q.jquery:void 0:void 0)||console.error(s("Annotator requires jQuery: have you included lib/vendor/jquery.js?")),JSON&&JSON.parse&&JSON.stringify||console.error(s("Annotator requires a JSON implementation: have you included lib/vendor/json2.js?")),a=jQuery.sub(),a.flatten=function(b){var c;return c=function(b){var d,e,f,g;e=[];for(f=0,g=b.length;f<g;f++)d=b[f],e=e.concat(d&&a.isArray(d)?c(d):d);return e},c(b)},a.plugin=function(b,c){return jQuery.fn[b]=function(d){var e;return e=Array.prototype.slice.call(arguments,1),this.each(function(){var f;return f=a.data(this,b),f?d&&f[d].apply(f,e):(f=new c(this,d),a.data(this,b,f))})}},a.fn.textNodes=function(){var b;return b=function(a){var c;if(a&&a.nodeType!==3){c=[];if(a.nodeType!==8){a=a.lastChild;while(a)c.push(b(a)),a=a.previousSibling}return c.reverse()}return a},this.map(function(){return a.flatten(b(this))})},a.fn.xpath=function(b){var c;return c=this.map(function(){var c,d,e;e="",c=this;while(c&&c.nodeType===1&&c!==b)d=a(c.parentNode).children(c.tagName).index(c)+1,d="["+d+"]",e="/"+c.tagName.toLowerCase()+d+e,c=c.parentNode;return e}),c.get()},a.escape=function(a){return a.replace(/&(?!\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},a.fn.escape=function(b){return arguments.length?this.html(a.escape(b)):this.html()},a.fn.reverse=[]._reverse||[].reverse,g=["log","debug","info","warn","exception","assert","dir","dirxml","trace","group","groupEnd","groupCollapsed","time","timeEnd","profile","profileEnd","count","clear","table","error","notifyFirebug","firebug","userObjects"];if(typeof console!="undefined"&&console!==null){console.group==null&&(console.group=function(a){return console.log("GROUP: ",a)}),console.groupCollapsed==null&&(console.groupCollapsed=console.group);for(m=0,o=g.length;m<o;m++)f=g[m],console[f]==null&&(console[f]=function(){return console.log(s("Not implemented:")+(" console."+name))})}else{this.console={};for(n=0,p=g.length;n<p;n++)f=g[n],this.console[f]=function(){};this.console.error=function(){var a;return a=1<=arguments.length?t.call(arguments,0):[],alert("ERROR: "+a.join(", "))},this.console.warn=function(){var a;return a=1<=arguments.length?t.call(arguments,0):[],alert("WARNING: "+a.join(", "))}}c=function(){function b(b,c){this.options=a.extend(!0,{},this.options,c),this.element=a(b),this.on=this.subscribe,this.addEvents()}return b.prototype.events={},b.prototype.options={},b.prototype.element=null,b.prototype.addEvents=function(){var a,b,c,d,e,f,g,h;f=this.events,h=[];for(c in f)b=f[c],g=c.split(" "),d=2<=g.length?t.call(g,0,e=g.length-1):(e=0,[]),a=g[e++],h.push(this.addEvent(d.join(" "),a,b));return h},b.prototype.addEvent=function(b,c,d){var e,f,g=this;return e=function(){return g[d].apply(g,arguments)},f=typeof b=="string"&&b.replace(/\s+/g,"")==="",f&&(b=this.element),typeof b=="string"?this.element.delegate(b,c,e):this.isCustomEvent(c)?this.subscribe(c,e):a(b).bind(c,e),this},b.prototype.isCustomEvent=function(c){return c=c.split(".")[0],a.inArray(c,b.natives)===-1},b.prototype.publish=function(){return this.element.triggerHandler.apply(this.element,arguments),this},b.prototype.subscribe=function(b,c){var d;return d=function(){return c.apply(this,[].slice.call(arguments,1))},d.guid=c.guid=a.guid+=1,this.element.bind(b,d),this},b.prototype.unsubscribe=function(){return this.element.unbind.apply(this.element,arguments),this},b}(),c.natives=function(){var a,b,c;return b=function(){var b,d;b=jQuery.event.special,d=[];for(a in b){if(!u.call(b,a))continue;c=b[a],d.push(a)}return d}(),"blur focus focusin focusout load resize scroll unload click dblclick\nmousedown mouseup mousemove mouseover mouseout mouseenter mouseleave\nchange select submit keydown keypress keyup error".split(/[^a-z]+/).concat(b)}(),e={},e.sniff=function(a){return a.commonAncestorContainer!=null?new e.BrowserRange(a):typeof a.start=="string"?new e.SerializedRange(a):a.start&&typeof a.start=="object"?new e.NormalizedRange(a):(console.error(s("Could not sniff range type")),!1)},e.nodeFromXPath=function(b,c){var d,e,f,g,h;return c==null&&(c=document),e=function(a,b){return b==null&&(b=null),document.evaluate("."+a,c,b,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue},a.isXMLDoc(document.documentElement)?(d=document.createNSResolver(document.ownerDocument===null?document.documentElement:document.ownerDocument.documentElement),g=e(b,d),g||(b=function(){var a,c,d,e;d=b.split("/"),e=[];for(a=0,c=d.length;a<c;a++)h=d[a],h&&h.indexOf(":")===-1?e.push(h.replace(/^([a-z]+)/,"xhtml:$1")):e.push(h);return e}().join("/"),f=document.lookupNamespaceURI(null),d=function(a){return a==="xhtml"?f:document.documentElement.getAttribute("xmlns:"+a)},g=e(b,d)),g):e(b)},e.RangeError=function(a){function b(a,c,d){this.type=a,this.message=c,this.parent=d!=null?d:null,b.__super__.constructor.call(this,this.message)}return v(b,a),b}(Error),e.BrowserRange=function(){function a(a){this.commonAncestorContainer=a.commonAncestorContainer,this.startContainer=a.startContainer,this.startOffset=a.startOffset,this.endContainer=a.endContainer,this.endOffset=a.endOffset}return a.prototype.normalize=function(a){var b,c,d,f,g,h,i,j,k;if(this.tainted)return console.error(s("You may only call normalize() once on a BrowserRange!")),!1;this.tainted=!0,h={},d={},k=["start","end"];for(i=0,j=k.length;i<j;i++){g=k[i],c=this[g+"Container"],f=this[g+"Offset"];if(c.nodeType===1){b=c.childNodes[f],c=b||c.childNodes[f-1],c.nodeType===1&&!c.firstChild&&(b=null,c=c.previousSibling);while(c.nodeType!==3)c=c.firstChild;f=b?0:c.nodeValue.length}h[g]=c,h[g+"Offset"]=f}d.start=h.startOffset>0?h.start.splitText(h.startOffset):h.start,h.start===h.end?(h.endOffset-h.startOffset<d.start.nodeValue.length&&d.start.splitText(h.endOffset-h.startOffset),d.end=d.start):(h.endOffset<h.end.nodeValue.length&&h.end.splitText(h.endOffset),d.end=h.end),d.commonAncestor=this.commonAncestorContainer;while(d.commonAncestor.nodeType!==1)d.commonAncestor=d.commonAncestor.parentNode;return new e.NormalizedRange(d)},a.prototype.serialize=function(a,b){return this.normalize(a).serialize(a,b)},a}(),e.NormalizedRange=function(){function b(a){this.commonAncestor=a.commonAncestor,this.start=a.start,this.end=a.end}return b.prototype.normalize=function(a){return this},b.prototype.limit=function(b){var c,d,e,f,g,h;c=a.grep(this.textNodes(),function(c){return c.parentNode===b||a.contains(b,c.parentNode)});if(!c.length)return null;this.start=c[0],this.end=c[c.length-1],e=a(this.start).parents(),h=a(this.end).parents();for(f=0,g=h.length;f<g;f++){d=h[f];if(e.index(d)!==-1){this.commonAncestor=d;break}}return this},b.prototype.serialize=function(b,c){var d,f,g;return f=function(d,e){var f,g,h,i,j,k,l,m;c?i=a(d).parents(":not("+c+")").eq(0):i=a(d).parent(),k=i.xpath(b)[0],j=i.textNodes(),g=j.slice(0,j.index(d)),h=0;for(l=0,m=g.length;l<m;l++)f=g[l],h+=f.nodeValue.length;return e?[k,h+d.nodeValue.length]:[k,h]},g=f(this.start),d=f(this.end,!0),new e.SerializedRange({start:g[0],end:d[0],startOffset:g[1],endOffset:d[1]})},b.prototype.text=function(){var a;return function(){var b,c,d,e;d=this.textNodes(),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.nodeValue);return e}.call(this).join("")},b.prototype.textNodes=function(){var b,c,d,e;return d=a(this.commonAncestor).textNodes(),e=[d.index(this.start),d.index(this.end)],c=e[0],b=e[1],a.makeArray(d.slice(c,b+1||9e9))},b.prototype.toRange=function(){var a;return a=document.createRange(),a.setStartBefore(this.start),a.setEndAfter(this.end),a},b}(),e.SerializedRange=function(){function b(a){this.start=a.start,this.startOffset=a.startOffset,this.end=a.end,this.endOffset=a.endOffset}return b.prototype.normalize=function(b){var c,d,f,g,h,i,j,k,l,m,n,o;h={},n=["start","end"];for(j=0,l=n.length;j<l;j++){g=n[j];try{f=e.nodeFromXPath(this[g],b)}catch(p){throw new e.RangeError(g,"Error while finding "+g+" node: "+this[g]+": "+p,p)}if(!f)throw new e.RangeError(g,"Couldn't find "+g+" node: "+this[g]);d=0,o=a(f).textNodes();for(k=0,m=o.length;k<m;k++){i=o[k];if(d+i.nodeValue.length>=this[g+"Offset"]){h[g+"Container"]=i,h[g+"Offset"]=this[g+"Offset"]-d;break}d+=i.nodeValue.length}if(h[g+"Offset"]==null)throw new e.RangeError(""+g+"offset","Couldn't find offset "+this[g+"Offset"]+" in element "+this[g])}return c=document.compareDocumentPosition==null?function(a,b){return a.contains(b)}:function(a,b){return a.compareDocumentPosition(b)&16},a(h.startContainer).parents().each(function(){if(c(this,h.endContainer))return h.commonAncestorContainer=this,!1}),(new e.BrowserRange(h)).normalize(b)},b.prototype.serialize=function(a,b){return this.normalize(a).serialize(a,b)},b.prototype.toObject=function(){return{start:this.start,startOffset:this.startOffset,end:this.end,endOffset:this.endOffset}},b}(),j={uuid:function(){var a;return a=0,function(){return a++}}(),getGlobal:function(){return function(){return this}()},maxZIndex:function(b){var c,d;return c=function(){var c,e,f;f=[];for(c=0,e=b.length;c<e;c++)d=b[c],a(d).css("position")==="static"?f.push(-1):f.push(parseInt(a(d).css("z-index"),10)||-1);return f}(),Math.max.apply(Math,c)},mousePosition:function(b,c){var d;return d=a(c).offset(),{top:b.pageY-d.top,left:b.pageX-d.left}},preventEventDefault:function(a){return a!=null?typeof a.preventDefault=="function"?a.preventDefault():void 0:void 0}},k=this.Annotator,b=function(b){function c(b,d){this.onDeleteAnnotation=w(this.onDeleteAnnotation,this),this.onEditAnnotation=w(this.onEditAnnotation,this),this.onAdderClick=w(this.onAdderClick,this),this.onAdderMousedown=w(this.onAdderMousedown,this),this.onHighlightMouseover=w(this.onHighlightMouseover,this),this.checkForEndSelection=w(this.checkForEndSelection,this),this.checkForStartSelection=w(this.checkForStartSelection,this),this.clearViewerHideTimer=w(this.clearViewerHideTimer,this),this.startViewerHideTimer=w(this.startViewerHideTimer,this),this.showViewer=w(this.showViewer,this),this.onEditorSubmit=w(this.onEditorSubmit,this),this.onEditorHide=w(this.onEditorHide,this),this.showEditor=w(this.showEditor,this),c.__super__.constructor.apply(this,arguments),this.plugins={};if(!c.supported())return this;this.options.readOnly||this._setupDocumentEvents(),this._setupWrapper()._setupViewer()._setupEditor(),this._setupDynamicStyle(),this.adder=a(this.html.adder).appendTo(this.wrapper).hide()}return v(c,b),c.prototype.events={".annotator-adder button click":"onAdderClick",".annotator-adder button mousedown":"onAdderMousedown",".annotator-hl mouseover":"onHighlightMouseover",".annotator-hl mouseout":"startViewerHideTimer"},c.prototype.html={adder:'<div class="annotator-adder"><button>'+s("Annotate")+"</button></div>",wrapper:'<div class="annotator-wrapper"></div>'},c.prototype.options={readOnly:!1},c.prototype.plugins={},c.prototype.editor=null,c.prototype.viewer=null,c.prototype.selectedRanges=null,c.prototype.mouseIsDown=!1,c.prototype.ignoreMouseup=!1,c.prototype.viewerHideTimer=null,c.prototype._setupWrapper=function(){return this.wrapper=a(this.html.wrapper),this.element.find("script").remove(),this.element.wrapInner(this.wrapper),this.wrapper=this.element.find(".annotator-wrapper"),this},c.prototype._setupViewer=function(){var b=this;return this.viewer=new c.Viewer({readOnly:this.options.readOnly}),this.viewer.hide().on("edit",this.onEditAnnotation).on("delete",this.onDeleteAnnotation).addField({load:function(c,d){return d.text?a(c).escape(d.text):a(c).html("<i>"+s("No Comment")+"</i>"),b.publish("annotationViewerTextField",[c,d])}}).element.appendTo(this.wrapper).bind({mouseover:this.clearViewerHideTimer,mouseout:this.startViewerHideTimer}),this},c.prototype._setupEditor=function(){return this.editor=new c.Editor,this.editor.hide().on("hide",this.onEditorHide).on("save",this.onEditorSubmit).addField({type:"textarea",label:s("Comments")+"…",load:function(b,c){return a(b).find("textarea").val(c.text||"")},submit:function(b,c){return c.text=a(b).find("textarea").val()}}),this.editor.element.appendTo(this.wrapper),this},c.prototype._setupDocumentEvents=function(){return a(document).bind({mouseup:this.checkForEndSelection,mousedown:this.checkForStartSelection}),this},c.prototype._setupDynamicStyle=function(){var b,c,d,e;return d=a("#annotator-dynamic-style"),d.length||(d=a('<style id="annotator-dynamic-style"></style>').appendTo(document.head)),c="*"+function(){var a,b,c,d;c=["adder","outer","notice","filter"],d=[];for(a=0,b=c.length;a<b;a++)e=c[a],d.push(":not(.annotator-"+e+")");return d}().join(""),b=j.maxZIndex(a(document.body).find(c)),b=Math.max(b,1e3),d.text([".annotator-adder, .annotator-outer, .annotator-notice {"," z-index: "+(b+20)+";","}",".annotator-filter {"," z-index: "+(b+10)+";","}"].join("\n")),this},c.prototype.getSelectedRanges=function(){var b,c,d,f,g,h,i,k,l;i=j.getGlobal().getSelection(),g=[],h=[],i.isCollapsed||(g=function(){var a,g;g=[];for(c=0,a=i.rangeCount;0<=a?c<a:c>a;0<=a?c++:c--)f=i.getRangeAt(c),b=new e.BrowserRange(f),d=b.normalize().limit(this.wrapper[0]),d===null&&h.push(f),g.push(d);return g}.call(this),i.removeAllRanges());for(k=0,l=h.length;k<l;k++)f=h[k],i.addRange(f);return a.grep(g,function(a){return a&&i.addRange(a.toRange()),a})},c.prototype.createAnnotation=function(){var a;return a={},this.publish("beforeAnnotationCreated",[a]),a},c.prototype.setupAnnotation=function(b,c){var d,f,g,h,i,j,k,l,m;c==null&&(c=!0),h=this.wrapper[0],b.ranges||(b.ranges=this.selectedRanges),f=[],m=b.ranges;for(i=0,k=m.length;i<k;i++){g=m[i];try{f.push(e.sniff(g).normalize(h))}catch(n){if(!(n instanceof e.RangeError))throw n;this.publish("rangeNormalizeFail",[b,g,n])}}b.quote=[],b.ranges=[],b.highlights=[];for(j=0,l=f.length;j<l;j++)d=f[j],b.quote.push(a.trim(d.text())),b.ranges.push(d.serialize(this.wrapper[0],".annotator-hl")),a.merge(b.highlights,this.highlightRange(d));return b.quote=b.quote.join(" / "),a(b.highlights).data("annotation",b),c&&this.publish("annotationCreated",[b]),b},c.prototype.updateAnnotation=function(a){return this.publish("beforeAnnotationUpdated",[a]),this.publish("annotationUpdated",[a]),a},c.prototype.deleteAnnotation=function(b){var c,d,e,f;f=b.highlights;for(d=0,e=f.length;d<e;d++)c=f[d],a(c).replaceWith(c.childNodes);return this.publish("annotationDeleted",[b]),b},c.prototype.loadAnnotations=function(a){var b,c,d=this;return a==null&&(a=[]),c=function(a){var e,f,g,h;a==null&&(a=[]),f=a.splice(0,10);for(g=0,h=f.length;g<h;g++)e=f[g],d.setupAnnotation(e,!1);return a.length>0?setTimeout(function(){return c(a)},10):d.publish("annotationsLoaded",[b])},b=a.slice(),a.length&&c(a),this},c.prototype.dumpAnnotations=function(){return this.plugins.Store?this.plugins.Store.dumpAnnotations():console.warn(s("Can't dump annotations without Store plugin."))},c.prototype.highlightRange=function(b,c){var d,e,f,g,h,i,j;c==null&&(c="annotator-hl"),f=/^\s*$/,d=a("<span class='"+c+"'></span>"),i=b.textNodes(),j=[];for(g=0,h=i.length;g<h;g++)e=i[g],f.test(e.nodeValue)||j.push(a(e).wrapAll(d).parent().show()[0]);return j},c.prototype.highlightRanges=function(b,c){var d,e,f,g;c==null&&(c="annotator-hl"),d=[];for(f=0,g=b.length;f<g;f++)e=b[f],a.merge(d,this.highlightRange(e,c));return d},c.prototype.addPlugin=function(a,b){var d,e;return this.plugins[a]?console.error(s("You cannot have more than one instance of any plugin.")):(d=c.Plugin[a],typeof d=="function"?(this.plugins[a]=new d(this.element[0],b),this.plugins[a].annotator=this,typeof (e=this.plugins[a]).pluginInit=="function"&&e.pluginInit()):console.error(s("Could not load ")+a+s(" plugin. Have you included the appropriate <script> tag?"))),this},c.prototype.showEditor=function(a,b){return this.editor.element.css(b),this.editor.load(a),this.publish("annotationEditorShown",[this.editor,a]),this},c.prototype.onEditorHide=function(){return this.publish("annotationEditorHidden",[this.editor]),this.ignoreMouseup=!1},c.prototype.onEditorSubmit=function(a){return this.publish("annotationEditorSubmit",[this.editor,a]),a.ranges===void 0?this.setupAnnotation(a):this.updateAnnotation(a)},c.prototype.showViewer=function(a,b){return this.viewer.element.css(b),this.viewer.load(a),this.publish("annotationViewerShown",[this.viewer,a])},c.prototype.startViewerHideTimer=function(){if(!this.viewerHideTimer)return this.viewerHideTimer=setTimeout(this.viewer.hide,250)},c.prototype.clearViewerHideTimer=function(){return clearTimeout(this.viewerHideTimer),this.viewerHideTimer=!1},c.prototype.checkForStartSelection=function(a){if(!a||!this.isAnnotator(a.target))return this.startViewerHideTimer(),this.mouseIsDown=!0},c.prototype.checkForEndSelection=function(b){var c,d,e,f,g;this.mouseIsDown=!1;if(this.ignoreMouseup)return;this.selectedRanges=this.getSelectedRanges(),g=this.selectedRanges;for(e=0,f=g.length;e<f;e++){d=g[e],c=d.commonAncestor,a(c).hasClass("annotator-hl")&&(c=a(c).parents("[class^=annotator-hl]")[0]);if(this.isAnnotator(c))return}return b&&this.selectedRanges.length?this.adder.css(j.mousePosition(b,this.wrapper[0])).show():this.adder.hide()},c.prototype.isAnnotator=function(b){return!!a(b).parents().andSelf().filter("[class^=annotator-]").not(this.wrapper).length},c.prototype.onHighlightMouseover=function(b){var c;return this.clearViewerHideTimer(),this.mouseIsDown||this.viewer.isShown()?!1:(c=a(b.target).parents(".annotator-hl").andSelf().map(function(){return a(this).data("annotation")}),this.showViewer(a.makeArray(c),j.mousePosition(b,this.wrapper[0])))},c.prototype.onAdderMousedown=function(a){return a!=null&&a.preventDefault(),this.ignoreMouseup=!0},c.prototype.onAdderClick=function(b){var c,d,f,g;return b!=null&&b.preventDefault(),d=this.adder.position(),this.adder.hide(),this.selectedRanges&&this.selectedRanges.length&&(g=function(){var a,b,c,d;c=this.selectedRanges,d=[];for(a=0,b=c.length;a<b;a++)f=c[a],d.push(e.sniff(f).normalize());return d}.call(this),c=this.highlightRanges(g,"annotator-hl annotator-hl-temporary"),this.editor.element.one("hide",function(){var b,d,e,f;f=[];for(d=0,e=c.length;d<e;d++)b=c[d],f.push(a(b).replaceWith(b.childNodes));return f})),this.showEditor(this.createAnnotation(),d)},c.prototype.onEditAnnotation=function(a){var b;return b=this.viewer.element.position(),this.viewer.hide(),this.showEditor(a,b)},c.prototype.onDeleteAnnotation=function(a){return this.viewer.hide(),this.deleteAnnotation(a)},c}(c),b.Plugin=function(a){function b(a,c){b.__super__.constructor.apply(this,arguments)}return v(b,a),b.prototype.pluginInit=function(){},b}(c),h=j.getGlobal(),((r=h.document)!=null?r.evaluate:void 0)==null&&a.getScript("http://assets.annotateit.org/vendor/xpath.min.js"),h.getSelection==null&&a.getScript("http://assets.annotateit.org/vendor/ierange.min.js"),h.JSON==null&&a.getScript("http://assets.annotateit.org/vendor/json2.min.js"),b.$=a,b.Delegator=c,b.Range=e,b._t=s,b.supported=function(){return function(){return!!this.getSelection}()},b.noConflict=function(){return j.getGlobal().Annotator=k,this},a.plugin("annotator",b),this.Annotator=b,b.Widget=function(c){function d(c,e){d.__super__.constructor.apply(this,arguments),this.classes=a.extend({},b.Widget.prototype.classes,this.classes)}return v(d,c),d.prototype.classes={hide:"annotator-hide",invert:{x:"annotator-invert-x",y:"annotator-invert-y"}},d.prototype.checkOrientation=function(){var b,c,d,e,f;return this.resetOrientation(),f=a(j.getGlobal()),e=this.element.children(":first"),c=e.offset(),d={top:f.scrollTop(),right:f.width()+f.scrollLeft()},b={top:c.top,right:c.left+e.width()},b.top-d.top<0&&this.invertY(),b.right-d.right>0&&this.invertX(),this},d.prototype.resetOrientation=function(){return this.element.removeClass(this.classes.invert.x).removeClass(this.classes.invert.y),this},d.prototype.invertX=function(){return this.element.addClass(this.classes.invert.x),this},d.prototype.invertY=function(){return this.element.addClass(this.classes.invert.y),this},d.prototype.isInvertedY=function(){return this.element.hasClass(this.classes.invert.y)},d.prototype.isInvertedX=function(){return this.element.hasClass(this.classes.invert.x)},d}(c),b.Editor=function(b){function c(b){this.onCancelButtonMouseover=w(this.onCancelButtonMouseover,this),this.processKeypress=w(this.processKeypress,this),this.submit=w(this.submit,this),this.load=w(this.load,this),this.hide=w(this.hide,this),this.show=w(this.show,this),c.__super__.constructor.call(this,a(this.html)[0],b),this.fields=[],this.annotation={}}return v(c,b),c.prototype.events={"form submit":"submit",".annotator-save click":"submit",".annotator-cancel click":"hide",".annotator-cancel mouseover":"onCancelButtonMouseover","textarea keydown":"processKeypress"},c.prototype.classes={hide:"annotator-hide",focus:"annotator-focus"},c.prototype.html='<div class="annotator-outer annotator-editor">\n <form class="annotator-widget">\n <ul class="annotator-listing"></ul>\n <div class="annotator-controls">\n <a href="#cancel" class="annotator-cancel">'+s("Cancel")+'</a>\n<a href="#save" class="annotator-save annotator-focus">'+s("Save")+"</a>\n </div>\n </form>\n</div>",c.prototype.options={},c.prototype.show=function(a){return j.preventEventDefault(a),this.element.removeClass(this.classes.hide),this.element.find(".annotator-save").addClass(this.classes.focus),this.checkOrientation(),this.element.find(":input:first").focus(),this.setupDraggables(),this.publish("show")},c.prototype.hide=function(a){return j.preventEventDefault(a),this.element.addClass(this.classes.hide),this.publish("hide")},c.prototype.load=function(a){var b,c,d,e;this.annotation=a,this.publish("load",[this.annotation]),e=this.fields;for(c=0,d=e.length;c<d;c++)b=e[c],b.load(b.element,this.annotation);return this.show()},c.prototype.submit=function(a){var b,c,d,e;j.preventEventDefault(a),e=this.fields;for(c=0,d=e.length;c<d;c++)b=e[c],b.submit(b.element,this.annotation);return this.publish("save",[this.annotation]),this.hide()},c.prototype.addField=function(b){var c,d,e;d=a.extend({id:"annotator-field-"+j.uuid(),type:"input",label:"",load:function(){},submit:function(){}},b),e=null,c=a('<li class="annotator-item" />'),d.element=c[0];switch(d.type){case"textarea":e=a("<textarea />");break;case"input":case"checkbox":e=a("<input />")}return c.append(e),e.attr({id:d.id,placeholder:d.label}),d.type==="checkbox"&&(e[0].type="checkbox",c.addClass("annotator-checkbox"),c.append(a("<label />",{"for":d.id,html:d.label}))),this.element.find("ul:first").append(c),this.fields.push(d),d.element},c.prototype.checkOrientation=function(){var a,b;return c.__super__.checkOrientation.apply(this,arguments),b=this.element.find("ul"),a=this.element.find(".annotator-controls"),this.element.hasClass(this.classes.invert.y)?a.insertBefore(b):a.is(":first-child")&&a.insertAfter(b),this},c.prototype.processKeypress=function(a){if(a.keyCode===27)return this.hide();if(a.keyCode===13&&!a.shiftKey)return this.submit()},c.prototype.onCancelButtonMouseover=function(){return this.element.find("."+this.classes.focus).removeClass(this.classes.focus)},c.prototype.setupDraggables=function(){var b,c,d,e,f,g,h,i,j,k,l,m=this;return this.element.find(".annotator-resize").remove(),this.element.hasClass(this.classes.invert.y)?d=this.element.find(".annotator-item:last"):d=this.element.find(".annotator-item:first"),d&&a('<span class="annotator-resize"></span>').appendTo(d),f=null,b=this.classes,e=this.element,k=null,j=e.find(".annotator-resize"),c=e.find(".annotator-controls"),l=!1,g=function(b){if(b.target===this)return f={element:this,top:b.pageY,left:b.pageX},k=e.find("textarea:first"),a(window).bind({"mouseup.annotator-editor-resize":i,"mousemove.annotator-editor-resize":h}),b.preventDefault()},i=function(){return f=null,a(window).unbind(".annotator-editor-resize")},h=function(a){var d,g,h,i,m;if(f&&l===!1)return d={top:a.pageY-f.top,left:a.pageX-f.left},f.element===j[0]?(i=k.outerHeight(),m=k.outerWidth(),g=e.hasClass(b.invert.x)?-1:1,h=e.hasClass(b.invert.y)?1:-1,k.height(i+d.top*h),k.width(m+d.left*g),k.outerHeight()!==i&&(f.top=a.pageY),k.outerWidth()!==m&&(f.left=a.pageX)):f.element===c[0]&&(e.css({top:parseInt(e.css("top"),10)+d.top,left:parseInt(e.css("left"),10)+d.left}),f.top=a.pageY,f.left=a.pageX),l=!0,setTimeout(function(){return l=!1},1e3/60)},j.bind("mousedown",g),c.bind("mousedown",g)},c}(b.Widget),b.Viewer=function(b){function c(b){this.onDeleteClick=w(this.onDeleteClick,this),this.onEditClick=w(this.onEditClick,this),this.load=w(this.load,this),this.hide=w(this.hide,this),this.show=w(this.show,this),c.__super__.constructor.call(this,a(this.html.element)[0],b),this.item=a(this.html.item)[0],this.fields=[],this.annotations=[]}return v(c,b),c.prototype.events={".annotator-edit click":"onEditClick",".annotator-delete click":"onDeleteClick"},c.prototype.classes={hide:"annotator-hide",showControls:"annotator-visible"},c.prototype.html={element:'<div class="annotator-outer annotator-viewer">\n <ul class="annotator-widget annotator-listing"></ul>\n</div>',item:'<li class="annotator-annotation annotator-item">\n <span class="annotator-controls">\n <a href="#" title="View as webpage" class="annotator-link">View as webpage</a>\n <button title="Edit" class="annotator-edit">Edit</button>\n <button title="Delete" class="annotator-delete">Delete</button>\n </span>\n</li>'},c.prototype.options={readOnly:!1},c.prototype.show=function(a){var b,c=this;return j.preventEventDefault(a),b=this.element.find(".annotator-controls").addClass(this.classes.showControls),setTimeout(function(){return b.removeClass(c.classes.showControls)},500),this.element.removeClass(this.classes.hide),this.checkOrientation().publish("show")},c.prototype.isShown=function(){return!this.element.hasClass(this.classes.hide)},c.prototype.hide=function(a){return j.preventEventDefault(a),this.element.addClass(this.classes.hide),this.publish("hide")},c.prototype.load=function(b){var c,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t;this.annotations=b||[],n=this.element.find("ul:first").empty(),s=this.annotations;for(o=0,q=s.length;o<q;o++){c=s[o],k=a(this.item).clone().appendTo(n).data("annotation",c),f=k.find(".annotator-controls"),l=f.find(".annotator-link"),h=f.find(".annotator-edit"),g=f.find(".annotator-delete"),m=(new d(c.links||[])).get("alternate",{type:"text/html"}),m.length===0||m[0].href==null?l.remove():l.attr("href",m[0].href),this.options.readOnly?(h.remove(),g.remove()):e={showEdit:function(){return h.removeAttr("disabled")},hideEdit:function(){return h.attr("disabled","disabled")},showDelete:function(){return g.removeAttr("disabled")},hideDelete:function(){return g.attr("disabled","disabled")}},t=this.fields;for(p=0,r=t.length;p<r;p++)j=t[p],i=a(j.element).clone().appendTo(k)[0],j.load(i,c,e)}return this.publish("load",[this.annotations]),this.show()},c.prototype.addField=function(b){var c;return c=a.extend({load:function(){}},b),c.element=a("<div />")[0],this.fields.push(c),c.element,this},c.prototype.onEditClick=function(a){return this.onButtonClick(a,"edit")},c.prototype.onDeleteClick=function(a){return this.onButtonClick(a,"delete")},c.prototype.onButtonClick=function(b,c){var d;return d=a(b.target).parents(".annotator-annotation"),this.publish(c,[d.data("annotation")])},c}(b.Widget),d=function(){function b(a){this.data=a}return b.prototype.get=function(b,c){var d,e,f,g,h,i,j,k,l;c==null&&(c={}),c=a.extend({},c,{rel:b}),f=function(){var a;a=[];for(e in c){if(!u.call(c,e))continue;h=c[e],a.push(e)}return a}(),k=this.data,l=[];for(i=0,j=k.length;i<j;i++){d=k[i],g=f.reduce(function(a,b){return a&&d[b]===c[b]},!0);if(!g)continue;l.push(d)}return l},b}(),b=b||{},b.Notification=function(c){function d(b){this.hide=w(this.hide,this),this.show=w(this.show,this),d.__super__.constructor.call(this,a(this.options.html).appendTo(document.body)[0],b)}return v(d,c),d.prototype.events={click:"hide"},d.prototype.options={html:"<div class='annotator-notice'></div>",classes:{show:"annotator-notice-show",info:"annotator-notice-info",success:"annotator-notice-success",error:"annotator-notice-error"}},d.prototype.show=function(c,d){return d==null&&(d=b.Notification.INFO),a(this.element).addClass(this.options.classes.show).addClass(this.options.classes[d]).escape(c||""),setTimeout(this.hide,5e3),this},d.prototype.hide=function(){return a(this.element).removeClass(this.options.classes.show),this},d}(c),b.Notification.INFO="show",b.Notification.SUCCESS="success",b.Notification.ERROR="error",a(function(){var a;return a=new b.Notification,b.showNotification=a.show,b.hideNotification=a.hide})})).call(this);
\ No newline at end of file
(function(){var $,Annotator,Delegator,LinkParser,Range,findChild,fn,functions,g,getNodeName,getNodePosition,gettext,simpleXPathJQuery,simpleXPathPure,util,_Annotator,_gettext,_i,_j,_len,_len1,_ref,_ref1,_t,__slice=[].slice,__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},__bind=function(fn,me){return function(){return fn.apply(me,arguments)}};simpleXPathJQuery=function(relativeRoot){var jq;jq=this.map(function(){var elem,idx,path,tagName;path="";elem=this;while(elem&&elem.nodeType===1&&elem!==relativeRoot){tagName=elem.tagName.replace(":","\\:");idx=$(elem.parentNode).children(tagName).index(elem)+1;idx="["+idx+"]";path="/"+elem.tagName.toLowerCase()+idx+path;elem=elem.parentNode}return path});return jq.get()};simpleXPathPure=function(relativeRoot){var getPathSegment,getPathTo,jq,rootNode;getPathSegment=function(node){var name,pos;name=getNodeName(node);pos=getNodePosition(node);return""+name+"["+pos+"]"};rootNode=relativeRoot;getPathTo=function(node){var xpath;xpath="";while(node!==rootNode){if(node==null){throw new Error("Called getPathTo on a node which was not a descendant of @rootNode. "+rootNode)}xpath=getPathSegment(node)+"/"+xpath;node=node.parentNode}xpath="/"+xpath;xpath=xpath.replace(/\/$/,"");return xpath};jq=this.map(function(){var path;path=getPathTo(this);return path});return jq.get()};findChild=function(node,type,index){var child,children,found,name,_i,_len;if(!node.hasChildNodes()){throw new Error("XPath error: node has no children!")}children=node.childNodes;found=0;for(_i=0,_len=children.length;_i<_len;_i++){child=children[_i];name=getNodeName(child);if(name===type){found+=1;if(found===index){return child}}}throw new Error("XPath error: wanted child not found.")};getNodeName=function(node){var nodeName;nodeName=node.nodeName.toLowerCase();switch(nodeName){case"#text":return"text()";case"#comment":return"comment()";case"#cdata-section":return"cdata-section()";default:return nodeName}};getNodePosition=function(node){var pos,tmp;pos=0;tmp=node;while(tmp){if(tmp.nodeName===node.nodeName){pos++}tmp=tmp.previousSibling}return pos};gettext=null;if(typeof Gettext!=="undefined"&&Gettext!==null){_gettext=new Gettext({domain:"annotator"});gettext=function(msgid){return _gettext.gettext(msgid)}}else{gettext=function(msgid){return msgid}}_t=function(msgid){return gettext(msgid)};if(!(typeof jQuery!=="undefined"&&jQuery!==null?(_ref=jQuery.fn)!=null?_ref.jquery:void 0:void 0)){console.error(_t("Annotator requires jQuery: have you included lib/vendor/jquery.js?"))}if(!(JSON&&JSON.parse&&JSON.stringify)){console.error(_t("Annotator requires a JSON implementation: have you included lib/vendor/json2.js?"))}$=jQuery.sub();$.flatten=function(array){var flatten;flatten=function(ary){var el,flat,_i,_len;flat=[];for(_i=0,_len=ary.length;_i<_len;_i++){el=ary[_i];flat=flat.concat(el&&$.isArray(el)?flatten(el):el)}return flat};return flatten(array)};$.plugin=function(name,object){return jQuery.fn[name]=function(options){var args;args=Array.prototype.slice.call(arguments,1);return this.each(function(){var instance;instance=$.data(this,name);if(instance){return options&&instance[options].apply(instance,args)}else{instance=new object(this,options);return $.data(this,name,instance)}})}};$.fn.textNodes=function(){var getTextNodes;getTextNodes=function(node){var nodes;if(node&&node.nodeType!==3){nodes=[];if(node.nodeType!==8){node=node.lastChild;while(node){nodes.push(getTextNodes(node));node=node.previousSibling}}return nodes.reverse()}else{return node}};return this.map(function(){return $.flatten(getTextNodes(this))})};$.fn.xpath=function(relativeRoot){var exception,result;try{result=simpleXPathJQuery.call(this,relativeRoot)}catch(_error){exception=_error;console.log("jQuery-based XPath construction failed! Falling back to manual.");result=simpleXPathPure.call(this,relativeRoot)}return result};$.xpath=function(xp,root){var idx,name,node,step,steps,_i,_len,_ref1;steps=xp.substring(1).split("/");node=root;for(_i=0,_len=steps.length;_i<_len;_i++){step=steps[_i];_ref1=step.split("["),name=_ref1[0],idx=_ref1[1];idx=idx!=null?parseInt((idx!=null?idx.split("]"):void 0)[0]):1;node=findChild(node,name.toLowerCase(),idx)}return node};$.escape=function(html){return html.replace(/&(?!\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")};$.fn.escape=function(html){if(arguments.length){return this.html($.escape(html))}return this.html()};$.fn.reverse=[]._reverse||[].reverse;functions=["log","debug","info","warn","exception","assert","dir","dirxml","trace","group","groupEnd","groupCollapsed","time","timeEnd","profile","profileEnd","count","clear","table","error","notifyFirebug","firebug","userObjects"];if(typeof console!=="undefined"&&console!==null){if(console.group==null){console.group=function(name){return console.log("GROUP: ",name)}}if(console.groupCollapsed==null){console.groupCollapsed=console.group}for(_i=0,_len=functions.length;_i<_len;_i++){fn=functions[_i];if(console[fn]==null){console[fn]=function(){return console.log(_t("Not implemented:")+(" console."+name))}}}}else{this.console={};for(_j=0,_len1=functions.length;_j<_len1;_j++){fn=functions[_j];this.console[fn]=function(){}}this.console["error"]=function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];return alert("ERROR: "+args.join(", "))};this.console["warn"]=function(){var args;args=1<=arguments.length?__slice.call(arguments,0):[];return alert("WARNING: "+args.join(", "))}}Delegator=function(){Delegator.prototype.events={};Delegator.prototype.options={};Delegator.prototype.element=null;function Delegator(element,options){this.options=$.extend(true,{},this.options,options);this.element=$(element);this.on=this.subscribe;this.addEvents()}Delegator.prototype.addEvents=function(){var event,functionName,sel,selector,_k,_ref1,_ref2,_results;_ref1=this.events;_results=[];for(sel in _ref1){functionName=_ref1[sel];_ref2=sel.split(" "),selector=2<=_ref2.length?__slice.call(_ref2,0,_k=_ref2.length-1):(_k=0,[]),event=_ref2[_k++];_results.push(this.addEvent(selector.join(" "),event,functionName))}return _results};Delegator.prototype.addEvent=function(bindTo,event,functionName){var closure,isBlankSelector,_this=this;closure=function(){return _this[functionName].apply(_this,arguments)};isBlankSelector=typeof bindTo==="string"&&bindTo.replace(/\s+/g,"")==="";if(isBlankSelector){bindTo=this.element}if(typeof bindTo==="string"){this.element.delegate(bindTo,event,closure)}else{if(this.isCustomEvent(event)){this.subscribe(event,closure)}else{$(bindTo).bind(event,closure)}}return this};Delegator.prototype.isCustomEvent=function(event){event=event.split(".")[0];return $.inArray(event,Delegator.natives)===-1};Delegator.prototype.publish=function(){this.element.triggerHandler.apply(this.element,arguments);return this};Delegator.prototype.subscribe=function(event,callback){var closure;closure=function(){return callback.apply(this,[].slice.call(arguments,1))};closure.guid=callback.guid=$.guid+=1;this.element.bind(event,closure);return this};Delegator.prototype.unsubscribe=function(){this.element.unbind.apply(this.element,arguments);return this};return Delegator}();Delegator.natives=function(){var key,specials,val;specials=function(){var _ref1,_results;_ref1=jQuery.event.special;_results=[];for(key in _ref1){if(!__hasProp.call(_ref1,key))continue;val=_ref1[key];_results.push(key)}return _results}();return"blur focus focusin focusout load resize scroll unload click dblclick\nmousedown mouseup mousemove mouseover mouseout mouseenter mouseleave\nchange select submit keydown keypress keyup error".split(/[^a-z]+/).concat(specials)}();Range={};Range.sniff=function(r){if(r.commonAncestorContainer!=null){return new Range.BrowserRange(r)}else if(typeof r.start==="string"){return new Range.SerializedRange(r)}else if(r.start&&typeof r.start==="object"){return new Range.NormalizedRange(r)}else{console.error(_t("Could not sniff range type"));return false}};Range.nodeFromXPath=function(xpath,root){var customResolver,evaluateXPath,namespace,node,segment;if(root==null){root=document}evaluateXPath=function(xp,nsResolver){var exception;if(nsResolver==null){nsResolver=null}try{return document.evaluate("."+xp,root,nsResolver,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}catch(_error){exception=_error;console.log("XPath evaluation failed.");console.log("Trying fallback...");return $.xpath(xp,root)}};if(!$.isXMLDoc(document.documentElement)){return evaluateXPath(xpath)}else{customResolver=document.createNSResolver(document.ownerDocument===null?document.documentElement:document.ownerDocument.documentElement);node=evaluateXPath(xpath,customResolver);if(!node){xpath=function(){var _k,_len2,_ref1,_results;_ref1=xpath.split("/");_results=[];for(_k=0,_len2=_ref1.length;_k<_len2;_k++){segment=_ref1[_k];if(segment&&segment.indexOf(":")===-1){_results.push(segment.replace(/^([a-z]+)/,"xhtml:$1"))}else{_results.push(segment)}}return _results}().join("/");namespace=document.lookupNamespaceURI(null);customResolver=function(ns){if(ns==="xhtml"){return namespace}else{return document.documentElement.getAttribute("xmlns:"+ns)}};node=evaluateXPath(xpath,customResolver)}return node}};Range.RangeError=function(_super){__extends(RangeError,_super);function RangeError(type,message,parent){this.type=type;this.message=message;this.parent=parent!=null?parent:null;RangeError.__super__.constructor.call(this,this.message)}return RangeError}(Error);Range.BrowserRange=function(){function BrowserRange(obj){this.commonAncestorContainer=obj.commonAncestorContainer;this.startContainer=obj.startContainer;this.startOffset=obj.startOffset;this.endContainer=obj.endContainer;this.endOffset=obj.endOffset}BrowserRange.prototype.normalize=function(root){var it,node,nr,offset,p,r,_k,_len2,_ref1;if(this.tainted){console.error(_t("You may only call normalize() once on a BrowserRange!"));return false}else{this.tainted=true}r={};nr={};_ref1=["start","end"];for(_k=0,_len2=_ref1.length;_k<_len2;_k++){p=_ref1[_k];node=this[p+"Container"];offset=this[p+"Offset"];if(node.nodeType===1){it=node.childNodes[offset];node=it||node.childNodes[offset-1];if(node.nodeType===1&&!node.firstChild){it=null;node=node.previousSibling}while(node.nodeType!==3){node=node.firstChild}offset=it?0:node.nodeValue.length}r[p]=node;r[p+"Offset"]=offset}nr.start=r.startOffset>0?r.start.splitText(r.startOffset):r.start;if(r.start===r.end){if(r.endOffset-r.startOffset<nr.start.nodeValue.length){nr.start.splitText(r.endOffset-r.startOffset)}nr.end=nr.start}else{if(r.endOffset<r.end.nodeValue.length){r.end.splitText(r.endOffset)}nr.end=r.end}nr.commonAncestor=this.commonAncestorContainer;while(nr.commonAncestor.nodeType!==1){nr.commonAncestor=nr.commonAncestor.parentNode}return new Range.NormalizedRange(nr)};BrowserRange.prototype.serialize=function(root,ignoreSelector){return this.normalize(root).serialize(root,ignoreSelector)};return BrowserRange}();Range.NormalizedRange=function(){function NormalizedRange(obj){this.commonAncestor=obj.commonAncestor;this.start=obj.start;this.end=obj.end}NormalizedRange.prototype.normalize=function(root){return this};NormalizedRange.prototype.limit=function(bounds){var nodes,parent,startParents,_k,_len2,_ref1;nodes=$.grep(this.textNodes(),function(node){return node.parentNode===bounds||$.contains(bounds,node.parentNode)});if(!nodes.length){return null}this.start=nodes[0];this.end=nodes[nodes.length-1];startParents=$(this.start).parents();_ref1=$(this.end).parents();for(_k=0,_len2=_ref1.length;_k<_len2;_k++){parent=_ref1[_k];if(startParents.index(parent)!==-1){this.commonAncestor=parent;break}}return this};NormalizedRange.prototype.serialize=function(root,ignoreSelector){var end,serialization,start;serialization=function(node,isEnd){var n,nodes,offset,origParent,textNodes,xpath,_k,_len2;if(ignoreSelector){origParent=$(node).parents(":not("+ignoreSelector+")").eq(0)}else{origParent=$(node).parent()}xpath=origParent.xpath(root)[0];textNodes=origParent.textNodes();nodes=textNodes.slice(0,textNodes.index(node));offset=0;for(_k=0,_len2=nodes.length;_k<_len2;_k++){n=nodes[_k];offset+=n.nodeValue.length}if(isEnd){return[xpath,offset+node.nodeValue.length]}else{return[xpath,offset]}};start=serialization(this.start);end=serialization(this.end,true);return new Range.SerializedRange({start:start[0],end:end[0],startOffset:start[1],endOffset:end[1]})};NormalizedRange.prototype.text=function(){var node;return function(){var _k,_len2,_ref1,_results;_ref1=this.textNodes();_results=[];for(_k=0,_len2=_ref1.length;_k<_len2;_k++){node=_ref1[_k];_results.push(node.nodeValue)}return _results}.call(this).join("")};NormalizedRange.prototype.textNodes=function(){var end,start,textNodes,_ref1;textNodes=$(this.commonAncestor).textNodes();_ref1=[textNodes.index(this.start),textNodes.index(this.end)],start=_ref1[0],end=_ref1[1];return $.makeArray(textNodes.slice(start,+end+1||9e9))};NormalizedRange.prototype.toRange=function(){var range;range=document.createRange();range.setStartBefore(this.start);range.setEndAfter(this.end);return range};return NormalizedRange}();Range.SerializedRange=function(){function SerializedRange(obj){this.start=obj.start;this.startOffset=obj.startOffset;this.end=obj.end;this.endOffset=obj.endOffset}SerializedRange.prototype.normalize=function(root){var contains,e,length,node,p,range,tn,_k,_l,_len2,_len3,_ref1,_ref2;range={};_ref1=["start","end"];for(_k=0,_len2=_ref1.length;_k<_len2;_k++){p=_ref1[_k];try{node=Range.nodeFromXPath(this[p],root)}catch(_error){e=_error;throw new Range.RangeError(p,"Error while finding "+p+" node: "+this[p]+": "+e,e)}if(!node){throw new Range.RangeError(p,"Couldn't find "+p+" node: "+this[p])}length=0;_ref2=$(node).textNodes();for(_l=0,_len3=_ref2.length;_l<_len3;_l++){tn=_ref2[_l];if(length+tn.nodeValue.length>=this[p+"Offset"]){range[p+"Container"]=tn;range[p+"Offset"]=this[p+"Offset"]-length;break}else{length+=tn.nodeValue.length}}if(range[p+"Offset"]==null){throw new Range.RangeError(""+p+"offset","Couldn't find offset "+this[p+"Offset"]+" in element "+this[p])}}contains=document.compareDocumentPosition==null?function(a,b){return a.contains(b)}:function(a,b){return a.compareDocumentPosition(b)&16};$(range.startContainer).parents().each(function(){if(contains(this,range.endContainer)){range.commonAncestorContainer=this;return false}});return new Range.BrowserRange(range).normalize(root)};SerializedRange.prototype.serialize=function(root,ignoreSelector){return this.normalize(root).serialize(root,ignoreSelector)};SerializedRange.prototype.toObject=function(){return{start:this.start,startOffset:this.startOffset,end:this.end,endOffset:this.endOffset}};return SerializedRange}();util={uuid:function(){var counter;counter=0;return function(){return counter++}}(),getGlobal:function(){return function(){return this}()},maxZIndex:function($elements){var all,el;all=function(){var _k,_len2,_results;_results=[];for(_k=0,_len2=$elements.length;_k<_len2;_k++){el=$elements[_k];if($(el).css("position")==="static"){_results.push(-1)}else{_results.push(parseInt($(el).css("z-index"),10)||-1)}}return _results}();return Math.max.apply(Math,all)},mousePosition:function(e,offsetEl){var offset;offset=$(offsetEl).position();return{top:e.pageY-offset.top,left:e.pageX-offset.left}},preventEventDefault:function(event){return event!=null?typeof event.preventDefault==="function"?event.preventDefault():void 0:void 0}};_Annotator=this.Annotator;Annotator=function(_super){__extends(Annotator,_super);Annotator.prototype.events={".annotator-adder button click":"onAdderClick",".annotator-adder button mousedown":"onAdderMousedown",".annotator-hl mouseover":"onHighlightMouseover",".annotator-hl mouseout":"startViewerHideTimer"};Annotator.prototype.html={adder:'<div class="annotator-adder"><button>'+_t("Annotate")+"</button></div>",wrapper:'<div class="annotator-wrapper"></div>'};Annotator.prototype.options={readOnly:false};Annotator.prototype.plugins={};Annotator.prototype.editor=null;Annotator.prototype.viewer=null;Annotator.prototype.selectedRanges=null;Annotator.prototype.mouseIsDown=false;Annotator.prototype.ignoreMouseup=false;Annotator.prototype.viewerHideTimer=null;function Annotator(element,options){this.onDeleteAnnotation=__bind(this.onDeleteAnnotation,this);this.onEditAnnotation=__bind(this.onEditAnnotation,this);this.onAdderClick=__bind(this.onAdderClick,this);this.onAdderMousedown=__bind(this.onAdderMousedown,this);this.onHighlightMouseover=__bind(this.onHighlightMouseover,this);this.checkForEndSelection=__bind(this.checkForEndSelection,this);this.checkForStartSelection=__bind(this.checkForStartSelection,this);this.clearViewerHideTimer=__bind(this.clearViewerHideTimer,this);this.startViewerHideTimer=__bind(this.startViewerHideTimer,this);this.showViewer=__bind(this.showViewer,this);this.onEditorSubmit=__bind(this.onEditorSubmit,this);this.onEditorHide=__bind(this.onEditorHide,this);this.showEditor=__bind(this.showEditor,this);Annotator.__super__.constructor.apply(this,arguments);this.plugins={};if(!Annotator.supported()){return this}if(!this.options.readOnly){this._setupDocumentEvents()}this._setupWrapper()._setupViewer()._setupEditor();this._setupDynamicStyle();this.adder=$(this.html.adder).appendTo(this.wrapper).hide()}Annotator.prototype._setupWrapper=function(){this.wrapper=$(this.html.wrapper);this.element.find("script").remove();this.element.wrapInner(this.wrapper);this.wrapper=this.element.find(".annotator-wrapper");return this};Annotator.prototype._setupViewer=function(){var _this=this;this.viewer=new Annotator.Viewer({readOnly:this.options.readOnly});this.viewer.hide().on("edit",this.onEditAnnotation).on("delete",this.onDeleteAnnotation).addField({load:function(field,annotation){if(annotation.text){$(field).escape(annotation.text)}else{$(field).html("<i>"+_t("No Comment")+"</i>")}return _this.publish("annotationViewerTextField",[field,annotation])}}).element.appendTo(this.wrapper).bind({mouseover:this.clearViewerHideTimer,mouseout:this.startViewerHideTimer});return this};Annotator.prototype._setupEditor=function(){this.editor=new Annotator.Editor;this.editor.hide().on("hide",this.onEditorHide).on("save",this.onEditorSubmit).addField({type:"textarea",label:_t("Comments")+"…",load:function(field,annotation){return $(field).find("textarea").val(annotation.text||"")},submit:function(field,annotation){return annotation.text=$(field).find("textarea").val()}});this.editor.element.appendTo(this.wrapper);return this};Annotator.prototype._setupDocumentEvents=function(){$(document).bind({mouseup:this.checkForEndSelection,mousedown:this.checkForStartSelection});return this};Annotator.prototype._setupDynamicStyle=function(){var max,sel,style,x;style=$("#annotator-dynamic-style");if(!style.length){style=$('<style id="annotator-dynamic-style"></style>').appendTo(document.head)}sel="*"+function(){var _k,_len2,_ref1,_results;_ref1=["adder","outer","notice","filter"];_results=[];for(_k=0,_len2=_ref1.length;_k<_len2;_k++){x=_ref1[_k];_results.push(":not(.annotator-"+x+")")}return _results}().join("");max=util.maxZIndex($(document.body).find(sel));max=Math.max(max,1e3);style.text([".annotator-adder, .annotator-outer, .annotator-notice {"," z-index: "+(max+20)+";","}",".annotator-filter {"," z-index: "+(max+10)+";","}"].join("\n"));return this};Annotator.prototype.getSelectedRanges=function(){var browserRange,i,normedRange,r,ranges,rangesToIgnore,selection,_k,_len2;selection=util.getGlobal().getSelection();ranges=[];rangesToIgnore=[];if(!selection.isCollapsed){ranges=function(){var _k,_ref1,_results;_results=[];for(i=_k=0,_ref1=selection.rangeCount;0<=_ref1?_k<_ref1:_k>_ref1;i=0<=_ref1?++_k:--_k){r=selection.getRangeAt(i);browserRange=new Range.BrowserRange(r);normedRange=browserRange.normalize().limit(this.wrapper[0]);if(normedRange===null){rangesToIgnore.push(r)}_results.push(normedRange)}return _results}.call(this);selection.removeAllRanges()}for(_k=0,_len2=rangesToIgnore.length;_k<_len2;_k++){r=rangesToIgnore[_k];selection.addRange(r)}return $.grep(ranges,function(range){if(range){selection.addRange(range.toRange())}return range})};Annotator.prototype.createAnnotation=function(){var annotation;annotation={};this.publish("beforeAnnotationCreated",[annotation]);return annotation};Annotator.prototype.setupAnnotation=function(annotation){var e,normed,normedRanges,r,root,_k,_l,_len2,_len3,_ref1;root=this.wrapper[0];annotation.ranges||(annotation.ranges=this.selectedRanges);normedRanges=[];_ref1=annotation.ranges;for(_k=0,_len2=_ref1.length;_k<_len2;_k++){r=_ref1[_k];try{normedRanges.push(Range.sniff(r).normalize(root))}catch(_error){e=_error;if(e instanceof Range.RangeError){this.publish("rangeNormalizeFail",[annotation,r,e])}else{throw e}}}annotation.quote=[];annotation.ranges=[];annotation.highlights=[];for(_l=0,_len3=normedRanges.length;_l<_len3;_l++){normed=normedRanges[_l];annotation.quote.push($.trim(normed.text()));annotation.ranges.push(normed.serialize(this.wrapper[0],".annotator-hl"));$.merge(annotation.highlights,this.highlightRange(normed))}annotation.quote=annotation.quote.join(" / ");$(annotation.highlights).data("annotation",annotation);return annotation};Annotator.prototype.updateAnnotation=function(annotation){this.publish("beforeAnnotationUpdated",[annotation]);this.publish("annotationUpdated",[annotation]);return annotation};Annotator.prototype.deleteAnnotation=function(annotation){var child,h,_k,_len2,_ref1;if(annotation.highlights!=null){_ref1=annotation.highlights;for(_k=0,_len2=_ref1.length;_k<_len2;_k++){h=_ref1[_k];if(!(h.parentNode!=null)){continue}child=h.childNodes[0];$(h).replaceWith(h.childNodes)}}this.publish("annotationDeleted",[annotation]);return annotation};Annotator.prototype.loadAnnotations=function(annotations){var clone,loader,_this=this;if(annotations==null){annotations=[]}loader=function(annList){var n,now,_k,_len2;if(annList==null){annList=[]}now=annList.splice(0,10);for(_k=0,_len2=now.length;_k<_len2;_k++){n=now[_k];_this.setupAnnotation(n)}if(annList.length>0){return setTimeout(function(){return loader(annList)},10)}else{return _this.publish("annotationsLoaded",[clone])}};clone=annotations.slice();if(annotations.length){loader(annotations)}return this};Annotator.prototype.dumpAnnotations=function(){if(this.plugins["Store"]){return this.plugins["Store"].dumpAnnotations()}else{console.warn(_t("Can't dump annotations without Store plugin."));return false}};Annotator.prototype.highlightRange=function(normedRange,cssClass){var hl,node,white,_k,_len2,_ref1,_results;if(cssClass==null){cssClass="annotator-hl"}white=/^\s*$/;hl=$("<span class='"+cssClass+"'></span>");_ref1=normedRange.textNodes();_results=[];for(_k=0,_len2=_ref1.length;_k<_len2;_k++){node=_ref1[_k];if(!white.test(node.nodeValue)){_results.push($(node).wrapAll(hl).parent().show()[0])}}return _results};Annotator.prototype.highlightRanges=function(normedRanges,cssClass){var highlights,r,_k,_len2;if(cssClass==null){cssClass="annotator-hl"}highlights=[];for(_k=0,_len2=normedRanges.length;_k<_len2;_k++){r=normedRanges[_k];$.merge(highlights,this.highlightRange(r,cssClass))}return highlights};Annotator.prototype.addPlugin=function(name,options){var klass,_base;if(this.plugins[name]){console.error(_t("You cannot have more than one instance of any plugin."))}else{klass=Annotator.Plugin[name];if(typeof klass==="function"){this.plugins[name]=new klass(this.element[0],options);this.plugins[name].annotator=this;if(typeof(_base=this.plugins[name]).pluginInit==="function"){_base.pluginInit()}}else{console.error(_t("Could not load ")+name+_t(" plugin. Have you included the appropriate <script> tag?"))}}return this};Annotator.prototype.showEditor=function(annotation,location){this.editor.element.css(location);this.editor.load(annotation);this.publish("annotationEditorShown",[this.editor,annotation]);return this};Annotator.prototype.onEditorHide=function(){this.publish("annotationEditorHidden",[this.editor]);return this.ignoreMouseup=false};Annotator.prototype.onEditorSubmit=function(annotation){return this.publish("annotationEditorSubmit",[this.editor,annotation])};Annotator.prototype.showViewer=function(annotations,location){this.viewer.element.css(location);this.viewer.load(annotations);return this.publish("annotationViewerShown",[this.viewer,annotations])};Annotator.prototype.startViewerHideTimer=function(){if(!this.viewerHideTimer){return this.viewerHideTimer=setTimeout(this.viewer.hide,250)}};Annotator.prototype.clearViewerHideTimer=function(){clearTimeout(this.viewerHideTimer);return this.viewerHideTimer=false};Annotator.prototype.checkForStartSelection=function(event){if(!(event&&this.isAnnotator(event.target))){this.startViewerHideTimer();return this.mouseIsDown=true}};Annotator.prototype.checkForEndSelection=function(event){var container,range,_k,_len2,_ref1;this.mouseIsDown=false;if(this.ignoreMouseup){return}this.selectedRanges=this.getSelectedRanges();_ref1=this.selectedRanges;for(_k=0,_len2=_ref1.length;_k<_len2;_k++){range=_ref1[_k];container=range.commonAncestor;if($(container).hasClass("annotator-hl")){container=$(container).parents("[class^=annotator-hl]")[0]}if(this.isAnnotator(container)){return}}if(event&&this.selectedRanges.length){return this.adder.css(util.mousePosition(event,this.wrapper[0])).show()}else{return this.adder.hide()}};Annotator.prototype.isAnnotator=function(element){return!!$(element).parents().andSelf().filter("[class^=annotator-]").not(this.wrapper).length};Annotator.prototype.onHighlightMouseover=function(event){var annotations;this.clearViewerHideTimer();if(this.mouseIsDown||this.viewer.isShown()){return false}annotations=$(event.target).parents(".annotator-hl").andSelf().map(function(){return $(this).data("annotation")});return this.showViewer($.makeArray(annotations),util.mousePosition(event,this.wrapper[0]))};Annotator.prototype.onAdderMousedown=function(event){if(event!=null){event.preventDefault()}return this.ignoreMouseup=true};Annotator.prototype.onAdderClick=function(event){var annotation,cancel,cleanup,position,save,_this=this;if(event!=null){event.preventDefault()}position=this.adder.position();this.adder.hide();annotation=this.setupAnnotation(this.createAnnotation());$(annotation.highlights).addClass("annotator-hl-temporary");save=function(){cleanup();$(annotation.highlights).removeClass("annotator-hl-temporary");return _this.publish("annotationCreated",[annotation])};cancel=function(){cleanup();return _this.deleteAnnotation(annotation)};cleanup=function(){_this.unsubscribe("annotationEditorHidden",cancel);return _this.unsubscribe("annotationEditorSubmit",save)};this.subscribe("annotationEditorHidden",cancel);this.subscribe("annotationEditorSubmit",save);return this.showEditor(annotation,position)};Annotator.prototype.onEditAnnotation=function(annotation){var cleanup,offset,update,_this=this;offset=this.viewer.element.position();update=function(){cleanup();return _this.updateAnnotation(annotation)};cleanup=function(){_this.unsubscribe("annotationEditorHidden",cleanup);return _this.unsubscribe("annotationEditorSubmit",update)};this.subscribe("annotationEditorHidden",cleanup);this.subscribe("annotationEditorSubmit",update);this.viewer.hide();return this.showEditor(annotation,offset)};Annotator.prototype.onDeleteAnnotation=function(annotation){this.viewer.hide();return this.deleteAnnotation(annotation)};return Annotator}(Delegator);Annotator.Plugin=function(_super){__extends(Plugin,_super);function Plugin(element,options){Plugin.__super__.constructor.apply(this,arguments)}Plugin.prototype.pluginInit=function(){};return Plugin}(Delegator);g=util.getGlobal();if(((_ref1=g.document)!=null?_ref1.evaluate:void 0)==null){$.getScript("http://assets.annotateit.org/vendor/xpath.min.js")}if(g.getSelection==null){$.getScript("http://assets.annotateit.org/vendor/ierange.min.js")}if(g.JSON==null){$.getScript("http://assets.annotateit.org/vendor/json2.min.js")}Annotator.$=$;Annotator.Delegator=Delegator;Annotator.Range=Range;Annotator._t=_t;Annotator.supported=function(){return function(){return!!this.getSelection}()};Annotator.noConflict=function(){util.getGlobal().Annotator=_Annotator;return this};$.plugin("annotator",Annotator);this.Annotator=Annotator;Annotator.Widget=function(_super){__extends(Widget,_super);Widget.prototype.classes={hide:"annotator-hide",invert:{x:"annotator-invert-x",y:"annotator-invert-y"}};function Widget(element,options){Widget.__super__.constructor.apply(this,arguments);this.classes=$.extend({},Annotator.Widget.prototype.classes,this.classes)}Widget.prototype.checkOrientation=function(){var current,offset,viewport,widget,window;this.resetOrientation();window=$(util.getGlobal());widget=this.element.children(":first");offset=widget.offset();viewport={top:window.scrollTop(),right:window.width()+window.scrollLeft()};current={top:offset.top,right:offset.left+widget.width()};if(current.top-viewport.top<0){this.invertY()}if(current.right-viewport.right>0){this.invertX()}return this};Widget.prototype.resetOrientation=function(){this.element.removeClass(this.classes.invert.x).removeClass(this.classes.invert.y);return this};Widget.prototype.invertX=function(){this.element.addClass(this.classes.invert.x);return this};Widget.prototype.invertY=function(){this.element.addClass(this.classes.invert.y);return this};Widget.prototype.isInvertedY=function(){return this.element.hasClass(this.classes.invert.y)};Widget.prototype.isInvertedX=function(){return this.element.hasClass(this.classes.invert.x)};return Widget}(Delegator);Annotator.Editor=function(_super){__extends(Editor,_super);Editor.prototype.events={"form submit":"submit",".annotator-save click":"submit",".annotator-cancel click":"hide",".annotator-cancel mouseover":"onCancelButtonMouseover","textarea keydown":"processKeypress"};Editor.prototype.classes={hide:"annotator-hide",focus:"annotator-focus"};Editor.prototype.html='<div class="annotator-outer annotator-editor">\n <form class="annotator-widget">\n <ul class="annotator-listing"></ul>\n <div class="annotator-controls">\n <a href="#cancel" class="annotator-cancel">'+_t("Cancel")+'</a>\n<a href="#save" class="annotator-save annotator-focus">'+_t("Save")+"</a>\n </div>\n </form>\n</div>";Editor.prototype.options={};function Editor(options){this.onCancelButtonMouseover=__bind(this.onCancelButtonMouseover,this);this.processKeypress=__bind(this.processKeypress,this);this.submit=__bind(this.submit,this);this.load=__bind(this.load,this);this.hide=__bind(this.hide,this);this.show=__bind(this.show,this);Editor.__super__.constructor.call(this,$(this.html)[0],options);this.fields=[];this.annotation={}}Editor.prototype.show=function(event){util.preventEventDefault(event);this.element.removeClass(this.classes.hide);this.element.find(".annotator-save").addClass(this.classes.focus);this.checkOrientation();this.element.find(":input:first").focus();this.setupDraggables();return this.publish("show")};Editor.prototype.hide=function(event){util.preventEventDefault(event);this.element.addClass(this.classes.hide);return this.publish("hide")};Editor.prototype.load=function(annotation){var field,_k,_len2,_ref2;this.annotation=annotation;this.publish("load",[this.annotation]);_ref2=this.fields;for(_k=0,_len2=_ref2.length;_k<_len2;_k++){field=_ref2[_k];field.load(field.element,this.annotation)}return this.show()};Editor.prototype.submit=function(event){var field,_k,_len2,_ref2;util.preventEventDefault(event);_ref2=this.fields;for(_k=0,_len2=_ref2.length;_k<_len2;_k++){field=_ref2[_k];field.submit(field.element,this.annotation)}this.publish("save",[this.annotation]);return this.hide()};Editor.prototype.addField=function(options){var element,field,input;field=$.extend({id:"annotator-field-"+util.uuid(),type:"input",label:"",load:function(){},submit:function(){}},options);
input=null;element=$('<li class="annotator-item" />');field.element=element[0];switch(field.type){case"textarea":input=$("<textarea />");break;case"input":case"checkbox":input=$("<input />")}element.append(input);input.attr({id:field.id,placeholder:field.label});if(field.type==="checkbox"){input[0].type="checkbox";element.addClass("annotator-checkbox");element.append($("<label />",{"for":field.id,html:field.label}))}this.element.find("ul:first").append(element);this.fields.push(field);return field.element};Editor.prototype.checkOrientation=function(){var controls,list;Editor.__super__.checkOrientation.apply(this,arguments);list=this.element.find("ul");controls=this.element.find(".annotator-controls");if(this.element.hasClass(this.classes.invert.y)){controls.insertBefore(list)}else if(controls.is(":first-child")){controls.insertAfter(list)}return this};Editor.prototype.processKeypress=function(event){if(event.keyCode===27){return this.hide()}else if(event.keyCode===13&&!event.shiftKey){return this.submit()}};Editor.prototype.onCancelButtonMouseover=function(){return this.element.find("."+this.classes.focus).removeClass(this.classes.focus)};Editor.prototype.setupDraggables=function(){var classes,controls,cornerItem,editor,mousedown,onMousedown,onMousemove,onMouseup,resize,textarea,throttle,_this=this;this.element.find(".annotator-resize").remove();if(this.element.hasClass(this.classes.invert.y)){cornerItem=this.element.find(".annotator-item:last")}else{cornerItem=this.element.find(".annotator-item:first")}if(cornerItem){$('<span class="annotator-resize"></span>').appendTo(cornerItem)}mousedown=null;classes=this.classes;editor=this.element;textarea=null;resize=editor.find(".annotator-resize");controls=editor.find(".annotator-controls");throttle=false;onMousedown=function(event){if(event.target===this){mousedown={element:this,top:event.pageY,left:event.pageX};textarea=editor.find("textarea:first");$(window).bind({"mouseup.annotator-editor-resize":onMouseup,"mousemove.annotator-editor-resize":onMousemove});return event.preventDefault()}};onMouseup=function(){mousedown=null;return $(window).unbind(".annotator-editor-resize")};onMousemove=function(event){var diff,directionX,directionY,height,width;if(mousedown&&throttle===false){diff={top:event.pageY-mousedown.top,left:event.pageX-mousedown.left};if(mousedown.element===resize[0]){height=textarea.outerHeight();width=textarea.outerWidth();directionX=editor.hasClass(classes.invert.x)?-1:1;directionY=editor.hasClass(classes.invert.y)?1:-1;textarea.height(height+diff.top*directionY);textarea.width(width+diff.left*directionX);if(textarea.outerHeight()!==height){mousedown.top=event.pageY}if(textarea.outerWidth()!==width){mousedown.left=event.pageX}}else if(mousedown.element===controls[0]){editor.css({top:parseInt(editor.css("top"),10)+diff.top,left:parseInt(editor.css("left"),10)+diff.left});mousedown.top=event.pageY;mousedown.left=event.pageX}throttle=true;return setTimeout(function(){return throttle=false},1e3/60)}};resize.bind("mousedown",onMousedown);return controls.bind("mousedown",onMousedown)};return Editor}(Annotator.Widget);Annotator.Viewer=function(_super){__extends(Viewer,_super);Viewer.prototype.events={".annotator-edit click":"onEditClick",".annotator-delete click":"onDeleteClick"};Viewer.prototype.classes={hide:"annotator-hide",showControls:"annotator-visible"};Viewer.prototype.html={element:'<div class="annotator-outer annotator-viewer">\n <ul class="annotator-widget annotator-listing"></ul>\n</div>',item:'<li class="annotator-annotation annotator-item">\n <span class="annotator-controls">\n <a href="#" title="View as webpage" class="annotator-link">View as webpage</a>\n <button title="Edit" class="annotator-edit">Edit</button>\n <button title="Delete" class="annotator-delete">Delete</button>\n </span>\n</li>'};Viewer.prototype.options={readOnly:false};function Viewer(options){this.onDeleteClick=__bind(this.onDeleteClick,this);this.onEditClick=__bind(this.onEditClick,this);this.load=__bind(this.load,this);this.hide=__bind(this.hide,this);this.show=__bind(this.show,this);Viewer.__super__.constructor.call(this,$(this.html.element)[0],options);this.item=$(this.html.item)[0];this.fields=[];this.annotations=[]}Viewer.prototype.show=function(event){var controls,_this=this;util.preventEventDefault(event);controls=this.element.find(".annotator-controls").addClass(this.classes.showControls);setTimeout(function(){return controls.removeClass(_this.classes.showControls)},500);this.element.removeClass(this.classes.hide);return this.checkOrientation().publish("show")};Viewer.prototype.isShown=function(){return!this.element.hasClass(this.classes.hide)};Viewer.prototype.hide=function(event){util.preventEventDefault(event);this.element.addClass(this.classes.hide);return this.publish("hide")};Viewer.prototype.load=function(annotations){var annotation,controller,controls,del,edit,element,field,item,link,links,list,_k,_l,_len2,_len3,_ref2,_ref3;this.annotations=annotations||[];list=this.element.find("ul:first").empty();_ref2=this.annotations;for(_k=0,_len2=_ref2.length;_k<_len2;_k++){annotation=_ref2[_k];item=$(this.item).clone().appendTo(list).data("annotation",annotation);controls=item.find(".annotator-controls");link=controls.find(".annotator-link");edit=controls.find(".annotator-edit");del=controls.find(".annotator-delete");links=new LinkParser(annotation.links||[]).get("alternate",{type:"text/html"});if(links.length===0||links[0].href==null){link.remove()}else{link.attr("href",links[0].href)}if(this.options.readOnly){edit.remove();del.remove()}else{controller={showEdit:function(){return edit.removeAttr("disabled")},hideEdit:function(){return edit.attr("disabled","disabled")},showDelete:function(){return del.removeAttr("disabled")},hideDelete:function(){return del.attr("disabled","disabled")}}}_ref3=this.fields;for(_l=0,_len3=_ref3.length;_l<_len3;_l++){field=_ref3[_l];element=$(field.element).clone().appendTo(item)[0];field.load(element,annotation,controller)}}this.publish("load",[this.annotations]);return this.show()};Viewer.prototype.addField=function(options){var field;field=$.extend({load:function(){}},options);field.element=$("<div />")[0];this.fields.push(field);field.element;return this};Viewer.prototype.onEditClick=function(event){return this.onButtonClick(event,"edit")};Viewer.prototype.onDeleteClick=function(event){return this.onButtonClick(event,"delete")};Viewer.prototype.onButtonClick=function(event,type){var item;item=$(event.target).parents(".annotator-annotation");return this.publish(type,[item.data("annotation")])};return Viewer}(Annotator.Widget);LinkParser=function(){function LinkParser(data){this.data=data}LinkParser.prototype.get=function(rel,cond){var d,k,keys,match,v,_k,_len2,_ref2,_results;if(cond==null){cond={}}cond=$.extend({},cond,{rel:rel});keys=function(){var _results;_results=[];for(k in cond){if(!__hasProp.call(cond,k))continue;v=cond[k];_results.push(k)}return _results}();_ref2=this.data;_results=[];for(_k=0,_len2=_ref2.length;_k<_len2;_k++){d=_ref2[_k];match=keys.reduce(function(m,k){return m&&d[k]===cond[k]},true);if(match){_results.push(d)}else{continue}}return _results};return LinkParser}();Annotator=Annotator||{};Annotator.Notification=function(_super){__extends(Notification,_super);Notification.prototype.events={click:"hide"};Notification.prototype.options={html:"<div class='annotator-notice'></div>",classes:{show:"annotator-notice-show",info:"annotator-notice-info",success:"annotator-notice-success",error:"annotator-notice-error"}};function Notification(options){this.hide=__bind(this.hide,this);this.show=__bind(this.show,this);Notification.__super__.constructor.call(this,$(this.options.html).appendTo(document.body)[0],options)}Notification.prototype.show=function(message,status){if(status==null){status=Annotator.Notification.INFO}$(this.element).addClass(this.options.classes.show).addClass(this.options.classes[status]).escape(message||"");setTimeout(this.hide,5e3);return this};Notification.prototype.hide=function(){$(this.element).removeClass(this.options.classes.show);return this};return Notification}(Delegator);Annotator.Notification.INFO="show";Annotator.Notification.SUCCESS="success";Annotator.Notification.ERROR="error";$(function(){var notification;notification=new Annotator.Notification;Annotator.showNotification=notification.show;return Annotator.hideNotification=notification.hide})}).call(this);
\ No newline at end of file
/*
** Annotator 1.2.6-dev-dc18206
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-05-16 18:02:02Z
*/
(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; },
__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) {
if (data == null) {
data = [];
}
this.annotations = this.annotations.concat(data);
return this.annotator.loadAnnotations(data.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);
}).call(this);
/*
** Annotator v1.2.6
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-01-21 09:43:51Z
*/((function(){var a=function(a,b){return function(){return a.apply(b,arguments)}},b=Object.prototype.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a},d=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};Annotator.Plugin.Store=function(b){function e(b,c){this._onError=a(this._onError,this),this._onLoadAnnotationsFromSearch=a(this._onLoadAnnotationsFromSearch,this),this._onLoadAnnotations=a(this._onLoadAnnotations,this),this._getAnnotations=a(this._getAnnotations,this),e.__super__.constructor.apply(this,arguments),this.annotations=[]}return c(e,b),e.prototype.events={annotationCreated:"annotationCreated",annotationDeleted:"annotationDeleted",annotationUpdated:"annotationUpdated"},e.prototype.options={prefix:"/store",autoFetch:!0,annotationData:{},loadFromSearch:!1,urls:{create:"/annotations",read:"/annotations/:id",update:"/annotations/:id",destroy:"/annotations/:id",search:"/search"}},e.prototype.pluginInit=function(){if(!Annotator.supported())return;return this.annotator.plugins.Auth?this.annotator.plugins.Auth.withToken(this._getAnnotations):this._getAnnotations()},e.prototype._getAnnotations=function(){return this.options.loadFromSearch?this.loadAnnotationsFromSearch(this.options.loadFromSearch):this.loadAnnotations()},e.prototype.annotationCreated=function(a){var b=this;return d.call(this.annotations,a)<0?(this.registerAnnotation(a),this._apiRequest("create",a,function(c){return c.id==null&&console.warn(Annotator._t("Warning: No ID returned from server for annotation "),a),b.updateAnnotation(a,c)})):this.updateAnnotation(a,{})},e.prototype.annotationUpdated=function(a){var b=this;if(d.call(this.annotations,a)>=0)return this._apiRequest("update",a,function(c){return b.updateAnnotation(a,c)})},e.prototype.annotationDeleted=function(a){var b=this;if(d.call(this.annotations,a)>=0)return this._apiRequest("destroy",a,function(){return b.unregisterAnnotation(a)})},e.prototype.registerAnnotation=function(a){return this.annotations.push(a)},e.prototype.unregisterAnnotation=function(a){return this.annotations.splice(this.annotations.indexOf(a),1)},e.prototype.updateAnnotation=function(a,b){return d.call(this.annotations,a)<0?console.error(Annotator._t("Trying to update unregistered annotation!")):$.extend(a,b),$(a.highlights).data("annotation",a)},e.prototype.loadAnnotations=function(){return this._apiRequest("read",null,this._onLoadAnnotations)},e.prototype._onLoadAnnotations=function(a){return a==null&&(a=[]),this.annotations=a,this.annotator.loadAnnotations(a.slice())},e.prototype.loadAnnotationsFromSearch=function(a){return this._apiRequest("search",a,this._onLoadAnnotationsFromSearch)},e.prototype._onLoadAnnotationsFromSearch=function(a){return a==null&&(a={}),this._onLoadAnnotations(a.rows||[])},e.prototype.dumpAnnotations=function(){var a,b,c,d,e;d=this.annotations,e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(JSON.parse(this._dataFor(a)));return e},e.prototype._apiRequest=function(a,b,c){var d,e,f,g;return d=b&&b.id,g=this._urlFor(a,d),e=this._apiRequestOptions(a,b,c),f=$.ajax(g,e),f._id=d,f._action=a,f},e.prototype._apiRequestOptions=function(a,b,c){var d;return d={type:this._methodFor(a),headers:this.element.data("annotator:headers"),dataType:"json",success:c||function(){},error:this._onError},a==="search"?d=$.extend(d,{data:b}):d=$.extend(d,{data:b&&this._dataFor(b),contentType:"application/json; charset=utf-8"}),d},e.prototype._urlFor=function(a,b){var c,d;return c=b!=null?"/"+b:"",d=this.options.prefix!=null?this.options.prefix:"",d+=this.options.urls[a],d=d.replace(/\/:id/,c),d},e.prototype._methodFor=function(a){var b;return b={create:"POST",read:"GET",update:"PUT",destroy:"DELETE",search:"GET"},b[a]},e.prototype._dataFor=function(a){var b,c;return c=a.highlights,delete a.highlights,$.extend(a,this.options.annotationData),b=JSON.stringify(a),c&&(a.highlights=c),b},e.prototype._onError=function(a){var b,c;b=a._action,c=Annotator._t("Sorry we could not ")+b+Annotator._t(" this annotation"),a._action==="search"?c=Annotator._t("Sorry we could not search the store for annotations"):a._action==="read"&&!a._id&&(c=Annotator._t("Sorry we could not ")+b+Annotator._t(" the annotations from the store"));switch(a.status){case 401:c=Annotator._t("Sorry you are not allowed to ")+b+Annotator._t(" this annotation");break;case 404:c=Annotator._t("Sorry we could not connect to the annotations store");break;case 500:c=Annotator._t("Sorry something went wrong with the annotation store")}return Annotator.showNotification(c,Annotator.Notification.ERROR),console.error(Annotator._t("API request failed:")+(" '"+a.status+"'"))},e}(Annotator.Plugin)})).call(this);
\ No newline at end of file
(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},__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){if(data==null){data=[]}this.annotations=this.annotations.concat(data);return this.annotator.loadAnnotations(data.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)}).call(this);
\ No newline at end of file
/*
** Annotator 1.2.6-dev-dc18206
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-05-16 18:02:02Z
*/
(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') + '\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.$.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);
/*
** Annotator v1.2.6
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2013-01-21 09:43:52Z
*/((function(){var a=function(a,b){return function(){return a.apply(b,arguments)}},b=Object.prototype.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};Annotator.Plugin.Tags=function(b){function d(){this.setAnnotationTags=a(this.setAnnotationTags,this),this.updateField=a(this.updateField,this),d.__super__.constructor.apply(this,arguments)}return c(d,b),d.prototype.options={parseTags:function(a){var b;return a=$.trim(a),b=[],a&&(b=a.split(/\s+/)),b},stringifyTags:function(a){return a.join(" ")}},d.prototype.field=null,d.prototype.input=null,d.prototype.pluginInit=function(){if(!Annotator.supported())return;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}),this.annotator.plugins.Filter&&this.annotator.plugins.Filter.addFilter({label:Annotator._t("Tag"),property:"tags",isFiltered:Annotator.Plugin.Tags.filterCallback}),this.input=$(this.field).find(":input")},d.prototype.parseTags=function(a){return this.options.parseTags(a)},d.prototype.stringifyTags=function(a){return this.options.stringifyTags(a)},d.prototype.updateField=function(a,b){var c;return c="",b.tags&&(c=this.stringifyTags(b.tags)),this.input.val(c)},d.prototype.setAnnotationTags=function(a,b){return b.tags=this.parseTags(this.input.val())},d.prototype.updateViewer=function(a,b){return a=$(a),b.tags&&$.isArray(b.tags)&&b.tags.length?a.addClass("annotator-tags").html(function(){var a;return a=$.map(b.tags,function(a){return'<span class="annotator-tag">'+Annotator.$.escape(a)+"</span>"}).join(" ")}):a.remove()},d}(Annotator.Plugin),Annotator.Plugin.Tags.filterCallback=function(a,b){var c,d,e,f,g,h,i,j;b==null&&(b=[]),e=0,d=[];if(a){d=a.split(/\s+/g);for(g=0,i=d.length;g<i;g++){c=d[g];if(b.length)for(h=0,j=b.length;h<j;h++)f=b[h],f.indexOf(c)!==-1&&(e+=1)}}return e===d.length}})).call(this);
\ No newline at end of file
(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.$.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);
\ No newline at end of file
......@@ -446,7 +446,7 @@ PIPELINE_CSS = {
'css/vendor/jquery.treeview.css',
'css/vendor/ui-lightness/jquery-ui-1.8.22.custom.css',
'css/vendor/jquery.qtip.min.css',
'css/vendor/annotator.min.css',
'css/vendor/annotator.css',
'sass/course.css',
'xmodule/modules.css',
],
......
/* Base Reset
-------------------------------------------------------------------- */
.annotator-notice,
.annotator-filter *,
.annotator-widget * {
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
font-weight: normal;
text-align: left;
margin: 0;
padding: 0;
background: none;
-webkit-transition: none;
-moz-transition: none;
-o-transition: none;
transition: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
-o-box-shadow: none;
box-shadow: none;
color: rgb(144, 144, 144);
}
/* Images
-------------------------------------------------------------------- */
.annotator-adder {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAAAwCAYAAAD+WvNWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzgwMTE3NDA3MjA2ODExODRCQUU5RDY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wKIvKb/0EQj4KI/Oa/U/F0qIA03JnS+wdKPD7cmSL/gyQeH+5Mkb8jxHOnWZiWiOTBLVH6/kEtbmHIglui9P2DWtzCWH3534r8HSUcd/l/AQYA7PGYKl3+RK0AAAAASUVORK5CYII=');
background-repeat: no-repeat;
}
.annotator-resize,
.annotator-widget::after,
.annotator-editor a::after,
.annotator-viewer .annotator-controls button,
.annotator-viewer .annotator-controls a,
.annotator-filter .annotator-filter-navigation button::after,
.annotator-filter .annotator-filter-property .annotator-filter-clear {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAEiCAYAAAD0w4JOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC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Z62LBhVydMmDDdw8PjqMWNlJubewL5UWZiYmIo/WPTmgRCiJBLIc2tBdTHo/+3tMaS1IZnRknLX23qpNLBgwddk5OT93p5edG/nFtLtTTbIOPi4uif4TXl5eUFBw4cWOfo6EgfWTS1GiRa7vnzmjVrKD9qXyeQaAuzBCS37OxnyAykf3utCiPck9U8tEIzEpASa15qaHkHLfloY860UL3314Pk4pG7u4ex+7QYhT60bA6Jh2yAlGZkpBu1bOlGn6HtF52P4Z587duVk6xpM1a1cSLIEchJkYazzG0jWuxOCTstfKMv6OhLMlquF8vuDzcH1I5BaKO1o/tEk3jC0sUcUyD69RvckwWDHIuStIDSHjKE3actwlgYoRXj/2HH9GYkfGlInyreEZ3/jXuyoFlWIy8RRBgAxJ+WCRD6cPdfxgzyI3ZMHwPu4Z6sgKaPLO+z6ze5J0usPzMVIYWPKZ0YuJr1lPB91ihImjmhlj5bfI118SlIHkRIRqeYAxFchNZiX+EMP6ScImq7WpuSi5SwTHYyc4u7rFEvWuS09TH79wz6nwADANCoQA3w0fcjAAAAAElFTkSuQmCC');
background-repeat: no-repeat;
}
/* Annotator Highlight
-------------------------------------------------------------------- */
.annotator-hl {
background: rgba(255, 255, 10, 0.3);
}
.annotator-hl-temporary {
background: rgba(0, 124, 255, 0.3);
}
/* Annotator Wrapper
-------------------------------------------------------------------- */
.annotator-wrapper {
position: relative;
}
/* NB: If you change the list of classes for which z-index is set,
you should update Annotator._setupDynamicStyle() */
.annotator-adder,
.annotator-outer,
.annotator-notice {
z-index: 1020;
}
.annotator-filter {
z-index: 1010;
}
.annotator-adder,
.annotator-outer,
.annotator-widget,
.annotator-notice {
position: absolute;
font-size: 10px;
line-height: 1;
}
.annotator-hide {
display: none;
visibility: hidden;
}
/* Annotator Adder
-------------------------------------------------------------------- */
.annotator-adder {
margin-top: -48px;
margin-left: -24px;
width: 48px;
height: 48px;
background-position: left top;
}
.annotator-adder:hover {
background-position: center top;
}
.annotator-adder:active {
background-position: center right;
}
.annotator-adder button {
display: block;
width: 36px;
height: 41px;
margin: 0 auto;
border: none;
background: none;
text-indent: -999em;
cursor: pointer;
}
/** NOTE: fix for conflict with course.css */
.annotator-adder button:hover,
.annotator-adder button:active {
background-color: inherit;
-webkit-box-shadow: inherit;
-moz-box-shadow: inherit;
box-shadow: inherit;
text-shadow: inherit;
border: inherit;
}
/* Annotator Widget
This applies to both the Viewer and the Editor
-------------------------------------------------------------------- */
.annotator-outer {
width: 0;
height: 0;
}
.annotator-widget {
margin: 0;
padding: 0;
bottom: 15px;
left: -18px;
min-width: 265px;
background-color: rgba(251, 251, 251, 0.98);
border: 1px solid rgba(122, 122, 122, 0.6);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
-o-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}
.annotator-invert-x .annotator-widget {
left: auto;
right: -18px;
}
.annotator-invert-y .annotator-widget {
bottom: auto;
top: 8px;
}
.annotator-widget strong {
font-weight: bold;
}
.annotator-widget .annotator-listing,
.annotator-widget .annotator-item {
padding: 0;
margin: 0;
list-style: none;
}
.annotator-widget::after {
content: "";
display: block;
width: 18px;
height: 10px;
background-position: 0 0;
position: absolute;
bottom: -10px;
left: 8px;
}
.annotator-invert-x .annotator-widget::after {
left: auto;
right: 8px;
}
.annotator-invert-y .annotator-widget::after {
background-position: 0 -15px;
bottom: auto;
top: -9px;
}
.annotator-widget .annotator-item,
.annotator-editor .annotator-item input,
.annotator-editor .annotator-item textarea {
position: relative;
font-size: 12px;
}
.annotator-viewer .annotator-item {
border-top: 2px solid rgba(122, 122, 122, 0.2);
}
.annotator-widget .annotator-item:first-child {
border-top: none;
}
.annotator-editor .annotator-item,
.annotator-viewer div {
border-top: 1px solid rgba(133, 133, 133, 0.11);
}
/* Annotator Viewer
-------------------------------------------------------------------- */
.annotator-viewer div {
padding: 6px 6px;
}
.annotator-viewer .annotator-item ol,
.annotator-viewer .annotator-item ul {
padding: 4px 16px;
}
.annotator-viewer .annotator-item li {
}
.annotator-viewer div:first-of-type,
.annotator-editor .annotator-item:first-child textarea {
padding-top: 12px;
padding-bottom: 12px;
color: rgb(60, 60, 60);
font-size: 13px;
font-style: italic;
line-height: 1.3;
border-top: none;
}
.annotator-viewer .annotator-controls {
position: relative;
top: 5px;
right: 5px;
padding-left: 5px;
opacity: 0;
-webkit-transition: opacity 0.2s ease-in;
-moz-transition: opacity 0.2s ease-in;
-o-transition: opacity 0.2s ease-in;
transition: opacity 0.2s ease-in;
float: right;
}
.annotator-viewer li:hover .annotator-controls,
.annotator-viewer li .annotator-controls.annotator-visible {
opacity: 1;
}
.annotator-viewer .annotator-controls button,
.annotator-viewer .annotator-controls a {
cursor: pointer;
display: inline-block;
width: 13px;
height: 13px;
margin-left: 2px;
border: none;
opacity: 0.2;
text-indent: -900em;
background-color: transparent;
outline: none;
}
.annotator-viewer .annotator-controls button:hover,
.annotator-viewer .annotator-controls button:focus,
.annotator-viewer .annotator-controls a:hover,
.annotator-viewer .annotator-controls a:focus {
opacity: 0.9;
}
.annotator-viewer .annotator-controls button:active,
.annotator-viewer .annotator-controls a:active {
opacity: 1;
}
.annotator-viewer .annotator-controls button[disabled] {
display: none;
}
.annotator-viewer .annotator-controls .annotator-edit {
background-position: 0 -60px;
}
.annotator-viewer .annotator-controls .annotator-delete {
background-position: 0 -75px;
}
.annotator-viewer .annotator-controls .annotator-link {
background-position: 0 -270px;
}
/* Annotator Editor
-------------------------------------------------------------------- */
.annotator-editor .annotator-item {
position: relative;
}
.annotator-editor .annotator-item label {
top: 0;
display: inline;
cursor: pointer;
font-size: 12px;
}
.annotator-editor .annotator-item input,
.annotator-editor .annotator-item textarea {
display: block;
min-width: 100%;
padding: 10px 8px;
border: none;
margin: 0;
color: rgb(60, 60, 60);
background: none;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
resize: none;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar {
height: 8px;
width: 8px;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-track-piece {
margin: 13px 0 3px;
background-color: #e5e5e5;
-webkit-border-radius: 4px;
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:vertical {
height: 25px;
background-color: #ccc;
-webkit-border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}
.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:horizontal {
width: 25px;
background-color: #ccc;
-webkit-border-radius: 4px;
}
.annotator-editor .annotator-item:first-child textarea {
min-height: 5.5em;
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-o-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.annotator-editor .annotator-item input:focus,
.annotator-editor .annotator-item textarea:focus{
background-color: rgb(243, 243, 243);
outline: none;
}
.annotator-editor .annotator-item input[type=radio],
.annotator-editor .annotator-item input[type=checkbox] {
width: auto;
min-width: 0;
padding: 0;
display: inline;
margin: 0 4px 0 0;
cursor: pointer;
}
.annotator-editor .annotator-checkbox {
padding: 8px 6px;
}
.annotator-filter,
.annotator-filter .annotator-filter-navigation button,
.annotator-editor .annotator-controls {
text-align: right;
padding: 3px;
border-top: 1px solid rgb(212,212,212);
background-color: rgb(212, 212, 212);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(245, 245, 245)),
color-stop(0.6, rgb(220, 220, 220)),
to(rgb(210, 210, 210))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
background-image: linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(220, 220, 220) 60%,
rgb(210, 210, 210)
);
-webkit-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-moz-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-o-box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
box-shadow:
inset 1px 0 0 rgba(255, 255, 255, 0.7),
inset -1px 0 0 rgba(255, 255, 255, 0.7),
inset 0 1px 0 rgba(255, 255, 255, 0.7);
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
.annotator-editor.annotator-invert-y .annotator-controls {
border-top: none;
border-bottom: 1px solid rgb(180, 180, 180);
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-o-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.annotator-editor a,
.annotator-filter .annotator-filter-property label {
position: relative;
display: inline-block;
padding: 0 6px 0 22px;
color: rgb(54, 54, 54);
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
text-decoration: none;
line-height: 24px;
font-size: 12px;
font-weight: bold;
border: 1px solid rgb(162, 162, 162);
background-color: rgb(212, 212, 212);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(245, 245, 245)),
color-stop(0.5, rgb(210, 210, 210)),
color-stop(0.5, rgb(190, 190, 190)),
to(rgb(210, 210, 210))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
background-image: linear-gradient(
-90deg,
rgb(245, 245, 245),
rgb(210, 210, 210) 50%,
rgb(190, 190, 190) 50%,
rgb(210, 210, 210)
);
-webkit-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-moz-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-o-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
.annotator-editor a::after {
position: absolute;
top: 50%;
left: 5px;
display: block;
content: "";
width: 15px;
height: 15px;
margin-top: -7px;
background-position: 0 -90px;
}
.annotator-editor a:hover,
.annotator-editor a:focus,
.annotator-editor a.annotator-focus,
.annotator-filter .annotator-filter-active label,
.annotator-filter .annotator-filter-navigation button:hover {
outline: none;
border-color: rgb(67, 90, 160);
background-color: rgb(56, 101, 249);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(118, 145, 251)),
color-stop(0.5, rgb(80, 117, 251)),
color-stop(0.5, rgb(56, 101, 249)),
to(rgb(54, 101, 250))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
background-image: linear-gradient(
-90deg,
rgb(118, 145, 251),
rgb(80, 117, 251) 50%,
rgb(56, 101, 249) 50%,
rgb(54, 101, 250)
);
color: rgb(255, 255, 255);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.42);
}
.annotator-editor a:hover::after,
.annotator-editor a:focus::after {
margin-top: -8px;
background-position: 0 -105px;
}
.annotator-editor a:active,
.annotator-filter .annotator-filter-navigation button:active {
border-color: rgb(112, 12, 73);
background-color: rgb(209, 46, 142);
background-image: -webkit-gradient(
linear, left top, left bottom,
from(rgb(252, 124, 202)),
color-stop(0.5, rgb(232, 93, 178)),
color-stop(0.5, rgb(209, 46, 142)),
to(rgb(255, 0, 156))
);
background-image: -moz-linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
background-image: -webkit-linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
background-image: linear-gradient(
-90deg,
rgb(252, 124, 202),
rgb(232, 93, 178) 50%,
rgb(209, 46, 142) 50%,
rgb(255, 0, 156)
);
}
.annotator-editor a.annotator-save::after {
background-position: 0 -120px;
}
.annotator-editor a.annotator-save:hover::after,
.annotator-editor a.annotator-save:focus::after,
.annotator-editor a.annotator-save.annotator-focus::after {
margin-top: -8px;
background-position: 0 -135px;
}
.annotator-editor .annotator-widget::after {
background-position: 0 -30px;
}
.annotator-editor.annotator-invert-y .annotator-widget .annotator-controls {
background-color: #f2f2f2;
}
.annotator-editor.annotator-invert-y .annotator-widget::after {
background-position: 0 -45px;
height: 11px;
}
.annotator-resize {
position: absolute;
top: 0;
right: 0;
width: 12px;
height: 12px;
background-position: 2px -150px;
}
.annotator-invert-x .annotator-resize {
right: auto;
left: 0;
background-position: 0 -195px;
}
.annotator-invert-y .annotator-resize {
top: auto;
bottom: 0;
background-position: 2px -165px;
}
.annotator-invert-y.annotator-invert-x .annotator-resize {
background-position: 0 -180px;
}
/* Annotator Notification
-------------------------------------------------------------------- */
.annotator-notice {
color: #fff;
position: absolute;
position: fixed;
top: -54px;
left: 0;
width: 100%;
font-size: 14px;
line-height: 50px;
text-align: center;
background: black;
background: rgba(0, 0, 0, 0.9);
border-bottom: 4px solid #d4d4d4;
-webkit-transition: top 0.4s ease-out;
-moz-transition: top 0.4s ease-out;
-o-transition: top 0.4s ease-out;
transition: top 0.4s ease-out;
}
.ie6 .annotator-notice {
position: absolute;
}
.annotator-notice-success {
border-color: #3665f9;
}
.annotator-notice-error {
border-color: #ff7e00;
}
.annotator-notice p {
margin: 0;
}
.annotator-notice a {
color: #fff;
}
.annotator-notice-show {
top: 0;
}
/* Annotator Tags Plugin
-------------------------------------------------------------------- */
.annotator-tags {
margin-bottom: -2px;
}
.annotator-tags .annotator-tag {
display: inline-block;
padding: 0 8px;
margin-bottom: 2px;
line-height: 1.6;
font-weight: bold;
background-color: rgb(230, 230, 230);
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
-o-border-radius: 8px;
border-radius: 8px;
}
/* Annotator Filter Plugin
-------------------------------------------------------------------- */
.annotator-filter {
position: fixed;
top: 0;
right: 0;
left: 0;
text-align: left;
line-height: 0;
border: none;
border-bottom: 1px solid #878787;
padding-left: 10px;
padding-right: 10px;
-webkit-border-radius: 0;
-moz-border-radius: 0;
-o-border-radius: 0;
border-radius: 0;
-webkit-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
-moz-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
-o-box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
box-shadow:
inset 0 -1px 0 rgba(255, 255, 255, 0.3);
}
.annotator-filter strong {
font-size: 12px;
font-weight: bold;
color: #3c3c3c;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
position: relative;
top: -9px;
}
.annotator-filter .annotator-filter-property,
.annotator-filter .annotator-filter-navigation {
position: relative;
display: inline-block;
overflow: hidden;
line-height: 10px;
padding: 2px 0;
margin-right: 8px;
}
.annotator-filter .annotator-filter-property label,
.annotator-filter .annotator-filter-navigation button {
text-align: left;
display: block;
float: left;
line-height: 20px;
-webkit-border-radius: 10px 0 0 10px;
-moz-border-radius: 10px 0 0 10px;
-o-border-radius: 10px 0 0 10px;
border-radius: 10px 0 0 10px;
}
.annotator-filter .annotator-filter-property label {
padding-left: 8px;
}
.annotator-filter .annotator-filter-property input {
display: block;
float: right;
-webkit-appearance: none;
background-color: #fff;
border: 1px solid #878787;
border-left: none;
padding: 2px 4px;
line-height: 16px;
min-height: 16px;
font-size: 12px;
width: 150px;
color: #333;
background-color: #f8f8f8;
-webkit-border-radius: 0 10px 10px 0;
-moz-border-radius: 0 10px 10px 0;
-o-border-radius: 0 10px 10px 0;
border-radius: 0 10px 10px 0;
-webkit-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
-o-box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
box-shadow:
inset 0 1px 1px rgba(0, 0, 0, 0.2);
}
.annotator-filter .annotator-filter-property input:focus {
outline: none;
background-color: #fff;
}
.annotator-filter .annotator-filter-clear {
position: absolute;
right: 3px;
top: 6px;
border: none;
text-indent: -900em;
width: 15px;
height: 15px;
background-position: 0 -90px;
opacity: 0.4;
}
.annotator-filter .annotator-filter-clear:hover,
.annotator-filter .annotator-filter-clear:focus {
opacity: 0.8;
}
.annotator-filter .annotator-filter-clear:active {
opacity: 1;
}
.annotator-filter .annotator-filter-navigation button {
border: 1px solid rgb(162, 162, 162);
padding: 0;
text-indent: -900px;
width: 20px;
min-height: 22px;
-webkit-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-moz-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
-o-box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
box-shadow:
inset 0 0 5px rgba(255, 255, 255, 0.2),
inset 0 0 1px rgba(255, 255, 255, 0.8);
}
.annotator-filter .annotator-filter-navigation button,
.annotator-filter .annotator-filter-navigation button:hover,
.annotator-filter .annotator-filter-navigation button:focus {
color: transparent;
}
.annotator-filter .annotator-filter-navigation button::after {
position: absolute;
top: 8px;
left: 8px;
content: "";
display: block;
width: 9px;
height: 9px;
background-position: 0 -210px;
}
.annotator-filter .annotator-filter-navigation button:hover::after {
background-position: 0 -225px;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next {
-webkit-border-radius: 0 10px 10px 0;
-moz-border-radius: 0 10px 10px 0;
-o-border-radius: 0 10px 10px 0;
border-radius: 0 10px 10px 0;
border-left: none;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next::after {
left: auto;
right: 7px;
background-position: 0 -240px;
}
.annotator-filter .annotator-filter-navigation .annotator-filter-next:hover::after {
background-position: 0 -255px;
}
.annotator-hl-active {
background: rgba(255, 255, 10, 0.8);
}
.annotator-hl-filtered {
background-color: transparent;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment