RandomProxy

[PT] Carrega paginas e links atraves de um proxy aleatorio. [EN] Load webpages and links through a random proxy.

  1. // ==UserScript==
  2. // @name RandomProxy
  3. // @namespace http://stackoverflow.com/users/982924/rasg
  4. // @author RASG
  5. // @version 2012.06.14
  6. // @description [PT] Carrega paginas e links atraves de um proxy aleatorio. [EN] Load webpages and links through a random proxy.
  7. // @include http*://*
  8. // ==/UserScript==
  9.  
  10. var matriz = ['https://cache-001.appspot.com/','https://cache-003.appspot.com/','https://cache-017.appspot.com/','https://meme-darwin.appspot.com/'];
  11. var proxy = matriz[Math.floor(Math.random() * matriz.length)];
  12. var temproxy = 0;
  13. var url = window.location.href;
  14.  
  15. for (i in matriz) {
  16. if (url.indexOf(matriz[i]) > -1) {
  17. temproxy = 1;
  18. }
  19. }
  20. if (temproxy == 0) {
  21. window.location.replace(location.href.replace(location.protocol + '//', proxy));
  22. for (var i=0,link; (link=document.links[i]); i++) {
  23. if (link.href.indexOf(proxy) < 0) {
  24. link.href = link.href.replace(link.href.substring(0,7), proxy);
  25. }
  26. }
  27. }