Greasy Fork

Greasy Fork is available in English.

图寻插件

有了眨眼模式,可以随意控制眨眼时间

当前为 2023-10-13 提交的版本,查看 最新版本

// ==UserScript==
// @name         图寻插件
// @namespace    http://tampermonkey.net/
// @version      2.62
// @description
// @author       宇宙百科君
// @match        https://tuxun.fun/*
// @run-at       document-end
// @grant        none
// @description 有了眨眼模式,可以随意控制眨眼时间
// ==/UserScript==

(function() {
    'use strict';




// 功能1:按空格键触发另一个选择器
document.addEventListener('keydown', function(e) {
    // 输出到控制台,确保事件被触发
    console.log('Key pressed:', e.keyCode);

    if (e.keyCode === 32) {
        const buttons = document.querySelectorAll('button');
        buttons.forEach(function(button) {
            if (button.textContent.includes('开始(经典5轮)') || button.textContent.includes('再来一局') || button.textContent.includes('保留')) {
                button.click();
            }
        });
    }
});

    // 功能2:隐藏包含 "比赛已经开始或者这一轮游戏还未结束" 文本的提示
    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes) {
                mutation.addedNodes.forEach(function(node) {
                    if (node.nodeType === Node.ELEMENT_NODE && node.matches('.van-toast.van-toast--middle.van-toast--text')) {
                        const innerDiv = node.querySelector('.van-toast__text');
                        if (innerDiv && innerDiv.textContent.trim() === "比赛已经开始或者这一轮游戏还未结束") {
                            node.style.display = 'none';
                        }
                    }
                });
            }
        });
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

})();