Many of you are already using Greasemonkey, for example, in FF. However, it is not convenient to write your own scripts, so we will not write FF here.
After a certain version of CH, it does not support online installation of. user. js scripts. For the sake of security, you must drag the prepared scripts to the chrome: // chrome/extensions/page for installation.
When writing a script for the first time, you need to solve the following problems:
- Take effect on some sites: Add a header such as: // @ include http://www.cnblogs.com /*
- How to Use jquery and other scripts: require can be used in the past. Now ch does not support it. For security reasons, you can also use the hack method to operate on the dom. It's very easy to say nothing, no, just paste jquery into it;
- How to call the function on the current page is not allowed by default. As mentioned above, it is possible to operate the dom. Write your script as follows:
Var script = document. createElement ('script'); script. appendChild (document. createTextNode ('+ main +') (); '); (document. head ). appendChild (script );