4Chan cdn change

Improve 4chan image load performance, by replacing image links from specific servers to CDN

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name     4Chan cdn change
// @version  1
// @description  Improve 4chan image load performance, by replacing image links from specific servers to CDN
// @author       Dankirk
// @namespace    Dankirk/4cdn
// @grant    none
// @include        https://*.4chan.org/*
// @include        http://*.4chan.org/*
// @include        https://*.4channel.org/*
// @include        http://*.4channel.org/*
// ==/UserScript==

var regex = /^(https?:\/\/)[^\.]+\.4chan\.org\/(.+)$/i;

document.querySelectorAll('a.fileThumb').forEach( el => {
  el.href = el.href.replace(regex,"$1i\.4cdn.org\/$2");
});

document.querySelectorAll('.fileText a').forEach( el => {
  el.href = el.href.replace(regex,"$1i\.4cdn.org\/$2");
});