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