weibo.js
[app.webkitpdf] / weibo.js
1
2 (function run_weibo(u, p){
3     if(document.location.host=='weibo.com') {
4         // clear login dialog from weibo.
5         //check and hidden the login dialog and overlay .....
6         var els = document.querySelectorAll('div[node-type]');
7         var bbc = [];
8         for (i = 0; i < els.length; i++) {
9             if (els[i].hasAttribute('node-type')) {
10                 if(els[i].getAttribute('node-type') == 'outer'){
11                     bbc.push(els[i]);
12                 }
13             }
14         }
15         for (i = 0; i < bbc.length; i++) {// hide all the outer.....
16             bbc[i].style.display = 'none';
17         }
18
19         //try to login 
20         if(document.location.pathname == '/login.php'){
21
22             // fills in the user name and password 
23             var els = document.querySelectorAll('input[node-type]');
24
25             for (i = 0; i < els.length; i++) {
26                 if (els[i].hasAttribute('node-type')) {
27                     if(els[i].getAttribute('node-type') == 'username'){
28                         els[i].value = u;
29                     }
30                     if(els[i].getAttribute('node-type') == 'password'){
31                         els[i].value = p;
32                     }
33                 }
34             }
35
36
37             // simulating click event to login ....
38             var elss = document.querySelectorAll('a[node-type]');
39
40             for (i = 0; i < elss.length; i++) {
41                 if (elss[i].hasAttribute('node-type')) {
42                     if(elss[i].getAttribute('node-type') == 'submitBtn'){
43                         elss[i].click();
44                     }
45                 }
46             }
47
48
49         }
50
51     }
52 })