FurAffinity - Seamless Fav

Fav submissions without reloading the page

  1. // ==UserScript==
  2. // @name FurAffinity - Seamless Fav
  3. // @namespace proot
  4. // @match https://www.furaffinity.net/*
  5. // @grant none
  6. // @version 1.0
  7. // @author a proot
  8. // @license MIT
  9. // @description Fav submissions without reloading the page
  10. // ==/UserScript==
  11.  
  12. let favURLMatcher = /https?:\/\/www\.furaffinity\.net\/(?:un)?fav\//;
  13. let favButtonMatcher = /\/(?:un)?fav\/[0-9]+/;
  14. let favTextMatcher = /href="(\/(?:un)?fav\/.*?)">(.*?)<\/a>/;
  15.  
  16. function allFavButtons() {
  17. return [...document.getElementsByTagName("a")].filter(a => favButtonMatcher.exec(a.href))
  18. }
  19.  
  20. document.addEventListener("click", function (e) {
  21. e = e || window.event;
  22. let element = e.target || e.srcElement;
  23.  
  24. if (element.tagName == 'A' && favURLMatcher.match(element.href)) {
  25. (async () => {
  26. allFavButtons().forEach(e => {
  27. // e.style.opacity = 0.5
  28. e.style.setProperty('color', '#808080', 'important')
  29. e.style.pointerEvents = "none"
  30. })
  31. let r = await fetch(element.href)
  32. let match = favTextMatcher.exec(await r.text())
  33. allFavButtons().forEach(e => {
  34. // e.style.opacity = 1
  35. e.style.color = ""
  36. e.style.pointerEvents = ""
  37. e.innerText = match[2].replace(" ", "")
  38. e.href = match[1]
  39. })
  40. })()
  41. e.preventDefault()
  42. }
  43. })

QingJ © 2025

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