sync
[app.wkmirror] / inject.js
1 //file which parses document body
2
3 function gatherlinks() { 
4         var urls= [];
5         for (var i= document.links.length; i-->0;){
6                 urls.push(document.links[i].href);
7                 
8         }
9         console.log(JSON.stringify( { method: 'gatherlinks' , data : urls }));
10         print('gatherlinks');
11         return urls;
12
13 }
14
15 function downloadpage(url) {
16         var xmlhttp = new XMLHttpRequest();
17                 
18                 //getting header info           
19                 xmlhttp.open("HEAD", url,true);
20                 xmlhttp.onreadystatechange=function() {
21                 if (xmlhttp.readyState==4) {
22                 console.log( JSON.stringify ({method: 'downloadpage', headers:xmlhttp.getAllResponseHeaders(), data:xmlhttp.responseText}));
23                 }
24                 
25                 xmlhttp.send(null);
26                 }
27 }
28
29
30         
31
32
33
34 //downloadpage();
35 //gatherlinks();