Changeset 4:6979313586cf in OKFNAnnotator (for Zope) for annotator_files/lib/plugin/auth.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/auth.js
r3 r4 1 // Generated by CoffeeScript 1.3.3 1 2 var 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; }; 4 5 5 6 createDateFromISO8601 = function(string) { … … 9 10 offset = 0; 10 11 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 } 17 30 if (d[14]) { 18 31 offset = (Number(d[16]) * 60) + Number(d[17]); … … 37 50 dec = ""; 38 51 tmp_arr = []; 39 if (!data) return data; 52 if (!data) { 53 return data; 54 } 40 55 data += ''; 41 56 while (i < data.length) { … … 61 76 62 77 base64UrlDecode = function(data) { 63 var i, m, _ ref;78 var i, m, _i, _ref; 64 79 m = data.length % 4; 65 80 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) { 67 82 data += '='; 68 83 } … … 176 191 177 192 Auth.prototype.withToken = function(callback) { 178 if (!(callback != null)) return; 193 if (!(callback != null)) { 194 return; 195 } 179 196 if (this.haveValidToken()) { 180 197 return callback(this._unsafeToken); 181 198 } else { 182 199 this.waitingForToken.push(callback); 183 if (!this.requestInProgress) return this.requestToken(); 200 if (!this.requestInProgress) { 201 return this.requestToken(); 202 } 184 203 } 185 204 };
Note: See TracChangeset
for help on using the changeset viewer.