Additional shortlink

9/13/2024, 2:28:10 PM

  1. // ==UserScript==
  2. // @name Additional shortlink
  3. // @namespace Violentmonkey&Tampermonkey Scripts
  4. // @match *://*/*
  5. // @grant none
  6. // @version 1.3
  7. // @author Ojo Ngono
  8. // @description 9/13/2024, 2:28:10 PM
  9. // ==/UserScript==
  10.  
  11.  
  12.  
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. window.addEventListener('load', function() {
  18. var tombol = document.getElementById('tp-snp2');
  19. if (tombol) {
  20. tombol.click();
  21. }
  22. });
  23.  
  24. function checkAndClickVerify() {
  25. const timerElement = document.getElementById('myTimer');
  26. const verifyButton = document.getElementById('VerifyBtn');
  27. if (timerElement && verifyButton) {
  28. const timerValue = parseInt(timerElement.textContent, 10);
  29. if (timerValue === 0) {
  30. verifyButton.click();
  31. scrollAndClickNext();
  32. }
  33. }
  34. }
  35.  
  36. function scrollAndClickNext() {
  37. setTimeout(() => {
  38. window.scrollTo(0, document.body.scrollHeight);
  39. const nextButton = document.getElementById('NextBtn');
  40. if (nextButton) {
  41. nextButton.click();
  42. }
  43. }, 2000);
  44. }
  45.  
  46. setInterval(checkAndClickVerify, 1000);
  47.  
  48. function clickButton(buttonText) {
  49. const buttons = document.querySelectorAll('button');
  50. for (let button of buttons) {
  51. if (button.textContent.includes(buttonText) && button.style.display !== 'none') {
  52. button.click();
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58.  
  59. function clickButtonById(id) {
  60. var button = document.getElementById(id);
  61. if (button) {
  62. button.click();
  63. return true;
  64. }
  65. return false;
  66. }
  67.  
  68. function observeDOM() {
  69. const observer = new MutationObserver(() => {
  70. if (clickButtonById('claimButton')) {
  71. return;
  72. }
  73. });
  74. observer.observe(document.body, { childList: true, subtree: true });
  75. }
  76.  
  77. window.addEventListener('load', function() {
  78. const icons = document.querySelectorAll('.stat');
  79. const iconCount = {};
  80.  
  81. icons.forEach(icon => {
  82. const iconClass = icon.querySelector('i').className;
  83. if (iconCount[iconClass]) {
  84. iconCount[iconClass]++;
  85. } else {
  86. iconCount[iconClass] = 1;
  87. }
  88. });
  89.  
  90. let leastDisplayedIcon = null;
  91. let leastCount = Infinity;
  92. for (const iconClass in iconCount) {
  93. if (iconCount[iconClass] < leastCount) {
  94. leastCount = iconCount[iconClass];
  95. leastDisplayedIcon = iconClass;
  96. }
  97. }
  98.  
  99. function clickLeastDisplayedIcon() {
  100. const icons = document.querySelectorAll('#iconContainer .stat');
  101. const leastDisplayedIcon = document.getElementById('correctIcon').value;
  102. if (icons.length === 0) {
  103. return false;
  104. }
  105. let iconClicked = false;
  106. icons.forEach(icon => {
  107. const iconClass = icon.querySelector('i').className;
  108. if (iconClass === leastDisplayedIcon) {
  109. icon.click();
  110. iconClicked = true;
  111. }
  112. });
  113. return iconClicked;
  114. }
  115.  
  116. function clickStepButton() {
  117. const stepButton = document.getElementById('claimButton1');
  118. if (stepButton && stepButton.getAttribute('data-step') === "0") {
  119. stepButton.click();
  120. }
  121. }
  122.  
  123. function clickConfirmButton() {
  124. const confirmButton = document.querySelector('.modal-dialog .btn-primary');
  125. if (confirmButton) {
  126. confirmButton.click();
  127. }
  128. }
  129.  
  130. function handleModalActions() {
  131. const iconClicked = clickLeastDisplayedIcon();
  132. if (iconClicked) {
  133. setTimeout(() => {
  134. clickStepButton();
  135. }, 1000);
  136. setTimeout(() => {
  137. clickConfirmButton();
  138. }, 2000);
  139. }
  140. }
  141.  
  142. const observer = new MutationObserver(function(mutations) {
  143. mutations.forEach(function(mutation) {
  144. if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
  145. handleModalActions();
  146. }
  147. });
  148. });
  149.  
  150. observer.observe(document.body, { childList: true, subtree: true });
  151. });
  152.  
  153. const buttonSelector = '.continue-button';
  154. const waitForButton = setInterval(() => {
  155. const button = document.querySelector(buttonSelector);
  156. if (button) {
  157. button.click();
  158. clearInterval(waitForButton);
  159. }
  160. }, 1000);
  161.  
  162. const clickTopResult = () => {
  163. const topResult = document.querySelector('a h3');
  164. if (topResult) {
  165. topResult.closest('a').click();
  166. }
  167. };
  168.  
  169. window.addEventListener('load', function() {
  170. setTimeout(clickTopResult, 2000);
  171. });
  172.  
  173. const progressBarSelector = '#progressBar';
  174. const waitForProgressBar = setInterval(() => {
  175. const progressBar = document.querySelector(progressBarSelector);
  176. if (progressBar) {
  177. const width = progressBar.style.width;
  178. const numericWidth = parseInt(width);
  179. const linkText = progressBar.textContent.trim();
  180. if (numericWidth >= 99 && linkText.includes("Click here to continue")) {
  181. const link = progressBar.querySelector('a');
  182. if (link) {
  183. link.click();
  184. }
  185. clearInterval(waitForProgressBar);
  186. }
  187. }
  188. }, 2000);
  189.  
  190. const continueButtonSelector = '#continue-button';
  191. const waitForContinueButton = setInterval(() => {
  192. const continueButton = document.querySelector(continueButtonSelector);
  193. if (continueButton) {
  194. continueButton.click();
  195. clearInterval(waitForContinueButton);
  196. }
  197. }, 5000);
  198. })();