Skip to content

Instantly share code, notes, and snippets.

@loadletter
Last active October 2, 2021 10:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loadletter/ddf1c8672edb6df03b559005170046b9 to your computer and use it in GitHub Desktop.
Save loadletter/ddf1c8672edb6df03b559005170046b9 to your computer and use it in GitHub Desktop.
Rewrite image links to never use the slow and unreliable is2.4chan.org server (original: http://pastebin.com/T9tPKtsg)
// ==UserScript==
// @name 4chanimgfix
// @namespace Hiroshima Nagasaki
// @author Anonymous
// @match *://boards.4chan.org/*
// @grant none
// ==/UserScript==
var a_scan = document.getElementsByClassName("fileThumb");
var hiroshima, nagasaki;
for(var i = 0; i < a_scan.length; i++) {
hiroshima = a_scan[i];
nagasaki = hiroshima.getAttribute('href');
if(nagasaki) hiroshima.setAttribute('href', nagasaki.replace(/is2?.4chan.org/gi, 'is.4chan.org')); //change 'is.4chan.org' to 'i.4cdn.org' if you want
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment