Ouo.io Link Replacer

Replaces ouo.io links with ouo.press

  1. // ==UserScript==
  2. // @name Ouo.io Link Replacer
  3. // @namespace https://github.com/kinkuroai/ouoio-link-replacer/
  4. // @version 1.1
  5. // @description Replaces ouo.io links with ouo.press
  6. // @author Kinkuro
  7. // @match *://*/*
  8. // @grant GM_addValueChangeListener
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. GM_addValueChangeListener("dummy", () => {});
  16.  
  17. function replaceOuoLinks() {
  18. const links = document.querySelectorAll('a[href*="ouo.io"]');
  19.  
  20. links.forEach(link => {
  21. link.href = link.href.replace('ouo.io', 'ouo.press');
  22. });
  23. }
  24.  
  25. replaceOuoLinks();
  26.  
  27. const observer = new MutationObserver(mutations => {
  28. mutations.forEach(mutation => {
  29. if (mutation.type === 'childList') {
  30. replaceOuoLinks();
  31. }
  32. });
  33. });
  34.  
  35. observer.observe(document.body, {
  36. childList: true,
  37. subtree: true
  38. });
  39.  
  40. console.log("Ouo.io to Ouo.press link replacer script is running.");
  41. })();