5ch_hnuki_link

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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();