吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 414|回复: 11
收起左侧

[讨论] 在edge篡改猴里面实现自动点击器功能的插件

[复制链接]
yuzilin 发表于 2024-3-15 14:23
// ==UserScript==
// @name         Auto Clicker with Controls
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  A simple auto clicker with control options on any webpage
// @AuThor       You
// @match        *://*/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  // 创建点击器和相关控件容器
  var clickerWrapper = document.createElement('div');
  clickerWrapper.style.position = 'fixed';
  clickerWrapper.style.top = '20px'; // 修改悬浮窗位置到页面顶端
  clickerWrapper.style.left = '20px';
  clickerWrapper.style.width = '200px'; // 减小悬浮窗宽度
  clickerWrapper.style.height = 'auto';
  clickerWrapper.style.backgroundColor = '#ccc';
  clickerWrapper.style.border = '1px solid #000';
  clickerWrapper.style.padding = '5px';
  clickerWrapper.style.cursor = 'move';
  clickerWrapper.classList.add('auto-clicker-wrapper');

  // 创建点击器
  var clicker = document.createElement('div');
  clicker.innerHTML = 'Click Here to Auto Click';
  clicker.style.cursor = 'pointer';
  clicker.style.marginBottom = '5px'; // 添加底部间距以适应较小的悬浮窗

  // 创建循环次数输入框
  var loopCountInput = document.createElement('input');
  loopCountInput.type = 'number';
  loopCountInput.min = '1';
  loopCountInput.max = 'Infinity';
  loopCountInput.value = '1';
  loopCountInput.style.marginRight = '5px';
  loopCountInput.style.width = '50px'; // 减小输入框宽度

  // 创建时间间隔输入框(单位为毫秒)
  var intervalInput = document.createElement('input');
  intervalInput.type = 'number';
  intervalInput.min = '0';
  intervalInput.value = '1000';
  intervalInput.style.marginRight = '5px';
  intervalInput.style.width = '50px'; // 减小输入框宽度

  // 创建启用/关闭切换按钮
  var toggleButton = document.createElement('button');
  toggleButton.innerHTML = 'Enable';
  toggleButton.onclick = function() {
    if (this.innerHTML === 'Enable') {
      this.innerHTML = 'Disable';
      startAutoClicking();
    } else {
      this.innerHTML = 'Enable';
      clearInterval(autoClickIntervalId);
    }
  };

  // 构建布局
  clickerWrapper.appendChild(loopCountInput);
  clickerWrapper.appendChild(document.createTextNode(' times, every '));
  clickerWrapper.appendChild(intervalInput);
  clickerWrapper.appendChild(document.createTextNode('ms'));
  clickerWrapper.appendChild(toggleButton);
  clickerWrapper.appendChild(clicker);

  // 添加拖动功能
  let isDragging = false;
  let dragStartX, dragStartY;

  clickerWrapper.addEventListener('mousedown', function(e) {
    isDragging = true;
    dragStartX = e.clientX - this.offsetLeft;
    dragStartY = e.clientY - this.offsetTop;
    document.body.style.userSelect = 'none';
  });

  document.addEventListener('mousemove', function(e) {
    if (isDragging) {
      clickerWrapper.style.left = `${e.clientX - dragStartX}px`;
      clickerWrapper.style.top = `${e.clientY - dragStartY}px`;
    }
  });

  document.addEventListener('mouseup', function() {
    isDragging = false;
    document.body.style.userSelect = 'auto';
  });

  // 自动点击函数
  function autoClick() {
    const mouseX = clicker.getBoundingClientRect().left + clicker.clientWidth / 2;
    const mouseY = clicker.getBoundingClientRect().top + clicker.clientHeight / 2;
    const targetElement = document.elementFromPoint(mouseX, mouseY);

    if (targetElement) {
      const mouseEvent = new MouseEvent('click', {
        view: window,
        bubbles: true,
        cancelable: true
      });

      targetElement.dispatchEvent(mouseEvent);
    }

    --currentLoopCount;
    if (currentLoopCount > 0 || currentLoopCount === Infinity) {
      setTimeout(autoClick, parseInt(intervalInput.value));
    }
  }

  // 开始自动点击
  var currentLoopCount;
  var autoClickIntervalId;

  function startAutoClicking() {
    currentLoopCount = parseInt(loopCountInput.value);
    autoClick();
  }

  // 将点击器添加到页面上并初始化
  window.onload = function() {
    if (!document.querySelector('.auto-clicker-wrapper')) {
      document.body.appendChild(clickerWrapper);
    }
  };
})();
//以上代码并未实现模拟鼠标点击的功能,只有悬浮窗和可修改的参数,还有一个开关功能

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

