Redirect Userscripts.org to Userscripts-MIRROR.org

On any web page it will check if the clicked links goes to userscripts.org or userscripts.org:8080. If so, the link will be rewritten to point to userscripts-mirror.org.

目前为 2014-08-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Redirect Userscripts.org to Userscripts-MIRROR.org
  3. // @namespace https://greasyfork.org/users/4051
  4. // @description On any web page it will check if the clicked links goes to userscripts.org or userscripts.org:8080. If so, the link will be rewritten to point to userscripts-mirror.org.
  5. // @author KaZaC
  6. // @include *
  7. // @version 0.3
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. document.body.addEventListener('click', function(e){
  12. var targ = e.target || e.srcElement;
  13. if ( targ && targ.href && targ.href.match('https?:\/\/userscripts.org\/') ) {
  14. targ.href = targ.href.replace('://userscripts.org/', '://userscripts-mirror.org/');
  15. }
  16. if ( targ && targ.href && targ.href.match('https?:\/\/userscripts.org:8080') ) {
  17. targ.href = targ.href.replace('://userscripts.org:8080', '://userscripts-mirror.org');
  18. }
  19. });