4Chan cdn change

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

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==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");
});