New Instance Button for Libreddit

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

Verze ze dne 03. 09. 2023. Zobrazit nejnovější verzi.

  1. // ==UserScript==
  2. // @name New Instance Button for Libreddit
  3. // @namespace happyviking
  4. // @version 1.29.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.cachyos.org/*
  16. // @match https://libreddit.domain.glass/*
  17. // @match https://libreddit.freedit.eu/*
  18. // @match https://libreddit.kavin.rocks/*
  19. // @match https://libreddit.kutay.dev/*
  20. // @match https://libreddit.kylrth.com/*
  21. // @match https://libreddit.mha.fi/*
  22. // @match https://libreddit.northboot.xyz/*
  23. // @match https://libreddit.oxymagnesium.com/*
  24. // @match https://libreddit.privacy.com.de/*
  25. // @match https://libreddit.privacydev.net/*
  26. // @match https://libreddit.pussthecat.org/*
  27. // @match https://libreddit.spike.codes/*
  28. // @match https://libreddit.strongthany.cc/*
  29. // @match https://libreddit.tiekoetter.com/*
  30. // @match https://libreddit.tux.pizza/*
  31. // @match https://lr.4201337.xyz/*
  32. // @match https://lr.aeong.one/*
  33. // @match https://lr.artemislena.eu/*
  34. // @match https://lr.vern.cc/*
  35. // @match https://r.walkx.fyi/*
  36. // @match https://reddit.baby/*
  37. // @match https://reddit.dr460nf1r3.org/*
  38. // @match https://reddit.invak.id/*
  39. // @match https://reddit.leptons.xyz/*
  40. // @match https://reddit.simo.sh/*
  41. // @match https://reddit.utsav2.dev/*
  42. // @match https://safereddit.com/*
  43. // <<INSTANCES END HERE>>
  44.  
  45.  
  46. // ==/UserScript==
  47.  
  48. function main() {
  49. const navBar = document.querySelector('nav');
  50. if (!navBar) return
  51. const firstDivInNavBar = navBar.querySelector("div")
  52. const newButton = document.createElement("button")
  53. firstDivInNavBar.prepend(newButton)
  54. newButton.appendChild(document.createTextNode("New Instance"))
  55. newButton.onclick = () => {
  56. console.log("hi")
  57. location.replace('https://farside.link/libreddit/' + window.location.pathname);
  58. }
  59. }
  60.  
  61. main()