Changeset 4:6979313586cf in OKFNAnnotator (for Zope) for annotator_files/lib/plugin/tags.js


Ignore:
Timestamp:
Aug 27, 2012, 5:05:38 PM (12 years ago)
Author:
casties
Branch:
default
Message:

new version of annotator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • annotator_files/lib/plugin/tags.js

    r3 r4  
     1// Generated by CoffeeScript 1.3.3
    12var __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; };
    45
    56Annotator.Plugin.Tags = (function(_super) {
     
    910  function Tags() {
    1011    this.setAnnotationTags = __bind(this.setAnnotationTags, this);
     12
    1113    this.updateField = __bind(this.updateField, this);
    12     Tags.__super__.constructor.apply(this, arguments);
     14    return Tags.__super__.constructor.apply(this, arguments);
    1315  }
    1416
     
    1820      string = $.trim(string);
    1921      tags = [];
    20       if (string) tags = string.split(/\s+/);
     22      if (string) {
     23        tags = string.split(/\s+/);
     24      }
    2125      return tags;
    2226    },
     
    3135
    3236  Tags.prototype.pluginInit = function() {
    33     if (!Annotator.supported()) return;
     37    if (!Annotator.supported()) {
     38      return;
     39    }
    3440    this.field = this.annotator.editor.addField({
    3541      label: Annotator._t('Add some tags here') + '\u2026',
     
    6167    var value;
    6268    value = '';
    63     if (annotation.tags) value = this.stringifyTags(annotation.tags);
     69    if (annotation.tags) {
     70      value = this.stringifyTags(annotation.tags);
     71    }
    6472    return this.input.val(value);
    6573  };
     
    8896
    8997Annotator.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  }
    92102  matches = 0;
    93103  keywords = [];
     
    97107      keyword = keywords[_i];
    98108      if (tags.length) {
    99         for (_j = 0, _len2 = tags.length; _j < _len2; _j++) {
     109        for (_j = 0, _len1 = tags.length; _j < _len1; _j++) {
    100110          tag = tags[_j];
    101           if (tag.indexOf(keyword) !== -1) matches += 1;
     111          if (tag.indexOf(keyword) !== -1) {
     112            matches += 1;
     113          }
    102114        }
    103115      }
Note: See TracChangeset for help on using the changeset viewer.