Show
Ignore:
Timestamp:
09/24/07 13:34:51 (16 months ago)
Author:
cho45
Message:

lang/javascript/userchrome/tumblr-multi.uc.js:

ログイン後にブックマークレットを実行するように
クッキーを保存して毎回ログインしないようにしようとしたが
うまくいかない

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userchrome/tumblr-multi.uc.js

    r267 r269  
    5656 
    5757                this.menu = document.createElementNS(kXULNS, "menupopup"); 
    58 //              proxySetting.forEach(function (f) { 
    59 //                      var mi = document.createElementNS(kXULNS, "menuitem"); 
    60 //                      mi.setAttribute("label", f.name); 
    61 //                      mi.addEventListener("command", command, false); 
    62 //                      menu.appendChild(mi); 
    63 //              }); 
    6458 
    6559                this.panel.appendChild(this.menu); 
     
    10094        switchUser : function (password) { 
    10195                var self = this; 
     96                this.sessions = this.sessions || {}; 
    10297 
    10398//              var cookie = this.cookies.getCookieString(this.IOService.newURI("http://www.tumblr.com", null, null), null) 
    104 //              alert(cookie); 
    10599                self.setStatus("Logging in..."); 
    106100                var req = new XMLHttpRequest; 
    107101                req.open("POST", "http://www.tumblr.com/login", true); 
    108                 req.onload = function (e) { 
     102                req.onload = function (e) { try { 
    109103                        if (req.responseText.match(/Logging in/)) { 
    110104                                self.setStatus(password.user); 
     105                                content.location = "javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://www.tumblr.com/share',l=d.location,e=encodeURIComponent,p='?v=3&u='+e(l.href) +'&t='+e(d.title) +'&s='+e(s),u=f+p;try{if(!/^(.*\\.)?tumblr[^.]*$/.test(l.host))throw(0);tstbklt();}catch(z){a =function(){if(!w.open(u,'t','toolbar=0,resizable=0,status=1,width=450,height=430'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();}void(0)"; 
     106                        } else { 
     107                                self.setStatus("Failed"); 
    111108                        } 
    112                 }; 
     109                } catch (e) { alert(e) } }; 
    113110                req.onerror = function (e) { 
    114111                        alert(e); 
     
    116113                req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
    117114                req.send([ 
    118                         "email=", encodeURI(password.user), 
    119                         "&password=", encodeURI(password.password), 
     115                        "email=", encodeURIComponent(password.user), 
     116                        "&password=", encodeURIComponent(password.password), 
    120117                ].join("")); 
    121118