Changeset 18706 for lang/javascript

Show
Ignore:
Timestamp:
09/03/08 12:01:37 (3 months ago)
Author:
lyokato
Message:

lang/javascript/ubiquity/mixi-updates.js: bugfix

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/ubiquity/mixi-updates.js

    r18673 r18706  
    55 * License: 
    66 * 
    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> 
    89 *   mixiapi.js is freely distributable under the terms of MIT license. 
    910 * 
     
    183184 * 
    184185/*---------------------------------------------------------------------------*/ 
     186 
     187 
     188 
    185189// 
    186190// wsse.js - Generate WSSE authentication header in JavaScript 
     
    227231function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} 
    228232function 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));} 
     233function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} 
    230234 
    231235/* 
     
    274278    } 
    275279 
    276     a = safe_add(a,olda); 
     280    a = safe_add(a, olda); 
    277281    b = safe_add(b, oldb); 
    278282    c = safe_add(c, oldc); 
     
    320324  } 
    321325 
    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); 
    323327  return core_sha1(opad.concat(hash), 512 + 160); 
    324328} 
     
    363367  var str = ""; 
    364368  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) 
    366370    str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); 
    367371  return str; 
     
    396400                |  ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); 
    397401    for(var j = 0; j < 4; j++) 
    398     {  
     402    { 
    399403      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; 
    400404      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); 
     
    437441        output = output +  
    438442        keyStr.charAt(enc1) +  
    439        keyStr.charAt(enc2) +  
     443        keyStr.charAt(enc2) +  
    440444        keyStr.charAt(enc3) +  
    441445        keyStr.charAt(enc4); 
     
    479483    var today = new Date(); 
    480484    var year  = today.getYear(); 
    481     if (year < 2000)    // 2K Fix, Isaac Powell 
     485    if (year < 2000)    // Y2K Fix, Isaac Powell 
    482486    year = year + 1900; // http://onyx.idbsu.edu/~ipowell 
    483487    var month = today.getMonth() + 1; 
     
    512516    timezone = "+" + timezone; 
    513517    } 
    514     if (month <= 9) mnth = "0" + month; 
     518    if (month <= 9) month = "0" + month; 
    515519    if (day <= 9) day = "0" + day; 
    516520    if (hour <= 9) hour = "0" + hour; 
     
    537541// 
    538542 
    539 function wsse(Passord) { 
     543function wsse(Password) { 
    540544    var PasswordDigest, Nonce, Created; 
    541545    var r = new Array; 
     
    558562} 
    559563 
     564//------------------ Mixi API 
    560565var MixiAPI = { 
    561566  Version: '0.0.1', 
     
    634639}; 
    635640MixiAPI.Handler.prototype.createPhotoAlbum = function(album, options) { 
    636   this.getPhotoHandler().createAlbum(alum, options); 
     641  this.getPhotoHandler().createAlbum(album, options); 
    637642}; 
    638643MixiAPI.Handler.prototype.getFriendsHandler = function() { 
     
    661666  return this.useWsse ? wsseHeader(this.username, this.password) : null; 
    662667}; 
    663 MixiAPI.Client.prototype.createHTTPRequest = function(method, ul, options, cacheHandler) { 
     668MixiAPI.Client.prototype.createHTTPRequest = function(method, url, options, cacheHandler) { 
    664669  options = options || {}; 
    665670  var req; 
     
    712717    if (this.cache[url]['last-modified']) 
    713718      req.setRequestHeader('If-Modified-Since', this.cache[url]['last-modified']); 
     719  } else { 
     720    this.cache[url] = new Object(); 
    714721  } 
    715722  req.send(null); 
     
    738745  var callback = (options['onSuccess'] || function(){}); 
    739746  options['onSuccess'] = function(res) { 
    740     var collections = res.getElementsagName('collection'); 
     747    var collections = res.getElementsByTagName('collection'); 
    741748    handler.baseUrl = collections.item(0).getAttribute('href'); 
    742749    handler.isLoaded = true; 
     
    802809          break; 
    803810      } 
    804    } 
     811    } 
    805812  } 
    806813  return author; 
     
    833840  var callback = (options['onSuccess'] || function(){}); 
    834841  options['onSuccess'] = function(res) { 
    835     var collections = res.getElementsByTagName('clection'); 
     842    var collections = res.getElementsByTagName('collection'); 
    836843    handler.baseUrl = collections.item(0).getAttribute('href'); 
    837844    handler.isLoaded = true; 
     
    862869  for (var i = 0; i < entries.length; i++) { 
    863870    var entry = entries.item(i); 
    864     var info = MixiAPI.NotifyHanler._parseEntry(entry); 
     871    var info = MixiAPI.NotifyHandler._parseEntry(entry); 
    865872    infos.push(info); 
    866873  } 
     
    894901          break; 
    895902        case 'updated': 
    896           info['timestamp'] = MixiAPIUtil.getDateNodeValue(node); 
     903          info['timestamp'] = MixiAPI.Util.getDateNodeValue(node); 
    897904          break; 
    898905      } 
     
    958965  var summary = album['summary'] || ''; 
    959966  var controlElement = '<app:control>\n'; 
    960   var accessLevel = album['acess_level'] || 'public'; 
     967  var accessLevel = album['access_level'] || 'public'; 
    961968  controlElement += '<permit:access>'+ accessLevel + '</permit:access>\n'; 
    962969  if (accessLevel == 'protected') { 
     
    10141021  var callback = (options['onSuccess'] || function(){}); 
    10151022  options['onSuccess'] = function(res) { 
    1016     var friends = MixiAPI.FriendsHandler._parseResponseXML(res);    callback(friends); 
     1023    var friends = MixiAPI.FriendsHandler._parseResponseXML(res); 
     1024    callback(friends); 
    10171025  }; 
    10181026  (options['onStart'] || function(){})(); 
     
    10461054        case 'id': 
    10471055          friend['id'] = MixiAPI.Util.getTextNodeValue(node); 
    1048          break; 
     1056          break; 
    10491057        case 'icon': 
    10501058          friend['image'] = MixiAPI.Util.getTextNodeValue(node); 
     
    11071115}; 
    11081116MixiAPI.UpdatesHandler._parseResponseXML = function(res) { 
    1109   var entries = res.getEByTagName('entry'); 
     1117  var entries = res.getElementsByTagName('entry'); 
    11101118  var updates = new Array(); 
    11111119  for (var i = 0; i < entries.length; i++) { 
     
    11701178  return author; 
    11711179}; 
     1180 
    11721181var mixiHandler = MixiAPI.createHandler(); 
    11731182CmdUtils.CreateCommand({