equal
deleted
inserted
replaced
89 if (typeof _t == "string") { |
89 if (typeof _t == "string") { |
90 return _t.replace(/^.*:/,'#'); |
90 return _t.replace(/^.*:/,'#'); |
91 } else { |
91 } else { |
92 if (typeof _t['id-ref'] != "undefined") { |
92 if (typeof _t['id-ref'] != "undefined") { |
93 var _f = IriSP.underscore.find(_this._serializer._data.tags, function(_tag) { |
93 var _f = IriSP.underscore.find(_this._serializer._data.tags, function(_tag) { |
94 return _tag['id-ref'] == _t.id; |
94 return _tag.id == _t['id-ref']; |
95 }); |
95 }); |
96 if (typeof _f != "undefined") { |
96 if (typeof _f != "undefined") { |
97 return IriSP.get_aliased(_f.meta, ['dc:title', 'title']); |
97 return IriSP.get_aliased(_f.meta, ['dc:title', 'title']); |
98 } |
98 } |
99 } |
99 } |
220 for (i = 0; i < annotations.length; i++) { |
220 for (i = 0; i < annotations.length; i++) { |
221 var obj = this.transformAnnotation(annotations[i]) |
221 var obj = this.transformAnnotation(annotations[i]) |
222 if (typeof obj.url == "undefined" || !obj.url) { |
222 if (typeof obj.url == "undefined" || !obj.url) { |
223 /* only if the annotation isn't present in the document create an |
223 /* only if the annotation isn't present in the document create an |
224 external link */ |
224 external link */ |
225 if (!this.annotations_ids.indexOf(obj.id) != -1) { |
225 if (this.annotations_ids.indexOf(obj.id.toLowerCase()) == -1) { |
226 // braindead url; jacques didn't want to create a new one in the platform, |
226 // braindead url; jacques didn't want to create a new one in the platform, |
227 // so we append the cutting id to the url. |
227 // so we append the cutting id to the url. |
228 obj.url = this.project_url + "/" + media + "/" + |
228 obj.url = this.project_url + "/" + media + "/" + |
229 annotations[i].meta.project + "/" + |
229 annotations[i].meta.project + "/" + |
230 annotations[i].meta["id-ref"] + '#id=' + annotations[i].id; |
230 annotations[i].meta["id-ref"] + '#id=' + annotations[i].id; |
231 |
231 |
232 // obj.url = document.location.href.split("#")[0] + "/" + annotation.meta.project; |
232 // obj.url = document.location.href.split("#")[0] + "/" + annotation.meta.project; |
233 } |
233 } |
234 } |
234 } |
235 l.push(obj); |
235 l.push(obj); |
236 } |
236 } |
240 IriSP.AnnotationsListWidget.prototype.draw = function() { |
240 IriSP.AnnotationsListWidget.prototype.draw = function() { |
241 |
241 |
242 /* build a table of the annotations present in the document for faster |
242 /* build a table of the annotations present in the document for faster |
243 lookup |
243 lookup |
244 */ |
244 */ |
245 this.annotations_ids = []; |
245 this.annotations_ids = IriSP.underscore(this._serializer._data.annotations).map(function(_a) { |
246 |
246 return _a.id.toLowerCase(); |
247 var annotations = this._serializer._data.annotations; |
247 }); |
248 var i = 0; |
|
249 for(i = 0; i < annotations.length; i++) { |
|
250 this.annotations_ids.push(annotations[i]["id"]); |
|
251 } |
|
252 |
248 |
253 var _this = this; |
249 var _this = this; |
254 |
250 |
255 if (!this.ajax_mode) { |
251 if (!this.ajax_mode) { |
256 var _throttled = IriSP.underscore.throttle(function() { |
252 var _throttled = IriSP.underscore.throttle(function() { |