Greasy Fork

Greasy Fork is available in English.

5ch_hnuki_link

5ちゃんねるのh抜きリンクをリンクにする

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        5ch_hnuki_link
// @namespace   https://catherine.v0cyc1pp.com/5ch_hnuki_link.user.js
// @match       http://*.5ch.net/*
// @match       https://*.5ch.net/*
// @author      greg10
// @run-at      document-end
// @license     GPL 3.0
// @version     1.3
// @grant       none
// @description 5ちゃんねるのh抜きリンクをリンクにする
// @license     MIT
// ==/UserScript==

console.log("5ch_hnuki_link start");

//https://mevius.5ch.net/test/read.cgi/kitchen/1548549321/l50
//ttps://upload.wikimedia.org/wikipedia/commons/6/6f/Earth_Eastern_Hemisphere.jpg

// 置換
function makelink() {
	document.querySelectorAll("span.escaped").forEach(function(obj) {
		var html = obj.innerHTML;
		console.log("html="+html);
		if ( html.match(/ttp/) ) {
			if ( ! html.match(/http/) ) {
				console.log("h-nuki");
				//var newhtml = html.replace(/ttp:[^ ]+/,"<a href=\"$&\">$&</a>");
				var newhtml = html.replace(/ttp[^ ]+/g,"<a href=\"h$&\">$&</a>");
				console.log("newhtml="+newhtml);
				obj.innerHTML = newhtml;
			}
		}
		
	});
}

function main() {
	makelink();
}


main();