Steam Search Button for F95Zone (Deprecated)

Add a button to search Google using the title of the game on F95Zone, to see if it has been released on Steam

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Steam Search Button for F95Zone (Deprecated)
// @namespace    http://tampermonkey.net/
// @version      0.3.1
// @description  Add a button to search Google using the title of the game on F95Zone, to see if it has been released on Steam 
// @author       FunkyJustin
// @match        https://f95zone.to/threads/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to search Google with the game title on Steam
    function searchSteamForTitle() {
        // Get the game title text
        var gameTitleElement = document.querySelector('h1.p-title-value');
        var gameTitle = gameTitleElement.textContent.trim();

        // Remove elements with the class "label"
        var labels = gameTitleElement.querySelectorAll('.label');
        labels.forEach(function(label) {
            label.remove();
        });

        // Get the modified game title
        var gameTitleForSearch = gameTitleElement.textContent.trim();

        // Remove everything inside square brackets and the brackets themselves for the search query
        gameTitleForSearch = gameTitleForSearch.replace(/\[.*?\]/g, '');

        // Construct the Google search URL
        var searchQuery = encodeURIComponent(gameTitleForSearch + ' site:store.steampowered.com');
        var searchUrl = 'https://www.google.com/search?q=' + searchQuery;

        // Open the search URL in a new tab
        window.open(searchUrl, '_blank');
    }

    // Create and append the search button
    var searchButton = document.createElement('button');
    searchButton.textContent = 'Search Steam';
    searchButton.style.marginLeft = '10px';
    searchButton.addEventListener('click', searchSteamForTitle);
    
    var gameTitleContainer = document.querySelector('div.p-title > h1.p-title-value').parentNode;
    gameTitleContainer.appendChild(searchButton);
})();