Skip to content

Instantly share code, notes, and snippets.

@aequabit
Last active February 5, 2018 15:21
Show Gist options
  • Save aequabit/b2caad72f8904c1d18926039d866d915 to your computer and use it in GitHub Desktop.
Save aequabit/b2caad72f8904c1d18926039d866d915 to your computer and use it in GitHub Desktop.
Image Proxy Fixer Userscript
// ==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