X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=weibo.js;h=0f638e20c781ec3ffa5bb1c66ed38688344bcb7b;hb=67200f9f43f9a5198a55f1f8b49f07393960924f;hp=89dd1311421416788408b4edf34821231150f8b2;hpb=96b915d0e9356287fcaaa34bf1debd4bf9d4248e;p=app.webkitpdf diff --git a/weibo.js b/weibo.js index 89dd131..0f638e2 100644 --- a/weibo.js +++ b/weibo.js @@ -3,9 +3,7 @@ function run_weibo(u, p){ console.log("runing weibo"); if(document.location.host=='weibo.com') { - document.location='http://www.google.com'; - return; - + // clear login dialog from weibo. //check and hidden the login dialog and overlay ..... var els = document.querySelectorAll('div[node-type]'); @@ -21,40 +19,46 @@ function run_weibo(u, p){ bbc[i].style.display = 'none'; } - //try to login + //try to login + console.log(document.location.pathname); if(document.location.pathname == '/login.php'){ - console.log("runing weibo login"); + + // fills in the user name and password var els = document.querySelectorAll('input[node-type]'); - + console.log(els.length); + for (i = 0; i < els.length; i++) { + + console.log(els[i].name); if (els[i].hasAttribute('node-type')) { if(els[i].getAttribute('node-type') == 'username'){ els[i].value = u; + console.log("set pass:" + u); } if(els[i].getAttribute('node-type') == 'password'){ els[i].value = p; + console.log("set pass:" + p); } + } } - // simulating click event to login .... var elss = document.querySelectorAll('a[node-type]'); - + for (i = 0; i < elss.length; i++) { if (elss[i].hasAttribute('node-type')) { + if(elss[i].getAttribute('node-type') == 'submitBtn'){ elss[i].click(); console.log("press submit"); - return; + break; } } } - - } - + return; } }