-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathproxy-random.user.js
More file actions
29 lines (26 loc) · 1012 Bytes
/
Copy pathproxy-random.user.js
File metadata and controls
29 lines (26 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// ==UserScript==
// @name Proxy Random
// @namespace http://stackoverflow.com/users/982924/rasg
// @author RASG
// @icon https://www.clipartmax.com/png/full/114-1147589_reverse-proxy-reverse-proxy-icon.png
// @version 2012.06.14.1010
// @description Load webpages and links through a random proxy.
// @include http*://*
// ==/UserScript==
var matriz = ['https://cache-001.appspot.com/', 'https://cache-003.appspot.com/', 'https://cache-017.appspot.com/', 'https://meme-darwin.appspot.com/'];
var proxy = matriz[Math.floor(Math.random() * matriz.length)];
var temproxy = 0;
var url = window.location.href;
for (i in matriz) {
if (url.indexOf(matriz[i]) > -1) {
temproxy = 1;
}
}
if (temproxy == 0) {
window.location.replace(location.href.replace(location.protocol + '//', proxy));
for (var i = 0, link; (link = document.links[i]); i++) {
if (link.href.indexOf(proxy) < 0) {
link.href = link.href.replace(link.href.substring(0, 7), proxy);
}
}
}