Computer “Vision” - webhek.com

2023/11/23 22:04:34

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Computer “Vision” - webhek.com
// @namespace   Violentmonkey Scripts
// @match       https://www.webhek.com/post/color-test/
// @grant       none
// @version     1.1
// @author      ganansuan647
// @license MIT
// @description 2023/11/23 22:04:34
// ==/UserScript==
// 这个函数用于比较两个颜色是否足够接近
// 等待页面加载完毕
window.addEventListener('load', function () {
    var isGameStarted = false;

    // 识别并点击不同颜色的方格的函数
    function findAndClickDifferentColorBox() {
        if (!isGameStarted) return; // 如果游戏未开始,则不执行任何操作

        var boxes = document.querySelectorAll('#box span');
        var colors = {};

        // 遍历所有方格并记录颜色
        boxes.forEach(function (box) {
            var color = box.style.backgroundColor;
            if (colors[color]) {
                colors[color].push(box);
            } else {
                colors[color] = [box];
            }
        });

        // 找出唯一的颜色
        for (var color in colors) {
            if (colors[color].length === 1) {
                // 模拟点击不同颜色的方格
                colors[color][0].click();
                break;
            }
        }
    }

    // 给“开始测试”按钮添加点击事件监听
    var playButton = document.querySelector('.btn.play-btn');
    if (playButton) {
        playButton.addEventListener('click', function () {
            isGameStarted = true;
            // 可以在游戏开始后立即执行一次检查
            findAndClickDifferentColorBox();
        });
    }

    // 设置定时器定期检查
    setInterval(findAndClickDifferentColorBox, 1000); // 每秒检查一次
});