diff annotator_files/lib/plugin/auth.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/auth.js	Thu Apr 05 19:37:27 2012 +0200
+++ b/annotator_files/lib/plugin/auth.js	Mon Aug 27 19:05:38 2012 +0200
@@ -1,6 +1,7 @@
+// Generated by CoffeeScript 1.3.3
 var base64Decode, base64UrlDecode, createDateFromISO8601, parseToken,
-  __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; };
+  __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; };
 
 createDateFromISO8601 = function(string) {
   var d, date, offset, regexp, time, _ref;
@@ -8,12 +9,24 @@
   d = string.match(new RegExp(regexp));
   offset = 0;
   date = new Date(d[1], 0, 1);
-  if (d[3]) date.setMonth(d[3] - 1);
-  if (d[5]) date.setDate(d[5]);
-  if (d[7]) date.setHours(d[7]);
-  if (d[8]) date.setMinutes(d[8]);
-  if (d[10]) date.setSeconds(d[10]);
-  if (d[12]) date.setMilliseconds(Number("0." + d[12]) * 1000);
+  if (d[3]) {
+    date.setMonth(d[3] - 1);
+  }
+  if (d[5]) {
+    date.setDate(d[5]);
+  }
+  if (d[7]) {
+    date.setHours(d[7]);
+  }
+  if (d[8]) {
+    date.setMinutes(d[8]);
+  }
+  if (d[10]) {
+    date.setSeconds(d[10]);
+  }
+  if (d[12]) {
+    date.setMilliseconds(Number("0." + d[12]) * 1000);
+  }
   if (d[14]) {
     offset = (Number(d[16]) * 60) + Number(d[17]);
     offset *= (_ref = d[15] === '-') != null ? _ref : {
@@ -36,7 +49,9 @@
     ac = 0;
     dec = "";
     tmp_arr = [];
-    if (!data) return data;
+    if (!data) {
+      return data;
+    }
     data += '';
     while (i < data.length) {
       h1 = b64.indexOf(data.charAt(i++));
@@ -60,10 +75,10 @@
 };
 
 base64UrlDecode = function(data) {
-  var i, m, _ref;
+  var i, m, _i, _ref;
   m = data.length % 4;
   if (m !== 0) {
-    for (i = 0, _ref = 4 - m; 0 <= _ref ? i < _ref : i > _ref; 0 <= _ref ? i++ : i--) {
+    for (i = _i = 0, _ref = 4 - m; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
       data += '=';
     }
   }
@@ -175,12 +190,16 @@
   };
 
   Auth.prototype.withToken = function(callback) {
-    if (!(callback != null)) return;
+    if (!(callback != null)) {
+      return;
+    }
     if (this.haveValidToken()) {
       return callback(this._unsafeToken);
     } else {
       this.waitingForToken.push(callback);
-      if (!this.requestInProgress) return this.requestToken();
+      if (!this.requestInProgress) {
+        return this.requestToken();
+      }
     }
   };