Greasy Fork is available in English.
kakoにリンクを変更
// ==UserScript==
// @name 2ch過去ログ(タイピ)URL自動変更
// @namespace http://tampermonkey.net/
// @version 0.2
// @description kakoにリンクを変更
// @author tube
// @match https://kako.5ch.net/test/read.cgi/pc/*
// @match https://kako.5ch.net/test/read.cgi/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=5ch.net
// @grant none
// @license MIT
// ==/UserScript==
function hrefConvert(){
let aTags = document.querySelectorAll('a');
aTags.forEach((v) => {
const HREF = v.href;
// 変換済みスキップ
if (HREF.startsWith('https://kako.5ch.net/test/read.cgi')) return;
let url = null;
if (HREF.endsWith('.html')) {
const match = HREF.match(/\/(\d+)\.html$/);
if (match) url = match[1];
} else {
const patterns = [/read\.cgi\/pc\/(\d+)/, /read\.cgi\?bbs=pc\&key=(\d+)/, /read\.cgi\/hobby\/(\d+)\.*/, /read\.cgi\/.+\/(\d+)\.*/ ];
let match = patterns.find(pattern => HREF.match(pattern));
if (match){
url = HREF.match(match)[0]
}
}
if (url) {
//とりあえず背景変えてわかりやすくしとく
v.href = locationChange(url);
v.style.backgroundColor = '#b6b9ff';
}
});
function locationChange(url) {
return 'https://kako.5ch.net/test/' + url;
}
}
window.addEventListener('load', () => {
setTimeout(hrefConvert, 500);
});