Changeset 18706
- Timestamp:
- 09/03/08 12:01:37 (4 months ago)
- Files:
-
- 1 modified
-
lang/javascript/ubiquity/mixi-updates.js (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/ubiquity/mixi-updates.js
r18673 r18706 5 5 * License: 6 6 * 7 * Developer: Lyo Kato, <lyo.kato _at_ gmail.com> 7 * Copyright (c) 2004-2007 mixi, inc. 8 * Developer: Lyo Kato, <ryokato _at_ mixi.co.jp> 8 9 * mixiapi.js is freely distributable under the terms of MIT license. 9 10 * … … 183 184 * 184 185 /*---------------------------------------------------------------------------*/ 186 187 188 185 189 // 186 190 // wsse.js - Generate WSSE authentication header in JavaScript … … 227 231 function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} 228 232 function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));} 229 function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, da ));}233 function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} 230 234 231 235 /* … … 274 278 } 275 279 276 a = safe_add(a, olda);280 a = safe_add(a, olda); 277 281 b = safe_add(b, oldb); 278 282 c = safe_add(c, oldc); … … 320 324 } 321 325 322 var hash = core_sha1(ipad.concat(str2binb(dat )), 512 + data.length * chrsz);326 var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); 323 327 return core_sha1(opad.concat(hash), 512 + 160); 324 328 } … … 363 367 var str = ""; 364 368 var mask = (1 << chrsz) - 1; 365 for(var i = 0; i < bin.length * 32; i += chrsz)369 for(var i = 0; i < bin.length * 32; i += chrsz) 366 370 str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); 367 371 return str; … … 396 400 | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); 397 401 for(var j = 0; j < 4; j++) 398 { 402 { 399 403 if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; 400 404 else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); … … 437 441 output = output + 438 442 keyStr.charAt(enc1) + 439 keyStr.charAt(enc2) +443 keyStr.charAt(enc2) + 440 444 keyStr.charAt(enc3) + 441 445 keyStr.charAt(enc4); … … 479 483 var today = new Date(); 480 484 var year = today.getYear(); 481 if (year < 2000) // 2K Fix, Isaac Powell485 if (year < 2000) // Y2K Fix, Isaac Powell 482 486 year = year + 1900; // http://onyx.idbsu.edu/~ipowell 483 487 var month = today.getMonth() + 1; … … 512 516 timezone = "+" + timezone; 513 517 } 514 if (month <= 9) m nth = "0" + month;518 if (month <= 9) month = "0" + month; 515 519 if (day <= 9) day = "0" + day; 516 520 if (hour <= 9) hour = "0" + hour; … … 537 541 // 538 542 539 function wsse(Pass ord) {543 function wsse(Password) { 540 544 var PasswordDigest, Nonce, Created; 541 545 var r = new Array; … … 558 562 } 559 563 564 //------------------ Mixi API 560 565 var MixiAPI = { 561 566 Version: '0.0.1', … … 634 639 }; 635 640 MixiAPI.Handler.prototype.createPhotoAlbum = function(album, options) { 636 this.getPhotoHandler().createAlbum(al um, options);641 this.getPhotoHandler().createAlbum(album, options); 637 642 }; 638 643 MixiAPI.Handler.prototype.getFriendsHandler = function() { … … 661 666 return this.useWsse ? wsseHeader(this.username, this.password) : null; 662 667 }; 663 MixiAPI.Client.prototype.createHTTPRequest = function(method, u l, options, cacheHandler) {668 MixiAPI.Client.prototype.createHTTPRequest = function(method, url, options, cacheHandler) { 664 669 options = options || {}; 665 670 var req; … … 712 717 if (this.cache[url]['last-modified']) 713 718 req.setRequestHeader('If-Modified-Since', this.cache[url]['last-modified']); 719 } else { 720 this.cache[url] = new Object(); 714 721 } 715 722 req.send(null); … … 738 745 var callback = (options['onSuccess'] || function(){}); 739 746 options['onSuccess'] = function(res) { 740 var collections = res.getElements agName('collection');747 var collections = res.getElementsByTagName('collection'); 741 748 handler.baseUrl = collections.item(0).getAttribute('href'); 742 749 handler.isLoaded = true; … … 802 809 break; 803 810 } 804 }811 } 805 812 } 806 813 return author; … … 833 840 var callback = (options['onSuccess'] || function(){}); 834 841 options['onSuccess'] = function(res) { 835 var collections = res.getElementsByTagName('c lection');842 var collections = res.getElementsByTagName('collection'); 836 843 handler.baseUrl = collections.item(0).getAttribute('href'); 837 844 handler.isLoaded = true; … … 862 869 for (var i = 0; i < entries.length; i++) { 863 870 var entry = entries.item(i); 864 var info = MixiAPI.NotifyHan ler._parseEntry(entry);871 var info = MixiAPI.NotifyHandler._parseEntry(entry); 865 872 infos.push(info); 866 873 } … … 894 901 break; 895 902 case 'updated': 896 info['timestamp'] = MixiAPI Util.getDateNodeValue(node);903 info['timestamp'] = MixiAPI.Util.getDateNodeValue(node); 897 904 break; 898 905 } … … 958 965 var summary = album['summary'] || ''; 959 966 var controlElement = '<app:control>\n'; 960 var accessLevel = album['ac ess_level'] || 'public';967 var accessLevel = album['access_level'] || 'public'; 961 968 controlElement += '<permit:access>'+ accessLevel + '</permit:access>\n'; 962 969 if (accessLevel == 'protected') { … … 1014 1021 var callback = (options['onSuccess'] || function(){}); 1015 1022 options['onSuccess'] = function(res) { 1016 var friends = MixiAPI.FriendsHandler._parseResponseXML(res); callback(friends); 1023 var friends = MixiAPI.FriendsHandler._parseResponseXML(res); 1024 callback(friends); 1017 1025 }; 1018 1026 (options['onStart'] || function(){})(); … … 1046 1054 case 'id': 1047 1055 friend['id'] = MixiAPI.Util.getTextNodeValue(node); 1048 break;1056 break; 1049 1057 case 'icon': 1050 1058 friend['image'] = MixiAPI.Util.getTextNodeValue(node); … … 1107 1115 }; 1108 1116 MixiAPI.UpdatesHandler._parseResponseXML = function(res) { 1109 var entries = res.getE ByTagName('entry');1117 var entries = res.getElementsByTagName('entry'); 1110 1118 var updates = new Array(); 1111 1119 for (var i = 0; i < entries.length; i++) { … … 1170 1178 return author; 1171 1179 }; 1180 1172 1181 var mixiHandler = MixiAPI.createHandler(); 1173 1182 CmdUtils.CreateCommand({
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)