-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathproxy-load-image.user.js
More file actions
41 lines (36 loc) · 1.33 KB
/
Copy pathproxy-load-image.user.js
File metadata and controls
41 lines (36 loc) · 1.33 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
// ==UserScript==
// @name Proxy Load Image
// @namespace http://stackoverflow.com/users/982924/rasg
// @author RASG
// @version 2012.06.14.1010
// @icon https://www.clipartmax.com/png/full/114-1147589_reverse-proxy-reverse-proxy-icon.png
// @description Load images through a random proxy.
// @include *
// @exclude *intranet*
// ==/UserScript==
// Only images are loaded through the proxy. links remain untouched.
var imagens = ['.bmp', '.gif', '.img', 'imgur.com', '.jpeg', '.jpg', '.png'];
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 (j in matriz)
if (url.indexOf(matriz[j]) > -1)
temproxy = 1;
if (temproxy == 0) {
for (var i = 0, link; (link = document.links[i]); i++) {
for (h in imagens) {
if (link.href.indexOf(imagens[h]) > -1) {
link.href = link.href.replace(location.protocol + '//', proxy);
// GM_log(link.href);
}
}
}
}
/* Replace the 'img src' */
if (temproxy == 0) {
for (var x = 0; x < document.images.length; x++) {
imagem = document.images[x];
imagem.src = imagem.src.replace(location.protocol + '//', proxy);
}
}