AutoClicker

One AutoClicker to rule them all. Place the class 'autoclick' on a clickable html element and run the script by pressing the button.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         AutoClicker
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  One AutoClicker to rule them all. Place the class 'autoclick' on a clickable html element and run the script by pressing the button.
// @author       Michael Whitaker
// @match        http://localhost
// @icon         https://www.google.com/s2/favicons?sz=64&domain=undefined.localhost
// @grant        none
// ==/UserScript==

(function () {
  'use strict'
  var vm = {};
  vm.currentElement = null;
  
  window.addEventListener('load', () => {
    vm.addButton('Mikes auto click button', vm.clickOnElements)
  });

  vm.clicknthElement = function (index) {
    let elementsOnDom = document.getElementsByClassName('autoclick');
    let elementsArray = Array.from(elementsOnDom);
    let element = elementsArray[index];
    element.click();
  };
  
  vm.addButton = function (text, onclick) {
    let button = document.createElement('button');
    button.style.position = 'absolute';
    button.style.top = '7%';
    button.style.right = '4%';
    button.style.zIndex = 999;
    button.style.color = 'hotpink';

    // we should map an object to the style element
    button.innerHTML = text;
    var body = document.getElementsByTagName("body")[0];
    body.appendChild(button);

    button.onclick = onclick;
    return button;
  }
  
  vm.clickOnElements = function () {
    vm.targetElementsLength = document.getElementsByClassName('autoclick').length;
    if (vm.targetElementsLength === 0) {
      return;
    }

    for (var i = 0; i < vm.targetElementsLength; i++) {
      setTimeout(function () {
        vm.clicknthElement(i);
      }, 200 * i);
    }
  }
}())