🏠 Home 

Discord Themelyn V2 - Basically Free Theme(s)

Basically Free Theme(s). Join my server for updates: https://discord.gg/kS7P7gRZcg

  1. // ==UserScript==
  2. // @name Discord Themelyn V2 - Basically Free Theme(s)
  3. // @version 1.0
  4. // @description Basically Free Theme(s). Join my server for updates: https://discord.gg/kS7P7gRZcg
  5. // @author ∫(Ace)³dx
  6. // @match https://discord.com/*
  7. // @grant none
  8. // @license MIT
  9. // @namespace https://greasyfork.org/users/449798
  10. // ==/UserScript==
  11. //To change the themes, you need to change the xpath of the element from the preview tab to the respective button of the theme.
  12. function clickElementByXPath(xpath) {
  13. var element = document.evaluate(xpath, document, null, XPathR###lt.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  14. if (element) {
  15. element.click();
  16. } else {
  17. console.error("Element with XPath '" + xpath + "' not found.");
  18. }
  19. }
  20. function waitForElementByXPath(xpath, callback) {
  21. var observer = new MutationObserver(function(mutations) {
  22. mutations.forEach(function(mutation) {
  23. if (document.evaluate(xpath, document, null, XPathR###lt.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue) {
  24. observer.disconnect();
  25. callback();
  26. }
  27. });
  28. });
  29. observer.observe(document, {
  30. childList: true,
  31. subtree: true
  32. });
  33. }
  34. function runScript() {
  35. // Click on first element
  36. clickElementByXPath("/html/body/div[1]/div[2]/div[1]/div[1]/div/div[2]/div/div/div/div/div[1]/section/div[2]/div[2]/button[3]/div/div");
  37. // Wait for the second element
  38. waitForElementByXPath("/html/body/div[1]/div[2]/div[1]/div[1]/div/div[2]/div[2]/div/div[1]/div/nav/div/div[20]", function() {
  39. // Click on the second element
  40. clickElementByXPath("/html/body/div[1]/div[2]/div[1]/div[1]/div/div[2]/div[2]/div/div[1]/div/nav/div/div[20]");
  41. // Wait for the third element
  42. waitForElementByXPath("/html/body/div[1]/div[2]/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div/div/div[1]/div/div[2]/div[2]/div[1]/div[1]/div/div/section/div[1]/div[2]/button[1]", function() {
  43. // Click on the third element
  44. clickElementByXPath("/html/body/div[1]/div[2]/div[1]/div[1]/div/div[2]/div[2]/div/div[2]/div/div/div[1]/div/div[2]/div[2]/div[1]/div[1]/div/div/section/div[1]/div[2]/button[1]");
  45. // Wait for the fourth element
  46. waitForElementByXPath("/html/body/div[1]/div[2]/div[3]/div[2]/div[1]/section/div[2]/div[10]", function() {
  47. // Find the button and the element to hide using XPath
  48. const buttonXPath = "/html/body/div[1]/div[2]/div[3]/div[2]/div[1]/section/div[2]/div[10]/div";
  49. const elementXPath = "/html/body/div[*]/div[2]/div[3]";
  50. const button = document.evaluate(buttonXPath, document, null, XPathR###lt.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  51. const element = document.evaluate(elementXPath, document, null, XPathR###lt.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  52. if (button && element) {
  53. // Hide the button and the element
  54. button.style.display = 'none';
  55. element.style.display = 'none';
  56. // Click the button every 10 milliseconds
  57. const intervalId = setInterval(() => {
  58. button.click();
  59. }, 1);
  60. } else {
  61. console.error('Button or element not found with the provided XPath.');
  62. }
  63. });
  64. });
  65. });
  66. }
  67. // Wait for the first element to exist before running the script
  68. waitForElementByXPath("/html/body/div[1]/div[2]/div[1]/div[1]/div/div[2]/div/div/div/div/div[1]/section/div[2]/div[2]/button[3]/div/div", runScript);