New Instance Button for Libreddit

Adds a button to Libreddit instances to redirect to a new instance

目前为 2023-07-31 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name New Instance Button for Libreddit
  3. // @namespace happyviking
  4. // @version 1.4.0
  5. // @grant none
  6. // @run-at document-end
  7. // @license MIT
  8. // @description Adds a button to Libreddit instances to redirect to a new instance
  9. // @icon https://gitlab.com/uploads/-/system/project/avatar/32545239/libreddit.png
  10. // @author HappyViking
  11.  
  12. // <<INSTANCES START HERE>>
  13. // @match https://l.opnxng.com/*
  14. // @match https://libreddit.bus-hit.me/*
  15. // @match https://libreddit.domain.glass/*
  16. // @match https://libreddit.freedit.eu/*
  17. // @match https://libreddit.kavin.rocks/*
  18. // @match https://libreddit.kutay.dev/*
  19. // @match https://libreddit.lunar.icu/*
  20. // @match https://libreddit.northboot.xyz/*
  21. // @match https://libreddit.oxymagnesium.com/*
  22. // @match https://libreddit.privacy.com.de/*
  23. // @match https://libreddit.privacydev.net/*
  24. // @match https://libreddit.tux.pizza/*
  25. // @match https://lr.4201337.xyz/*
  26. // @match https://lr.aeong.one/*
  27. // @match https://lr.artemislena.eu/*
  28. // @match https://r.darklab.sh/*
  29. // @match https://rd.funami.tech/*
  30. // @match https://reddit.baby/*
  31. // @match https://reddit.leptons.xyz/*
  32. // @match https://reddit.moe.ngo/*
  33. // @match https://reddit.smnz.de/*
  34. // @match https://safereddit.com/*
  35. // @match https://snoo.habedieeh.re/*
  36. // <<INSTANCES END HERE>>
  37.  
  38.  
  39. // ==/UserScript==
  40.  
  41. function main() {
  42. const navBar = document.querySelector('nav');
  43. if (!navBar) return
  44. const firstDivInNavBar = navBar.querySelector("div")
  45. const newButton = document.createElement("button")
  46. firstDivInNavBar.prepend(newButton)
  47. newButton.appendChild(document.createTextNode("New Instance"))
  48. newButton.onclick = () => {
  49. console.log("hi")
  50. location.replace('https://farside.link/libreddit/' + window.location.pathname);
  51. }
  52. }
  53.  
  54. main()