Mercurial > hg > OKFNAnnotator
diff annotator_files/lib/viewer.js @ 4:6979313586cf
new version of annotator.
author | casties |
---|---|
date | Mon, 27 Aug 2012 19:05:38 +0200 |
parents | 6356e78ccf5c |
children |
line wrap: on
line diff
--- a/annotator_files/lib/viewer.js Thu Apr 05 19:37:27 2012 +0200 +++ b/annotator_files/lib/viewer.js Mon Aug 27 19:05:38 2012 +0200 @@ -1,7 +1,8 @@ +// Generated by CoffeeScript 1.3.3 var LinkParser, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __hasProp = Object.prototype.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; }; + __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.Viewer = (function(_super) { @@ -28,10 +29,15 @@ 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.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 = []; @@ -60,7 +66,7 @@ }; Viewer.prototype.load = function(annotations) { - var annotation, controller, controls, del, edit, element, field, item, link, links, list, _i, _j, _len, _len2, _ref, _ref2; + var annotation, controller, controls, del, edit, element, field, item, link, links, list, _i, _j, _len, _len1, _ref, _ref1; this.annotations = annotations || []; list = this.element.find('ul:first').empty(); _ref = this.annotations; @@ -98,9 +104,9 @@ } }; } - _ref2 = this.fields; - for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { - field = _ref2[_j]; + _ref1 = this.fields; + for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { + field = _ref1[_j]; element = $(field.element).clone().appendTo(item)[0]; field.load(element, annotation, controller); } @@ -146,7 +152,9 @@ LinkParser.prototype.get = function(rel, cond) { var d, k, keys, match, v, _i, _len, _ref, _results; - if (cond == null) cond = {}; + if (cond == null) { + cond = {}; + } cond = $.extend({}, cond, { rel: rel });