diff annotator_files/lib/plugin/store.js @ 4:6979313586cf

new version of annotator.
author casties
date Mon, 27 Aug 2012 19:05:38 +0200
parents 6356e78ccf5c
children
line wrap: on
line diff
--- a/annotator_files/lib/plugin/store.js	Thu Apr 05 19:37:27 2012 +0200
+++ b/annotator_files/lib/plugin/store.js	Mon Aug 27 19:05:38 2012 +0200
@@ -1,7 +1,8 @@
+// Generated by CoffeeScript 1.3.3
 var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
-  __hasProp = Object.prototype.hasOwnProperty,
-  __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; },
-  __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; };
+  __hasProp = {}.hasOwnProperty,
+  __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; },
+  __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; };
 
 Annotator.Plugin.Store = (function(_super) {
 
@@ -29,14 +30,20 @@
 
   function Store(element, options) {
     this._onError = __bind(this._onError, this);
+
     this._onLoadAnnotationsFromSearch = __bind(this._onLoadAnnotationsFromSearch, this);
+
     this._onLoadAnnotations = __bind(this._onLoadAnnotations, this);
-    this._getAnnotations = __bind(this._getAnnotations, this);    Store.__super__.constructor.apply(this, arguments);
+
+    this._getAnnotations = __bind(this._getAnnotations, this);
+    Store.__super__.constructor.apply(this, arguments);
     this.annotations = [];
   }
 
   Store.prototype.pluginInit = function() {
-    if (!Annotator.supported()) return;
+    if (!Annotator.supported()) {
+      return;
+    }
     if (this.annotator.plugins.Auth) {
       return this.annotator.plugins.Auth.withToken(this._getAnnotations);
     } else {
@@ -107,7 +114,9 @@
   };
 
   Store.prototype._onLoadAnnotations = function(data) {
-    if (data == null) data = [];
+    if (data == null) {
+      data = [];
+    }
     this.annotations = data;
     return this.annotator.loadAnnotations(data.slice());
   };
@@ -117,7 +126,9 @@
   };
 
   Store.prototype._onLoadAnnotationsFromSearch = function(data) {
-    if (data == null) data = {};
+    if (data == null) {
+      data = {};
+    }
     return this._onLoadAnnotations(data.rows || []);
   };
 
@@ -192,7 +203,9 @@
     delete annotation.highlights;
     $.extend(annotation, this.options.annotationData);
     data = JSON.stringify(annotation);
-    if (highlights) annotation.highlights = highlights;
+    if (highlights) {
+      annotation.highlights = highlights;
+    }
     return data;
   };