Changeset 4:6979313586cf in OKFNAnnotator (for Zope) for annotator_files/lib/plugin/store.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/store.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; },
    4   __indexOf = Array.prototype.indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
     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; },
     5  __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; };
    56
    67Annotator.Plugin.Store = (function(_super) {
     
    3031  function Store(element, options) {
    3132    this._onError = __bind(this._onError, this);
     33
    3234    this._onLoadAnnotationsFromSearch = __bind(this._onLoadAnnotationsFromSearch, this);
     35
    3336    this._onLoadAnnotations = __bind(this._onLoadAnnotations, this);
    34     this._getAnnotations = __bind(this._getAnnotations, this);    Store.__super__.constructor.apply(this, arguments);
     37
     38    this._getAnnotations = __bind(this._getAnnotations, this);
     39    Store.__super__.constructor.apply(this, arguments);
    3540    this.annotations = [];
    3641  }
    3742
    3843  Store.prototype.pluginInit = function() {
    39     if (!Annotator.supported()) return;
     44    if (!Annotator.supported()) {
     45      return;
     46    }
    4047    if (this.annotator.plugins.Auth) {
    4148      return this.annotator.plugins.Auth.withToken(this._getAnnotations);
     
    108115
    109116  Store.prototype._onLoadAnnotations = function(data) {
    110     if (data == null) data = [];
     117    if (data == null) {
     118      data = [];
     119    }
    111120    this.annotations = data;
    112121    return this.annotator.loadAnnotations(data.slice());
     
    118127
    119128  Store.prototype._onLoadAnnotationsFromSearch = function(data) {
    120     if (data == null) data = {};
     129    if (data == null) {
     130      data = {};
     131    }
    121132    return this._onLoadAnnotations(data.rows || []);
    122133  };
     
    193204    $.extend(annotation, this.options.annotationData);
    194205    data = JSON.stringify(annotation);
    195     if (highlights) annotation.highlights = highlights;
     206    if (highlights) {
     207      annotation.highlights = highlights;
     208    }
    196209    return data;
    197210  };
Note: See TracChangeset for help on using the changeset viewer.