New Instance Button for Libreddit

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

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

  1. // ==UserScript==
  2. // @name New Instance Button for Libreddit
  3. // @namespace happyviking
  4. // @version 1
  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. // Making patterns to match https://github.com/benbusby/farside/blob/main/services-full.json
  13. // @match https://l.opnxng.com/*
  14. // @match https://libreddit.bus-hit.me/*
  15. // @match https://libreddit.cachyos.org/*
  16. // @match https://libreddit.dcs0.hu/*
  17. // @match https://libreddit.de/*
  18. // @match https://libreddit.domain.glass/*
  19. // @match https://libreddit.freedit.eu/*
  20. // @match https://libreddit.garudalinux.org/*
  21. // @match https://libreddit.hu/*
  22. // @match https://libreddit.kavin.rocks/*
  23. // @match https://libreddit.kutay.dev/*
  24. // @match https://libreddit.kylrth.com/*
  25. // @match https://libreddit.lunar.icu/*
  26. // @match https://libreddit.mha.fi/*
  27. // @match https://libreddit.nl/*
  28. // @match https://libreddit.northboot.xyz/*
  29. // @match https://libreddit.oxymagnesium.com/*
  30. // @match https://libreddit.privacy.com.de/*
  31. // @match https://libreddit.projectsegfau.lt/*
  32. // @match https://libreddit.pussthecat.org/*
  33. // @match https://libreddit.strongthany.cc/*
  34. // @match https://libreddit.tiekoetter.com/*
  35. // @match https://libreddit.tux.pizza/*
  36. // @match https://lr.4201337.xyz/*
  37. // @match https://lr.artemislena.eu/*
  38. // @match https://lr.riverside.rocks/*
  39. // @match https://lr.slipfox.xyz/*
  40. // @match https://lr.vern.cc/*
  41. // @match https://r.ahwx.org/*
  42. // @match https://r.darklab.sh/*
  43. // @match https://r.nf/*
  44. // @match https://r.walkx.fyi/*
  45. // @match https://rd.funami.tech/*
  46. // @match https://reddi.tk/*
  47. // @match https://reddit.baby/*
  48. // @match https://reddit.dr460nf1r3.org/*
  49. // @match https://reddit.leptons.xyz/*
  50. // @match https://reddit.moe.ngo/*
  51. // @match https://reddit.rtrace.io/*
  52. // @match https://reddit.smnz.de/*
  53. // @match https://reddit.utsav2.dev/*
  54. // @match https://safereddit.com/*
  55. // @match https://snoo.habedieeh.re/*
  56.  
  57.  
  58. // ==/UserScript==
  59.  
  60. function main() {
  61. const navBar = document.querySelector('nav');
  62. if (!navBar) return
  63. const firstDivInNavBar = navBar.querySelector("div")
  64. const newButton = document.createElement("button")
  65. firstDivInNavBar.prepend(newButton)
  66. newButton.appendChild(document.createTextNode("New Instance"))
  67. newButton.onclick = () => {
  68. console.log("hi")
  69. location.replace('https://farside.link/libreddit/' + window.location.pathname);
  70. }
  71. }
  72.  
  73. main()