您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自動點"我知道了"
// ==UserScript== // @name 賣貨便-"交易規範及慎防詐騙提醒"彈跳視窗之自動點擊 // @namespace http://tampermonkey.net/ // @version 2025-02-24 // @description 自動點"我知道了" // @author 紫弦 // @match https://myship.7-11.com.tw/* // @icon https://www.google.com/s2/favicons?sz=64&domain=7-11.com.tw // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function clickConfirmButton() { let modal = document.getElementById('BulletinModal_4'); if (!modal) return; let confirmButton = modal.querySelector('button, .btn, .confirm'); if (confirmButton) { confirmButton.click(); console.log('已自動點擊「我知道了」'); } } // **使用 setInterval 每 1ms 檢查一次,確保更快點擊** let interval = setInterval(() => { if (document.getElementById('BulletinModal_4')) { clickConfirmButton(); } }, 1); // 每 1ms 檢查一次,比 MutationObserver 觸發更快 // **使用 MutationObserver 監聽 BulletinModal_4 是否加入 DOM** const observer = new MutationObserver((mutationsList) => { for (let mutation of mutationsList) { if (mutation.addedNodes.length) { let modal = document.getElementById('BulletinModal_4'); if (modal) { clickConfirmButton(); } } } }); // **只監聽 body 內部的子元素變化** observer.observe(document.body, { childList: true, subtree: false }); })();