Last active
February 5, 2018 15:21
-
-
Save aequabit/b2caad72f8904c1d18926039d866d915 to your computer and use it in GitHub Desktop.
Image Proxy Fixer Userscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Image Proxy Fixer | |
// @namespace http://aequabit.de/ | |
// @version 0.1 | |
// @description Removes redundant image proxies from image source attributes | |
// @author aequabit | |
// @match *://*/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const replacements = ['images.011.ovh/?url=ssl:', 'https://images.011.ovh/?url=']; | |
const imageProxy = 'https://images.011.ovh/?url='; | |
const images = document.getElementsByTagName('img'); | |
for (const [i, image] of Object.entries(images)) { | |
if (image.src.indexOf('images.011.ovh') === -1) continue; | |
let final = image.src; | |
for (const replacement of replacements) final = final.split(replacement).join(''); | |
image.src = imageProxy + final.replace('http://', '').replace('https://', 'ssl:'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment