GetUndeployedMunzeeURLs

Get Urls for The Munzee Skin Machine

  1. // ==UserScript==
  2. // @name GetUndeployedMunzeeURLs
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description Get Urls for The Munzee Skin Machine
  6. // @author CzPeet
  7. // @match https://www.munzee.com/print
  8. // @icon https://www.google.com/s2/favicons?domain=munzee.com
  9. // @update https://greasyfork.org/en/scripts/434808-getundeployedmunzeeurls
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. async function PrintYourMunzees()
  14. {
  15. if (document.body.innerText.includes("Print Your Munzees"))
  16. {
  17. var mainForm = document.getElementsByClassName("form")[0];
  18.  
  19. var URLDIV = document.createElement('DIV');
  20. URLDIV.setAttribute('style', 'margin-top: 20px');
  21.  
  22. var URLsTextArea = document.createElement('TEXTAREA');
  23. URLsTextArea.setAttribute('id','urlArea');
  24. URLsTextArea.setAttribute('style','width: 100%;height: 350px;');
  25.  
  26. URLDIV.appendChild(URLsTextArea);
  27. mainForm.appendChild(URLDIV);
  28.  
  29. //EventListeners
  30. var check_batch = findButtonByText("Check");
  31. check_batch.addEventListener('click', chBoxCheckedChange);
  32.  
  33. var check_all = findButtonByText("Check All");
  34. check_all.addEventListener('click', chBoxCheckedChange);
  35.  
  36. var inputs = document.querySelectorAll('input[type="checkbox"]');
  37. for(var i = 0; i < inputs.length; i++) {
  38. if (inputs[i].value.includes("munzee.com"))
  39. {
  40. inputs[i].addEventListener('change', chBoxCheckedChange);
  41. }
  42. }
  43. }
  44. }
  45.  
  46. function findButtonByText(text) {
  47. const buttons = document.getElementsByTagName("button");
  48. for (let i = 0; i < buttons.length; i++) {
  49. if (buttons[i].textContent === text) {
  50. return buttons[i];
  51. }
  52. }
  53. return null; // Button with the specified text not found
  54. }
  55.  
  56. async function chBoxCheckedChange()
  57. {
  58. await new Promise(resolve => setTimeout(resolve, 250)); // Wait for 200 ms
  59. var selectedURLs = "";
  60. var ua = document.getElementById('urlArea');
  61. ua.setAttribute('value','');
  62. var inputs = document.querySelectorAll('.PrivateSwitchBase-input:checked');
  63. for(var i = 0; i < inputs.length; i++) {
  64. if (inputs[i].value.includes("munzee.com"))
  65. {
  66. selectedURLs += '\n' +inputs[i].value;
  67. }
  68. }
  69. ua.value = selectedURLs;
  70. }
  71.  
  72. //###########################################//
  73. //New FireBase adaptation DOM Loaded checking//
  74. //###########################################//
  75. var DOMLoaded = false;
  76. var doc = "";
  77. var equalCounter = 0;
  78.  
  79. async function delayedLoop() {
  80. while (!DOMLoaded)
  81. {
  82. if (doc == document)
  83. {
  84. equalCounter++;
  85. }
  86. else
  87. {
  88. doc = document;
  89. equalCounter = 0;
  90. }
  91.  
  92. if (equalCounter == 10)
  93. {
  94. DOMLoaded = true;
  95. }
  96.  
  97. await new Promise(resolve => setTimeout(resolve, 250)); // Wait for 200 ms
  98. }
  99.  
  100. PrintYourMunzees();
  101. }
  102.  
  103. delayedLoop();