Changeset 4:6979313586cf in OKFNAnnotator (for Zope) for annotator_files/lib/plugin/store.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/store.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; },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; }; 5 6 6 7 Annotator.Plugin.Store = (function(_super) { … … 30 31 function Store(element, options) { 31 32 this._onError = __bind(this._onError, this); 33 32 34 this._onLoadAnnotationsFromSearch = __bind(this._onLoadAnnotationsFromSearch, this); 35 33 36 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); 35 40 this.annotations = []; 36 41 } 37 42 38 43 Store.prototype.pluginInit = function() { 39 if (!Annotator.supported()) return; 44 if (!Annotator.supported()) { 45 return; 46 } 40 47 if (this.annotator.plugins.Auth) { 41 48 return this.annotator.plugins.Auth.withToken(this._getAnnotations); … … 108 115 109 116 Store.prototype._onLoadAnnotations = function(data) { 110 if (data == null) data = []; 117 if (data == null) { 118 data = []; 119 } 111 120 this.annotations = data; 112 121 return this.annotator.loadAnnotations(data.slice()); … … 118 127 119 128 Store.prototype._onLoadAnnotationsFromSearch = function(data) { 120 if (data == null) data = {}; 129 if (data == null) { 130 data = {}; 131 } 121 132 return this._onLoadAnnotations(data.rows || []); 122 133 }; … … 193 204 $.extend(annotation, this.options.annotationData); 194 205 data = JSON.stringify(annotation); 195 if (highlights) annotation.highlights = highlights; 206 if (highlights) { 207 annotation.highlights = highlights; 208 } 196 209 return data; 197 210 };
Note: See TracChangeset
for help on using the changeset viewer.