您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
One AutoClicker to rule them all. Place the class 'autoclick' on a clickable html element and run the script by pressing the button.
// ==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); } } }())