Auto Click 'Pass' and 'Like' Buttons on boo.world

Click the 'Pass' button when pressing 'x' key and the 'Like' button when pressing 'd' key on boo.world

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Auto Click 'Pass' and 'Like' Buttons on boo.world
// @namespace    https://github.com/Maxhem2/BooWeb-MatchKeyboardSupport
// @version      1.0
// @description  Click the 'Pass' button when pressing 'x' key and the 'Like' button when pressing 'd' key on boo.world
// @match        https://boo.world/de/match
// @license MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let clicking = false; // Flag to track whether clicking is active

    // Add an event listener to listen for key presses
    window.addEventListener('keydown', function(event) {
        if (event.key === 'x' && !clicking) {
            clicking = true;
            clickUntilDOMChange('.action-button-large.clickable.hoverable.hover-grow-size-5.active-shrink-size img[src="/static/match_icons/pass.svg"]');
        } else if (event.key === 'd' && !clicking) {
            clicking = true;
            clickUntilDOMChange('.action-button-large.clickable.hoverable.hover-grow-size-5.active-shrink-size img[src="/static/match_icons/favorite.svg"]');
        }
    });

    function clickUntilDOMChange(selector) {
        const button = document.querySelector(selector);

        if (button) {
            const initialDOM = document.documentElement.outerHTML; // Get the initial DOM content

            const clickInterval = setInterval(() => {
                button.parentElement.click(); // Click the parent element containing the image

                // Check for DOM changes
                if (initialDOM !== document.documentElement.outerHTML) {
                    clicking = false; // Stop clicking
                    clearInterval(clickInterval);
                }
            }, 10); // Click every 10ms
        }
    }
})();