F95Zone Search Buttons for Steam

Adds buttons to search for the Steam game on F95Zone and its forums.

Verze ze dne 26. 03. 2024. Zobrazit nejnovější verzi.

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

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 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         F95Zone Search Buttons for Steam
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Adds buttons to search for the Steam game on F95Zone and its forums.
// @author       FunkyJustin
// @match        https://store.steampowered.com/app/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    function createF95ZoneButton() {
        const gameTitle = document.querySelector('.apphub_AppName').innerText.trim();
        const f95zoneGameLink = `https://f95zone.to/sam/latest_alpha/#/cat=games/page=1/search=${encodeURIComponent(gameTitle)}`;
        const f95zoneForumLink = `https://f95zone.to/search/?q=${encodeURIComponent(gameTitle)}`;

        const gameButton = createButton('Search on F95Zone', f95zoneGameLink);
        const forumButton = createButton('Search on F95Zone Forums', f95zoneForumLink);

        const container = document.querySelector('.apphub_OtherSiteInfo');
        container.appendChild(gameButton);
        container.appendChild(forumButton);
    }

    function createButton(text, link) {
        const button = document.createElement('a');
        button.innerText = text;
        button.href = link;
        button.target = '_blank';
        button.style.display = 'inline-block'; // Change display to inline-block
        button.style.marginRight = '10px'; // Add margin between buttons
        button.style.color = '#fff';
        button.style.backgroundColor = '#009688';
        button.style.padding = '10px';
        button.style.borderRadius = '5px';
        button.style.textDecoration = 'none';
        button.style.cursor = 'pointer';

        return button;
    }

    // Wait for the game details to load before creating the button
    window.addEventListener('load', createF95ZoneButton);

    // Listen for clicks on the F95Zone Forums button
    document.addEventListener('click', function(event) {
        if (event.target.textContent === 'Search on F95Zone Forums') {
            event.preventDefault();
            const gameTitle = document.querySelector('.apphub_AppName').innerText.trim();
            const f95zoneForumLink = `https://f95zone.to/search/?q=${encodeURIComponent(gameTitle)}`;
            window.location.href = f95zoneForumLink;
        }
    });
})();