Remove CloudFlare links

Remove CloudFlare links from website | https://0xacab.org/dCF/deCloudflare/-/blob/master/tool/userscripts/README.md

当前为 2023-12-14 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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 | https://0xacab.org/dCF/deCloudflare/-/blob/master/tool/userscripts/README.md
// @license MIT
// ==/UserScript==
// 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(','));