Changeset 4:6979313586cf in OKFNAnnotator (for Zope) for annotator_files/lib/plugin/auth.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/auth.js

    r3 r4  
     1// Generated by CoffeeScript 1.3.3
    12var base64Decode, base64UrlDecode, createDateFromISO8601, parseToken,
    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
    56createDateFromISO8601 = function(string) {
     
    910  offset = 0;
    1011  date = new Date(d[1], 0, 1);
    11   if (d[3]) date.setMonth(d[3] - 1);
    12   if (d[5]) date.setDate(d[5]);
    13   if (d[7]) date.setHours(d[7]);
    14   if (d[8]) date.setMinutes(d[8]);
    15   if (d[10]) date.setSeconds(d[10]);
    16   if (d[12]) date.setMilliseconds(Number("0." + d[12]) * 1000);
     12  if (d[3]) {
     13    date.setMonth(d[3] - 1);
     14  }
     15  if (d[5]) {
     16    date.setDate(d[5]);
     17  }
     18  if (d[7]) {
     19    date.setHours(d[7]);
     20  }
     21  if (d[8]) {
     22    date.setMinutes(d[8]);
     23  }
     24  if (d[10]) {
     25    date.setSeconds(d[10]);
     26  }
     27  if (d[12]) {
     28    date.setMilliseconds(Number("0." + d[12]) * 1000);
     29  }
    1730  if (d[14]) {
    1831    offset = (Number(d[16]) * 60) + Number(d[17]);
     
    3750    dec = "";
    3851    tmp_arr = [];
    39     if (!data) return data;
     52    if (!data) {
     53      return data;
     54    }
    4055    data += '';
    4156    while (i < data.length) {
     
    6176
    6277base64UrlDecode = function(data) {
    63   var i, m, _ref;
     78  var i, m, _i, _ref;
    6479  m = data.length % 4;
    6580  if (m !== 0) {
    66     for (i = 0, _ref = 4 - m; 0 <= _ref ? i < _ref : i > _ref; 0 <= _ref ? i++ : i--) {
     81    for (i = _i = 0, _ref = 4 - m; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
    6782      data += '=';
    6883    }
     
    176191
    177192  Auth.prototype.withToken = function(callback) {
    178     if (!(callback != null)) return;
     193    if (!(callback != null)) {
     194      return;
     195    }
    179196    if (this.haveValidToken()) {
    180197      return callback(this._unsafeToken);
    181198    } else {
    182199      this.waitingForToken.push(callback);
    183       if (!this.requestInProgress) return this.requestToken();
     200      if (!this.requestInProgress) {
     201        return this.requestToken();
     202      }
    184203    }
    185204  };
Note: See TracChangeset for help on using the changeset viewer.