破解专用户 发表于 2024-3-15 17:33
一直想要一个这种功能,但您这个非可视化的窗口,我看不懂,感谢大佬分享
您这是插件还是脚本,怎么看着那么像脚本
爱飞的猫 发表于 2024-3-15 17:50
 楼主| yuzilin 发表于 2024-3-15 19:27
破解专用户 发表于 2024-3-15 17:33
一直想要一个这种功能,但您这个非可视化的窗口,我看不懂,感谢大佬分享
您这是插件还是脚本,怎么看着那 ...

这个是脚本呀,在edge浏览器里面篡改猴的里面添加一个新的脚本并启动,去到一个新的标签页的时候悬浮窗就会出现在浏览器网页页面的左上角了。但是还不完善,模拟鼠标点击有点问题,我后面完善一下
破解专用户 发表于 2024-3-16 14:32
yuzilin 发表于 2024-3-15 19:27
这个是脚本呀,在edge浏览器里面篡改猴的里面添加一个新的脚本并启动,去到一个新的标签页的时候悬浮窗就 ...

已经这样操作,但是我不会改代码,我喜欢有一个功能,不知道能否实现,就是扫描页面按钮,当遇到下一步,这个按钮时自动点击,而不是您现在这样,隔1MS扫一下,我还不知道代码里写的是什么,扫的是什么
 楼主| yuzilin 发表于 2024-3-17 12:35
破解专用户 发表于 2024-3-16 14:32
已经这样操作,但是我不会改代码,我喜欢有一个功能,不知道能否实现,就是扫描页面按钮,当遇到下一步, ...

如果要实现这个功能要涉及捕获HTML里面对应下一步的那个元素,但是不知道网页制作者是用盒子div还是button了类名也不知道,这样的话就很难精确捕获一个网页里面的下一步。。除非是这个网页页面只有下一步这一个按钮。emmm我写的只是在对应位置能点。感觉您这个想法不错。我觉得有两个方案可能实现:
       第一种是只捕获页面一个按钮的脚本,但是局限性太大,很少网页只有一个按钮。
       第二种是需要用户去手动设置了,那就要一定基础看得懂网页开发者工具里面的代码,总的来说,按我所知道的,每个开发者定义按钮的方式不一样,很难捕获。或许有这个办法只是我不知道
破解专用户 发表于 2024-3-17 13:11
yuzilin 发表于 2024-3-17 12:35
如果要实现这个功能要涉及捕获HTML里面对应下一步的那个元素,但是不知道网页制作者是用盒子div还是butto ...

不知道大佬可用过手机版,论坛里的李跳跳软件,跳广告用的,其实我就是想要一款这样的软件的电脑版,跳指定操作,也可以理解成自动化,可以用录制鼠标宏来完成,但不行,因为网页打开的缓存时间不一样,就会形成乱点
 楼主| yuzilin 发表于 2024-3-18 11:33
破解专用户 发表于 2024-3-17 13:11
不知道大佬可用过手机版,论坛里的李跳跳软件,跳广告用的,其实我就是想要一款这样的软件的电脑版,跳指 ...

没用过,听过,我感觉挺厉害的,至少我都不知道他的运行机理是什么。因为APP大部分应该不是开源的,如果是录制鼠标宏,那应该需要对大部分应用进行数据收集这样。但是浏览器网页里面可以通过捕获对应元素实现,如果需要,可以让开发者不断录入各类需要用到的网页里面你想要的功能,一直更新,就可以保证这样的功能,无法一劳永逸。目前我没有时间搞这玩意,你感兴趣的话,可以学习一下HTML,css,JavaScript。HTML,css了解一下,Javascript好好看看应该能自己搞了
破解专用户 发表于 2024-3-19 08:48
yuzilin 发表于 2024-3-18 11:33
没用过,听过,我感觉挺厉害的,至少我都不知道他的运行机理是什么。因为APP大部分应该不是开源的,如果 ...

论坛很多回复,都是建议我学这些,我不是这个专业的哦,我只是做一些窗口类,可视化操作的,代码文盲……,谢谢回复
Kissmeet 发表于 2024-4-15 17:08
破解专用户 发表于 2024-3-16 14:32
已经这样操作,但是我不会改代码,我喜欢有一个功能,不知道能否实现,就是扫描页面按钮,当遇到下一步, ...

是这种么,鼠标右键获取网页元素路径,然后设置循环间隔时间,勾选自动 开始随机时间的自动点击
        
                    
Snipaste_2024-04-15_17-01-52.png
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止回复与主题无关非技术内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-28 22:06

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表