GC Add Volcano Plot Link

Adds a link to the volcano plot page on the Battledome Page

  1. // ==UserScript==
  2. // @name GC Add Volcano Plot Link
  3. // @namespace https://greasyfork.org/en/users/1291562-zarotrox
  4. // @version 0.2
  5. // @description Adds a link to the volcano plot page on the Battledome Page
  6. // @author Zarotrox
  7. // @icon https://i.ibb.co/44SS6xZ/Zarotrox.png
  8. // @match https://www.grundos.cafe/dome/*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. function addLink() {
  17. var nav = document.querySelector('nav.center.margin-1[aria-label="Battledome Links"]');
  18.  
  19. if (nav) {
  20. if (!nav.querySelector('a[href="https://www.grundos.cafe/dome/1p/select/?plot=volcano"]')) {
  21. var newLink = document.createElement('a');
  22. newLink.href = 'https://www.grundos.cafe/dome/1p/select/?plot=volcano'; // URL of the page you want to link to
  23. newLink.textContent = 'Volcano Plot'; // Text for the link
  24. newLink.style.marginLeft = '10px'; // Add margin to separate from other links
  25. newLink.style.textDecoration = 'none'; // Optional: remove underline
  26.  
  27. nav.appendChild(newLink);
  28. }
  29. } else {
  30. console.log('Navigation bar not found.');
  31. }
  32. }
  33.  
  34. setTimeout(addLink, 1); // Adjust delay as needed
  35.  
  36. // Optional: Observe changes to the document and try adding the link again if necessary
  37. const observer = new MutationObserver((mutationsList) => {
  38. for (let mutation of mutationsList) {
  39. if (mutation.type === 'childList') {
  40. addLink();
  41. }
  42. }
  43. });
  44.  
  45. observer.observe(document.body, { childList: true, subtree: true });
  46.  
  47. })();