Remove CloudFlare links from website.
当前为
// ==UserScript==
// @name Remove CloudFlare links
// @author Matthew L. Tanner
// @match https://*/*
// @version 1.0.0.0
// @grant none
// @run-at document-end
// @namespace deCloudflare_userscript_remove-cf
// @description Remove CloudFlare links from website.
// @license MIT
// ==/UserScript==
// [Documentation URL] https://0xacab.org/dCF/deCloudflare/-/blob/master/tool/userscripts/README.md
// To learn about this API, please go to http://about-karmaapi.go.crimeflare.eu.org
const api_url = 'https://karma.crimeflare.eu.org/api/is/cloudflare/';
let fqdns = {},
fqdn_self = location.hostname;
document.querySelectorAll('a[href]:not([xcf])').forEach(l => {
try {
let u = new URL(l.href);
if (u.hostname != fqdn_self && (u.protocol == 'https:' || u.protocol == 'http:')) {
let fqdn = u.hostname;
if (fqdns[fqdn] == undefined) {
fqdns[fqdn] = [];
}
fqdns[fqdn].push(l);
l.setAttribute('xcf', 'q');
}
} catch (x) {}
});
function mark_fqdn(fl) {
try {
if (fl == '') {
return;
}
fetch(api_url, {
method: 'POST',
mode: 'cors',
body: 'ff=' + fl,
referrer: '',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(x => x.json()).then(x => {
for (let xx in x) {
if (fqdns[xx]) {
if (x[xx]) {
fqdns[xx].forEach(qs => {
qs.outerHTML = qs.innerHTML;
});
} else {
fqdns[xx].forEach(qs => {
qs.setAttribute('xcf', 'n');
});
}
delete fqdns[xx];
}
}
}).catch(x => {});
} catch (x) {}
}
mark_fqdn(Object.keys(fqdns).join(','));