Random Clicker

Auto Clicker for Browsers!!

Ajankohdalta 4.9.2023. Katso uusin versio.

  1. // ==UserScript==
  2. // @name Random Clicker
  3. // @namespace
  4. // @version 1.10
  5. // @description Auto Clicker for Browsers!!
  6. // @author
  7. // @match *://*/*
  8. // @grant none
  9. // @icon
  10. // @compatible chrome
  11. // @compatible firefox
  12. // @compatible opera
  13. // @compatible safari
  14. // ==/UserScript==
  15.  
  16. let x, y, minCPS = 1, maxCPS = 5, autoClick;
  17.  
  18. function startAutoClick(x, y) {
  19. // Generate a new random CPS
  20. let randomCPS = Math.floor(Math.random() * (maxCPS - minCPS + 1)) + minCPS;
  21.  
  22. autoClick = setInterval(function () {
  23. if (x !== undefined && y !== undefined) {
  24. click(x, y, randomCPS); // Pass the coordinates and random CPS to the click function
  25. }
  26. }, 1000 / randomCPS); // Convert CPS to milliseconds
  27. }
  28.  
  29. function stopAutoClick() {
  30. clearInterval(autoClick); // Clear the autoClick interval
  31. x = undefined;
  32. y = undefined;
  33. }
  34.  
  35. document.addEventListener('keydown', function (evt) {
  36. if (evt.shiftKey && evt.key === 'J') {
  37. if (autoClick) {
  38. stopAutoClick(); // Stop the previous autoclick interval
  39. }
  40.  
  41. alert("You may now click on any point in this tab to set the autoclicker to it. Have fun !!");
  42.  
  43. document.addEventListener('click', function (event) {
  44. x = event.clientX;
  45. y = event.clientY;
  46. alert(`Mouse click at X: ${x}, Y: ${y}`);
  47. startAutoClick(x, y); // Start autoclicking at the new coordinates
  48. });
  49. }
  50. });
  51.  
  52. function click(x, y, randomCPS) {
  53. alert(`Click frequency: ${randomCPS} CPS\nCoordinates - X: ${x}, Y: ${y}`);
  54. let ev = new MouseEvent('click', {
  55. 'view': window,
  56. 'bubbles': true,
  57. 'cancelable': true,
  58. 'screenX': x,
  59. 'screenY': y
  60. });
  61.  
  62. let el = document.elementFromPoint(x, y);
  63. el.dispatchEvent(ev);
  64. }