Remove CloudFlare links

Take action against CloudFlare. Remove CloudFlare links.

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

  1. // ==UserScript==
  2. // @name Remove CloudFlare links
  3. // @description Take action against CloudFlare. Remove CloudFlare links.
  4. // @namespace deCloudflare_us_remove-cf
  5. // @author Matthew L. Tanner, CrimeFlare
  6. // @match https://*/*
  7. // @match http://*/*
  8. // @version 1.0.0.1
  9. // @grant none
  10. // @run-at document-end
  11. // @license MIT
  12. // ==/UserScript==
  13. // this script will not run on those sites
  14. // e.g. ['www.youtube.com','www.google.com']
  15. let DONT_RUN_FQDNS = ['web.archive.org'];
  16. //-----
  17. // [Documentation] https://0xacab.org/dCF/deCloudflare/-/blob/master/tool/userscripts/README.md
  18. // [About API] http://about-karmaapi.go.crimeflare.eu.org
  19. const api_url = 'https://karma.crimeflare.eu.org/api/is/cloudflare/';
  20. let fqdns = {},
  21. fqdn_self = location.hostname;
  22. function mark_fqdn(fl) {
  23. try {
  24. if (fl == '') {
  25. return;
  26. }
  27. fetch(api_url, {
  28. method: 'POST',
  29. mode: 'cors',
  30. body: 'ff=' + fl,
  31. referrer: '',
  32. headers: {
  33. 'Content-Type': 'application/x-www-form-urlencoded'
  34. }
  35. }).then(x => x.json()).then(x => {
  36. for (let xx in x) {
  37. if (fqdns[xx]) {
  38. if (x[xx]) {
  39. fqdns[xx].forEach(qs => {
  40. qs.outerHTML = qs.innerHTML;
  41. });
  42. } else {
  43. fqdns[xx].forEach(qs => {
  44. qs.setAttribute('xcf', 'n');
  45. });
  46. }
  47. delete fqdns[xx];
  48. }
  49. }
  50. }).catch(x => {});
  51. } catch (x) {}
  52. }
  53. if (!DONT_RUN_FQDNS.includes(fqdn_self) && !/\.crimeflare\.eu\.org$/.test(fqdn_self)) {
  54. document.querySelectorAll('a[href]:not([xcf])').forEach(l => {
  55. try {
  56. let u = new URL(l.href);
  57. if (u.hostname != fqdn_self && (u.protocol == 'https:' || u.protocol == 'http:')) {
  58. let fqdn = u.hostname;
  59. if (fqdns[fqdn] == undefined) {
  60. fqdns[fqdn] = [];
  61. }
  62. if (!/^(|(.*)\.)archive\.org$/.test(fqdn)) {
  63. fqdns[fqdn].push(l);
  64. }
  65. l.setAttribute('xcf', 'q');
  66. }
  67. } catch (x) {}
  68. });
  69. mark_fqdn(Object.keys(fqdns).join(','));
  70. }