Drawaria Add More Medals

Add more medals to your drawaria account.

  1. // ==UserScript==
  2. // @name Drawaria Add More Medals
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-10-14
  5. // @description Add more medals to your drawaria account.
  6. // @author YouTubeDrawaria
  7. // @match https://drawaria.online/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=drawaria.online
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Function to change the numbers of the medals
  17. function changeMedalNumbers(medalIndex) {
  18. // Select the elements that contain the numbers of the medals
  19. const medalElements = document.querySelectorAll('td[colspan="2"] div[style*="display: flex; justify-content: space-evenly;"] span div');
  20.  
  21. // Verify if the elements were found
  22. if (medalElements.length === 3) {
  23. // Change the number of the corresponding medal
  24. const newValue = prompt(`Enter the new value for the ${medalIndex === 0 ? 'gold' : medalIndex === 1 ? 'silver' : 'bronze'} medal:`);
  25. if (newValue !== null) {
  26. medalElements[medalIndex].textContent = newValue;
  27. }
  28. } else {
  29. console.error('Medal elements not found.');
  30. }
  31. }
  32.  
  33. // Function to add buttons below the medal quantities
  34. function addButtons() {
  35. // Select the medal container
  36. const medalContainer = document.querySelector('td[colspan="2"] div[style*="display: flex; justify-content: space-evenly;"]');
  37.  
  38. // Create the buttons
  39. const goldButton = document.createElement('button');
  40. goldButton.textContent = 'Change Gold';
  41. goldButton.style.marginRight = '10px';
  42. goldButton.style.padding = '5px 10px';
  43. goldButton.style.backgroundColor = '#FEE101';
  44. goldButton.style.color = '#000';
  45. goldButton.style.border = 'none';
  46. goldButton.style.borderRadius = '5px';
  47. goldButton.style.cursor = 'pointer';
  48.  
  49. const silverButton = document.createElement('button');
  50. silverButton.textContent = 'Change Silver';
  51. silverButton.style.marginRight = '10px';
  52. silverButton.style.padding = '5px 10px';
  53. silverButton.style.backgroundColor = '#D7D7D7';
  54. silverButton.style.color = '#000';
  55. silverButton.style.border = 'none';
  56. silverButton.style.borderRadius = '5px';
  57. silverButton.style.cursor = 'pointer';
  58.  
  59. const bronzeButton = document.createElement('button');
  60. bronzeButton.textContent = 'Change Bronze';
  61. bronzeButton.style.padding = '5px 10px';
  62. bronzeButton.style.backgroundColor = '#cd7f32';
  63. bronzeButton.style.color = '#000';
  64. bronzeButton.style.border = 'none';
  65. bronzeButton.style.borderRadius = '5px';
  66. bronzeButton.style.cursor = 'pointer';
  67.  
  68. // Add the buttons below the medal quantities
  69. medalContainer.insertAdjacentElement('afterend', bronzeButton);
  70. medalContainer.insertAdjacentElement('afterend', silverButton);
  71. medalContainer.insertAdjacentElement('afterend', goldButton);
  72.  
  73.  
  74. // Add events to the buttons
  75. goldButton.addEventListener('click', () => changeMedalNumbers(0));
  76. silverButton.addEventListener('click', () => changeMedalNumbers(1));
  77. bronzeButton.addEventListener('click', () => changeMedalNumbers(2));
  78. }
  79.  
  80. // Function to observe changes in the DOM and add the buttons when the medal container is available
  81. function observeDOM() {
  82. const observer = new MutationObserver((mutations) => {
  83. mutations.forEach((mutation) => {
  84. if (mutation.type === 'childList') {
  85. const medalContainer = document.querySelector('td[colspan="2"] div[style*="display: flex; justify-content: space-evenly;"]');
  86. if (medalContainer) {
  87. addButtons();
  88. observer.disconnect(); // Stop observing once the buttons have been added
  89. }
  90. }
  91. });
  92. });
  93.  
  94. observer.observe(document.body, { childList: true, subtree: true });
  95. }
  96.  
  97. // Start observing the DOM
  98. observeDOM();
  99. })();