F95Zone Developer and Game Search on Steam and RyuuGames

Adds buttons to search for the developer on F95Zone and the game title on Steam and RyuuGames

À partir de 2025-08-13. Voir la dernière version.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

// ==UserScript==
// @name         F95Zone Developer and Game Search on Steam and RyuuGames
// @namespace    http://tampermonkey.net/
// @version      2.5
// @description  Adds buttons to search for the developer on F95Zone and the game title on Steam and RyuuGames
// @author       FunkyJustin
// @license      MIT
// @match        https://f95zone.to/threads/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=f95zone.to
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Function to create a search button
    function createSearchButton(buttonText, searchUrls, ariaLabel) {
        const button = document.createElement('button');
        button.innerText = buttonText;
        button.setAttribute('aria-label', ariaLabel);
        button.style.margin = '5px';
        button.style.cursor = 'pointer';
        button.style.padding = '5px 10px';
        button.style.fontSize = '14px';
        button.style.color = '#FFFFFF';
        button.style.backgroundColor = '#0073e6';
        button.style.border = 'none';
        button.style.borderRadius = '3px';
        button.style.display = 'inline-block';
        button.style.textAlign = 'center';

        // Hover effect
        button.onmouseover = function() {
            button.style.backgroundColor = '#005bb5';
        };
        button.onmouseout = function() {
            button.style.backgroundColor = '#0073e6';
        };

        button.onclick = function() {
            searchUrls.forEach(url => window.open(url, '_blank'));
        };
        return button;
    }

    // Find the title element
    const titleElement = document.querySelector('.p-title h1.p-title-value');
    if (titleElement) {
        // Create a container for the buttons
        const buttonContainer = document.createElement('div');
        buttonContainer.style.marginTop = '0';
        buttonContainer.style.display = 'flex';
        buttonContainer.style.alignItems = 'center';
        buttonContainer.style.backgroundColor = 'transparent';
        buttonContainer.style.padding = '0 0 10px';

        // Extract the full title text
        const titleText = titleElement.innerText;

        // Extract the developer's name
        const developerMatch = titleText.match(/\[([^\]]+)\]$/);
        if (developerMatch && developerMatch[1].length > 0 && developerMatch[1].length < 100) {
            const developerName = developerMatch[1];
            const encodedDeveloperName = encodeURIComponent(developerName);
            const developerSearchUrl = `https://f95zone.to/sam/latest_alpha/#/cat=games/page=1/creator=${developerName}`;
            const developerForumSearchUrl = `https://f95zone.to/search/?q=${encodedDeveloperName}`;
            const developerSteamSearchUrls = [
                `https://store.steampowered.com/search/?developer=${developerName}`,
                `https://store.steampowered.com/search/?term=${developerName}`
            ];
            const developerSearchButton = createSearchButton('Search Developer on F95Zone', [developerSearchUrl], `Search for developer ${developerName} on F95Zone`);
            const developerForumSearchButton = createSearchButton('Search Developer on F95Zone Forums', [developerForumSearchUrl], `Search for developer ${developerName} on F95Zone forums`);
            const developerSteamSearchButton = createSearchButton('Search Developer on Steam', developerSteamSearchUrls, `Search for developer ${developerName} on Steam`);
            buttonContainer.appendChild(developerSearchButton);
            buttonContainer.appendChild(developerForumSearchButton);
            buttonContainer.appendChild(developerSteamSearchButton);
        } else {
            const noDeveloperLabel = document.createElement('span');
            noDeveloperLabel.innerText = 'Developer name not found';
            noDeveloperLabel.style.color = '#888';
            noDeveloperLabel.style.marginLeft = '10px';
            buttonContainer.appendChild(noDeveloperLabel);
        }

        // Function to extract game title without modifying the DOM
        function extractGameTitle(element, developer) {
            let gameTitle = '';
            element.childNodes.forEach(node => {
                if (node.nodeType === Node.TEXT_NODE) {
                    gameTitle += node.textContent;
                }
            });
            if (developer) {
                gameTitle = gameTitle.replace(`[${developer}]`, '').trim();
            }
            return gameTitle.trim();
        }

        // Extract and clean the game title
        const gameTitle = extractGameTitle(titleElement, developerMatch ? developerMatch[1] : null);
        const encodedGameTitle = encodeURIComponent(gameTitle);

        // Construct search URLs
        const gameSearchUrl = `https://store.steampowered.com/search/?term=${encodedGameTitle}&supportedlang=english&ndl=1`;
        const gameRyuuGamesSearchUrl = `https://www.ryuugames.com/?s=${encodedGameTitle}`;
        const gameSearchButton = createSearchButton('Search Game on Steam', [gameSearchUrl], `Search for game ${gameTitle} on Steam`);
        const gameRyuuGamesSearchButton = createSearchButton('Search Game on RyuuGames', [gameRyuuGamesSearchUrl], `Search for game ${gameTitle} on RyuuGames`);

        // Append the game search buttons
        buttonContainer.appendChild(gameSearchButton);
        buttonContainer.appendChild(gameRyuuGamesSearchButton);

        // Append the button container to the parent of the title element
        titleElement.parentElement.appendChild(buttonContainer);
    }
})();