Facebook delete Fbclid Link

Automatically detect and remove fuck Fbclid links when scrolling

  1. // ==UserScript==
  2. // @name Facebook delete Fbclid Link
  3. // @namespace https://gf.qytechs.cn/zh-TW/scripts/396523-facebook-delete-fbclid-link
  4. // @version 0.2
  5. // @icon https://www.facebook.com/favicon.ico
  6. // @description Automatically detect and remove fuck Fbclid links when scrolling
  7. // @author avan
  8. // @match https://www.facebook.com/*
  9. // @grant none
  10. // @noframes
  11. // ==/UserScript==
  12. const removeFbclid = (href) => {
  13. const fbclidURL = new URL(href)
  14. if (fbclidURL.host === "l.facebook.com" && fbclidURL.searchParams.get("u")) {
  15. href = decodeURI(fbclidURL.searchParams.get("u"))
  16. } else {
  17. fbclidURL.searchParams.delete("fbclid")
  18. href = fbclidURL.href
  19. }
  20. return href
  21. }
  22.  
  23. const deleteFbclidLink = () => {
  24. const fbclidLinkList = document.querySelectorAll('a[href*="fbclid"]')
  25. if (!fbclidLinkList || fbclidLinkList.length === 0) {
  26. return
  27. }
  28. for (const fbclidLink of fbclidLinkList) {
  29. fbclidLink.addEventListener("click",
  30. function (event) {
  31. event.preventDefault()
  32. window.open(removeFbclid(this.href))
  33. },
  34. false)
  35. fbclidLink.href = removeFbclid(fbclidLink.href)
  36. }
  37. }
  38.  
  39. const excute = () => {
  40. window.addEventListener("DOMSubtreeModified", deleteFbclidLink)
  41. window.addEventListener("scroll", deleteFbclidLink)
  42. window.addEventListener("click", deleteFbclidLink)
  43. }
  44.  
  45. (function() {
  46. 'use strict';
  47.  
  48. excute()
  49. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址