Greasemonkey修改网页内指定函数.

 1 greasemonkey replace function?
 2 
 3 方法1:编写GM代码
 4 
 5 
 6 alert("hello2");
 7 
 8 var mydiv =document.getElementById("myDIV");
 9 mydiv.innerHTML="Replaced!!";
10 window.func =null;
11 
12 方法二:编写inject代码
13 
14 alert("hello2");
15 
16 function embed() {
17     window.func = null;
18   
19     var mydiv =document.getElementById("myDIV");
20     mydiv.innerHTML="Replaced!!";
21 }
22 
23 
24 var script = document.createElement('script'); 
25 script.type = "text/javascript"; 
26 script.innerHTML = "(" + embed + ")()";
27 document.getElementsByTagName('head')[0].appendChild(script);
View Code

 

Powered by Jekyll and Theme by solid

本站总访问量