// ==UserScript== // @name 网页点击器 // @namespace http://tampermonkey.net/ // @version 1.4 // @description 点击器功能强大,支持多种点击类型和灵活延迟设置 // @author YourName // @match *://*/* // @icon https://img.ixintu.com/download/jpg/202001/d9a6b42c05fa8030705926cb38d7c8a5.jpg!con // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @grant GM_notification // @require https://code.jquery.com/jquery-3.6.0.min.js // ==/UserScript== (function() { 'use strict'; // 广告配置 - 在这里填充您的广告信息 const adConfig = [ { name: "网盘解除下载速度工具", url: "https://pan.quark.cn/s/45d72ccb9e74" }, { name: "12306自动抢票", url: "https://pan.quark.cn/s/34871455b689" }, { name: "office激活工具", url: "https://pan.quark.cn/s/17891483c186" }, { name: "电脑破解软件", url: "https://pan.quark.cn/s/c8feae4a6fc0" }, { name: "PPT模板分享", url: "https://pan.quark.cn/s/d866fba7c0db" }, { name: "各类资源合集", url: "https://pan.quark.cn/s/51e51e77b6b7" } ]; // 存储点击规则的数据结构 let clickRules = GM_getValue('clickRules', []); let isRunning = false; let currentInterval = null; let currentRuleIndex = 0; let minimizeTimeout = null; // 创建固定顶部广告栏 function createFixedAdBanner() { // 如果已经存在,先移除 if ($('#fixed-ad-banner').length) { $('#fixed-ad-banner').remove(); } // 清除可能存在的超时 if (minimizeTimeout) { clearTimeout(minimizeTimeout); minimizeTimeout = null; } // 计算实际显示的广告数量 const activeAds = adConfig.filter(ad => ad.name && ad.url); console.log('有效广告数量:', activeAds.length); if (activeAds.length === 0) { console.log('没有配置广告内容,广告栏不会显示'); return; } // 生成广告位HTML let adsHTML = ''; adConfig.forEach((ad, index) => { if (ad.name && ad.url) { adsHTML += ` 作者推荐 ${ad.name} `; } }); const adBannerHTML = `
`; $('body').prepend(adBannerHTML); console.log('固定顶部广告栏已添加到页面'); // 为body添加顶部边距,防止内容被广告栏遮挡 adjustBodyMargin(); // 绑定广告栏事件 $('#toggle-ad-banner').on('click', function() { toggleAdBanner(); }); // 广告点击统计 $('.ad-item').on('click', function(e) { const adIndex = $(this).data('ad-index'); console.log(`广告点击: ${adConfig[adIndex].name}`, adConfig[adIndex].url); // 允许默认行为(跳转链接) return true; }); // 检查广告链接是否正确绑定 setTimeout(() => { const adLinks = $('.ad-item'); console.log(`找到 ${adLinks.length} 个广告链接`); adLinks.each(function() { const href = $(this).attr('href'); console.log('广告链接:', href); }); }, 1000); } // 调整body边距 function adjustBodyMargin() { const bannerHeight = $('#fixed-ad-banner').outerHeight(); $('body').css('margin-top', bannerHeight + 'px'); } // 切换广告栏状态 function toggleAdBanner() { const $banner = $('#fixed-ad-banner'); const $slots = $('.ad-slots'); const $toggleBtn = $('#toggle-ad-banner'); if ($slots.is(':visible')) { // 最小化广告栏 $slots.hide(); $toggleBtn.text('+').attr('title', '展开广告栏'); $banner.css('height', '30px'); // 设置3分钟后自动恢复 minimizeTimeout = setTimeout(() => { expandAdBanner(); }, 3 * 60 * 1000); // 3分钟 } else { // 展开广告栏 expandAdBanner(); } // 调整body边距 adjustBodyMargin(); } // 展开广告栏 function expandAdBanner() { const $banner = $('#fixed-ad-banner'); const $slots = $('.ad-slots'); const $toggleBtn = $('#toggle-ad-banner'); $slots.show(); $toggleBtn.text('−').attr('title', '最小化广告栏'); $banner.css('height', 'auto'); // 清除超时 if (minimizeTimeout) { clearTimeout(minimizeTimeout); minimizeTimeout = null; } // 调整body边距 adjustBodyMargin(); } // 创建自动点击器悬浮窗 function createAutoClicker() { // 如果已经存在,先移除 if ($('#auto-clicker-floating').length) { $('#auto-clicker-floating').remove(); } const floatingHTML = `