Master File Random AM Button Clicker

Clicks a button at random intervals

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/494463/1373518/Master%20File%20Random%20AM%20Button%20Clicker.js

  1. // ==UserScript==
  2. // @name Master File Random AM Button Clicker
  3. // @namespace https://greasyfork.org/master-file-random-Am-button-clicker
  4. // @version 3.0
  5. // @description Clicks a button at random intervals
  6. // @license MIT
  7. // @match https://*.apple.com/*
  8. // @grant none
  9. // @downloadURL https://update.greasyfork.org/
  10. // @updateURL https://update.greasyfork.org/
  11. // ==/UserScript==
  12.  
  13. function getRandomInt(min, max) {
  14. min = Math.ceil(min);
  15. max = Math.floor(max);
  16. return Math.floor(Math.random() * (max - min) + min);
  17. }
  18.  
  19. function doSomething() {
  20. // Find the "Next" button using its class
  21. var nextButton = document.querySelector('amp-playback-controls-item-skip.next');
  22. if (nextButton) {
  23. nextButton.click();
  24. } else {
  25. console.log("Next button not found.");
  26. }
  27. }
  28.  
  29. (function loop() {
  30. var rand = getRandomInt(35000, 45000);
  31. console.log(rand);
  32. setTimeout(function() {
  33. doSomething();
  34. loop();
  35. }, rand);
  36. })();