Greasy Fork is available in English.
添加超链接的同时,能够清除斯巴达、搬瓦工、vir、hetzner、dmit、绿云的aff
当前为
// ==UserScript==
// @name loc添加超链接
// @namespace http://tampermonkey.net/
// @version 0.2
// @description 添加超链接的同时,能够清除斯巴达、搬瓦工、vir、hetzner、dmit、绿云的aff
// @author Faxlok
// @match https://hostloc.com/thread-*.html
// @match https://hostloc.com/forum.php?mod=viewthread&tid=*&highlight=*
// @icon https://www.google.com/s2/favicons?domain=hostloc.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
var t_f_content = document.querySelectorAll(".pcb");
const regex = new RegExp('(?<!font size="2"><a href=")((?<!src="|href=")https?:\/\/.*?)(<| )', 'gm');
for (var i = 0; i < t_f_content.length; i++)
{
//console.log(t_f_content[i].innerHTML);
//console.log(regex.test(t_f_content[i].innerHTML));
// 转换为超链接
if (regex.test(t_f_content[i].innerHTML))
{
t_f_content[i].innerHTML = t_f_content[i].innerHTML.replace(regex,'<a href="$1" target="_blank">$1</a><');
}
// 去掉aff
t_f_content[i].innerHTML = t_f_content[i].innerHTML.replace(/aff\.php/gm,'cart.php').replace(/aff=\d+/gm,'a=add').replace(/ref=\w+/gm,'');
}
})();