Remove CloudFlare links

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

目前為 2023-12-14 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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(','));