Random Clicker

Auto Clicker for Browsers!!

Pada tanggal 04 September 2023. Lihat %(latest_version_link).

  1. // ==UserScript==
  2. // @name Random Clicker
  3. // @namespace
  4. // @version 1.12
  5. // @description Auto Clicker for Browsers!!
  6. // @author
  7. // @match https://www.torn.com/city.php
  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 = 0.5, maxCPS = 2, autoClick;
  17. let isAutoClicking = false;
  18.  
  19. function startAutoClick(x, y) {
  20. autoClick = setInterval(function () {
  21. if (x !== undefined && y !== undefined && isAutoClicking) {
  22. click(x, y); // Pass the coordinates to the click function
  23. }
  24. }, getRandomCPS()); // Start with a random CPS
  25. }
  26.  
  27. function stopAutoClick() {
  28. clearInterval(autoClick); // Clear the autoClick interval
  29. isAutoClicking = false;
  30. x = undefined;
  31. y = undefined;
  32. }
  33.  
  34. function getRandomCPS() {
  35. // Generate a new random CPS between minCPS and maxCPS
  36. return Math.floor(Math.random() * (maxCPS - minCPS + 1)) + minCPS;
  37. }
  38.  
  39. document.addEventListener('keydown', function (evt) {
  40. if (evt.shiftKey && evt.key === 'J') {
  41. if (isAutoClicking) {
  42. stopAutoClick(); // Stop the autoclick when Shift+J is pressed
  43. } else {
  44. updateInfo("You may now click on any point in this tab to set the autoclicker to it. Have fun !!");
  45. }
  46. }
  47. });
  48.  
  49. document.addEventListener('click', function (event) {
  50. if (!isAutoClicking) {
  51. x = event.clientX;
  52. y = event.clientY;
  53. updateInfo(`Mouse click at X: ${x}, Y: ${y}, Click Frequency: Initializing...`);
  54. isAutoClicking = true; // Start autoclicking at the new coordinates
  55. startAutoClick(x, y);
  56. }
  57. });
  58.  
  59. function click(x, y) {
  60. let randomCPS = getRandomCPS(); // Generate a new random CPS
  61. updateInfo(`Mouse click at X: ${x}, Y: ${y}, Click Frequency: ${randomCPS} CPS`);
  62. let ev = new MouseEvent('click', {
  63. 'view': window,
  64. 'bubbles': true,
  65. 'cancelable': true,
  66. 'screenX': x,
  67. 'screenY': y
  68. });
  69.  
  70. let el = document.elementFromPoint(x, y);
  71. el.dispatchEvent(ev);
  72. }
  73.  
  74. // Helper function to update the information on the page
  75. function updateInfo(message) {
  76. let infoElement = document.getElementById("autoclick-info");
  77. if (!infoElement) {
  78. infoElement = document.createElement("div");
  79. infoElement.id = "autoclick-info";
  80. infoElement.style.position = "fixed";
  81. infoElement.style.top = "10px";
  82. infoElement.style.left = "10px";
  83. infoElement.style.backgroundColor = "white"; // White background
  84. infoElement.style.color = "black"; // Black text
  85. infoElement.style.fontWeight = "bold"; // Bold text
  86. document.body.appendChild(infoElement);
  87. }
  88. infoElement.textContent = message;
  89. }