Git游戏

最新动态:
查看全部
每日签到 ×
0
连签天数
0
累签次数
0
今日已签到

签到规则

每日签到获得 5 积分

连签达标可额外获得奖励:

最新动态
您现在的位置是:首页 > 攻略大全 > 辅助脚本

辅助脚本

搞个自动点击脚本,网页点击的应该都能用

2026-09-24 辅助脚本570 作者:a1147946994 投稿者:a1147946994
本文作者为 @a1147946994。
用AI写的// ==UserScript==// @name 自动点击(可拖动)// @namespace http://tampermonkey.net/// @version 8.1// @match *://*/*// @grant none// ==/UserScript==(function(){'use strict';con...

用AI写的

// ==UserScript==

// @name         自动点击(可拖动)

// @namespace    http://tampermonkey.net/

// @version      8.1

// @match        *://*/*

// @grant        none

// ==/UserScript==

(function(){

'use strict';

const cfg={perItemDelay:1,interval:1,storageKey:'autoClickSelectors_v11'};

let targetList=[];

try{targetList=JSON.parse(localStorage.getItem(cfg.storageKey))||[];}catch(e){}

let timerId=null,running=false,hoverEl=null;


const panel=document.createElement('div');

panel.style.cssText=`position:fixed;top:20px;right:20px;z-index:999999;background:rgba(30,30,30,0.95);color:#fff;padding:12px;border-radius:8px;font-size:12px;width:380px;max-height:80vh;overflow:hidden;user-select:none;font-family:system-ui,sans-serif`;

panel.innerHTML=`

<div id="panelTitle" style="font-weight:bold;margin-bottom:8px;display:flex;justify-content:space-between;align-items:center;cursor:move;background:#333;margin:-12px -12px 8px;padding:8px 12px;border-radius:8px 8px 0 0;">

<span>?自动点击控制台</span>

<span id="togglePanel" style="cursor:pointer;">−</span>

</div>

<div id="panelBody" style="overflow:auto;max-height:calc(80vh - 60px);">

<div style="margin-bottom:8px;padding:6px;background:#444;border-radius:4px;" id="statusBox"><span id="statusText">状态:已停止</span></div>

<button id="startBtn" style="width:100%;padding:4px;background:#2a8;color:#fff;border:none;border-radius:4px;cursor:pointer;margin-bottom:8px;">F 启动</button>

<div style="margin-bottom:8px;"><div>有效可点:<span id="countNum">0</span>/总<span id="totalNum">0</span></div><div id="itemList" style="max-height:180px;overflow-y:auto;border:1px solid #555;border-radius:4px;padding:4px;margin-top:4px;"></div></div>

<div style="font-size:11px;color:#ccc;line-height:1.8;background:#333;padding:6px;border-radius:4px;">

E=悬停按钮加文本 | R=加CSS | F启停 | ESC停<br>绿色=找到 红色=找不到 点×删除 拖动标题栏移动

</div>

</div>`;

document.body.appendChild(panel);


const $=id=>document.getElementById(id);

const statusText=$('statusText'),itemListEl=$('itemList'),countNum=$('countNum'),totalNum=$('totalNum'),startBtn=$('startBtn'),togglePanel=$('togglePanel'),panelBody=$('panelBody'),panelTitle=$('panelTitle');


function findButtonByText(t){const bts=document.querySelectorAll('button');for(let b of bts)if(b.innerHTML.includes(t))return b;return null;}

function getButtonTitle(btn){if(!btn)return'';const h2=btn.querySelector('h2');if(h2?.textContent.trim())return h2.textContent.trim();return btn.textContent.trim().slice(0,30);}

function getCssSelector(el){if(el.id)return`#${el.id}`;let s=el.tagName.toLowerCase();if(el.className){s+='.'+el.className.trim().split(/\s+/).filter(c=>c).join('.');}return s;}

function saveList(){localStorage.setItem(cfg.storageKey,JSON.stringify(targetList));}


function renderList(){

itemListEl.innerHTML='';let valid=0;

targetList.forEach((item,idx)=>{

let ok=false,type='';

if(item.type==='text'){ok=!!findButtonByText(item.val);type='[文本]';}

else if(item.type==='css'){ok=!!document.querySelector(item.val);type='[CSS]';}

if(ok)valid++;

const d=document.createElement('div');

d.style.cssText=`display:flex;justify-content:space-between;align-items:center;padding:2px 4px;margin-bottom:2px;background:#333;border-radius:3px`;

const short=item.val.length>34?item.val.slice(0,34)+'...':item.val;

d.innerHTML=`<span title="${item.val}" style="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:${ok?'#8f8':'#f66'}">${type} ${short}</span><button style="background:#c33;color:#fff;border:none;border-radius:2px;cursor:pointer;padding:0 4px;font-size:10px;">×</button>`;

d.querySelector('button').onclick=()=>{targetList.splice(idx,1);saveList();renderList();};

itemListEl.appendChild(d);

});

countNum.textContent=valid;totalNum.textContent=targetList.length;

if(targetList.length===0)itemListEl.innerHTML='<div style="text-align:center;color:#888;padding:8px;">E添加文本 / R添加CSS</div>';

}


function flashStatus(text,color){

statusText.textContent=text;statusText.parentElement.style.background=color;

setTimeout(()=>{statusText.textContent=running?'运行中':'已停止';statusText.parentElement.style.background=running?'#2a8':'#444';},800);

}


let drag=false,dragX,dragY;

panelTitle.addEventListener('mousedown',e=>{

if(e.target===togglePanel)return;

drag=true;dragX=e.clientX-panel.offsetLeft;dragY=e.clientY-panel.offsetTop;

e.preventDefault();

});

document.addEventListener('mousemove',e=>{

if(!drag)return;

panel.style.left=(e.clientX-dragX)+'px';

panel.style.top=(e.clientY-dragY)+'px';

panel.style.right='auto';

});

document.addEventListener('mouseup',()=>drag=false);


document.addEventListener('mouseover',e=>{hoverEl=e.target.closest('button');if(hoverEl){hoverEl.style.outline='2px dashed #2a8';setTimeout(()=>hoverEl.style.outline='',300);}},true);


document.addEventListener('keydown',e=>{

if(['INPUT','TEXTAREA'].includes(e.target.tagName))return;

const k=e.key.toLowerCase();

if(k==='e'&&hoverEl){e.preventDefault();const t=getButtonTitle(hoverEl);if(!t){flashStatus('无标题','#f80');return;}

if(targetList.some(x=>x.type==='text'&&x.val===t))flashStatus('已存在','#f80');

else{targetList.push({type:'text',val:t});saveList();renderList();flashStatus('已加文本','#2a8');}}

if(k==='r'&&hoverEl){e.preventDefault();const s=getCssSelector(hoverEl);

if(targetList.some(x=>x.type==='css'&&x.val===s))flashStatus('已存在','#f80');

else{targetList.push({type:'css',val:s});saveList();renderList();flashStatus('已加CSS','#9cf');}}

if(k==='f'){e.preventDefault();running?stopTask():startTask();}

if(e.key==='Escape')stopTask();

});


function simulateClick(el){el.dispatchEvent(new MouseEvent('click',{bubbles:true,cancelable:true,view:window}));}

async function clickLoop(){

if(!running)return;

for(const item of [...targetList]){

if(!running)return;

let tar=item.type==='text'?findButtonByText(item.val):document.querySelector(item.val);

if(tar)simulateClick(tar);

await new Promise(r=>setTimeout(r,cfg.perItemDelay));

}

}

function startTask(){if(running)return;running=true;statusText.textContent='运行中';statusText.parentElement.style.background='#2a8';startBtn.textContent='F 停止';startBtn.style.background='#c33';clickLoop();timerId=setInterval(clickLoop,cfg.interval);}

function stopTask(){running=false;if(timerId)clearInterval(timerId);timerId=null;statusText.textContent='已停止';statusText.parentElement.style.background='#444';startBtn.textContent='F 启动';startBtn.style.background='#2a8';}


startBtn.onclick=()=>running?stopTask():startTask();

togglePanel.onclick=()=>{panelBody.style.display=panelBody.style.display==='none'?'block':'none';togglePanel.textContent=panelBody.style.display==='none'?'+':'−';};

renderList();

setInterval(renderList,1000);

})();


7.8
★★★★★
4 人评分
给这篇文章打分
★ ★ ★ ★ ★
满分10分,点击星星打分
评分分布
5星
75%
4星
0%
3星
0%
2星
0%
1星
25%

文章评论

共有3条评论来说两句吧...

eee308ipyerLv10 4天前未评分
以后搞个时间加速用户脚本,最大加速1e308x加速
eee308ipyerLv10 4天前未评分
展开
路痴大魔王Lv14摸鱼达人 5天前未评分
顶一波
每日游戏盲盒
点击盲盒,开出今日惊喜游戏
游戏库
最近0 收藏0 游玩中0 已通关0
加载中...
最近在玩
为「搞个自动点击脚本,网页点击的应该都能用」补充标签
你推荐的标签将在管理员审核通过后展示在页面的标签区,便于大家找到这篇文章。每行一个,不要带标点符号。审核通过后同时计入你的「补充标签」任务进度。
每行一个标签,最多 10 个,提交后等待管理员审核展示