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