Changeset 4:6979313586cf in OKFNAnnotator (for Zope) for annotator_files/lib/plugin/tags.js
- Timestamp:
- Aug 27, 2012, 5:05:38 PM (12 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
annotator_files/lib/plugin/tags.js
r3 r4 1 // Generated by CoffeeScript 1.3.3 1 2 var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, 2 __hasProp = Object.prototype.hasOwnProperty,3 __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; };3 __hasProp = {}.hasOwnProperty, 4 __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; }; 4 5 5 6 Annotator.Plugin.Tags = (function(_super) { … … 9 10 function Tags() { 10 11 this.setAnnotationTags = __bind(this.setAnnotationTags, this); 12 11 13 this.updateField = __bind(this.updateField, this); 12 Tags.__super__.constructor.apply(this, arguments);14 return Tags.__super__.constructor.apply(this, arguments); 13 15 } 14 16 … … 18 20 string = $.trim(string); 19 21 tags = []; 20 if (string) tags = string.split(/\s+/); 22 if (string) { 23 tags = string.split(/\s+/); 24 } 21 25 return tags; 22 26 }, … … 31 35 32 36 Tags.prototype.pluginInit = function() { 33 if (!Annotator.supported()) return; 37 if (!Annotator.supported()) { 38 return; 39 } 34 40 this.field = this.annotator.editor.addField({ 35 41 label: Annotator._t('Add some tags here') + '\u2026', … … 61 67 var value; 62 68 value = ''; 63 if (annotation.tags) value = this.stringifyTags(annotation.tags); 69 if (annotation.tags) { 70 value = this.stringifyTags(annotation.tags); 71 } 64 72 return this.input.val(value); 65 73 }; … … 88 96 89 97 Annotator.Plugin.Tags.filterCallback = function(input, tags) { 90 var keyword, keywords, matches, tag, _i, _j, _len, _len2; 91 if (tags == null) tags = []; 98 var keyword, keywords, matches, tag, _i, _j, _len, _len1; 99 if (tags == null) { 100 tags = []; 101 } 92 102 matches = 0; 93 103 keywords = []; … … 97 107 keyword = keywords[_i]; 98 108 if (tags.length) { 99 for (_j = 0, _len 2 = tags.length; _j < _len2; _j++) {109 for (_j = 0, _len1 = tags.length; _j < _len1; _j++) { 100 110 tag = tags[_j]; 101 if (tag.indexOf(keyword) !== -1) matches += 1; 111 if (tag.indexOf(keyword) !== -1) { 112 matches += 1; 113 } 102 114 } 103 115 }
Note: See TracChangeset
for help on using the changeset viewer.