Code Monkey home page Code Monkey logo

imsteam's Issues

Trademark symbol makes titles unsearchable

Browser: Firefox (stable branch)
Example game: Horizon Forbidden West™ Complete Edition
Example repack site: Fitgirl

Expected behavior: "Horizon Forbidden West™ Complete Edition" is turned into "Horizon Forbidden West Complete Edition" (™ Symbol removed) and a successful search is performed on fitgirl website

Actual behavior: "Horizon Forbidden West™ Complete Edition" is searched on fitgirl, there are no results because no human writes symbols like that

Affects most if not all games with that symbol in steam title

Maybe this links placement is a little bit better

// ==UserScript==
// @name         Steam Game Search Links
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Add search links for games on Steam pages
// @author       Your Name
// @match        https://store.steampowered.com/*
// @grant        GM_addStyle
// ==/UserScript==

const INSERT_BLOCK_QUERY = "div.block_content div.rightcol div.glance_ctn";
const LINKS_BLOCK_WRAPPER_CLASS = "torrent-links-wrapper";
const LINKS_BLOCK_CLASS = "links";

function initializeContainer() {
    const insertContainerElement = document.querySelector(INSERT_BLOCK_QUERY);

    if (!insertContainerElement) return;

    const linksWrapperBlock = document.createElement("div");
    linksWrapperBlock.setAttribute("class", LINKS_BLOCK_WRAPPER_CLASS);

    linksWrapperBlock.style.display = "flex";
    linksWrapperBlock.style.flexDirection = "column";

    insertContainerElement.appendChild(linksWrapperBlock);

    const linksBlockTitle = document.createElement("div");
    linksBlockTitle.setAttribute("class", "glance_tags_label");
    linksBlockTitle.style.marginBottom = "0.2em";
    linksBlockTitle.style.marginTop = "0.5em";
    linksBlockTitle.innerHTML = "Search this game on Torrent:"

    linksWrapperBlock.appendChild(linksBlockTitle);

    const linksBlock = document.createElement("div");
    linksBlock.setAttribute("class", LINKS_BLOCK_CLASS);

    linksBlock.style.display = "flex";
    linksBlock.style.flexDirection = "row";
    linksBlock.style.gap = "1em";
    linksBlock.style.flexWrap = "wrap";

    linksWrapperBlock.appendChild(linksBlock);
}

(function() {
    'use strict';

    function createButton(searchLink, buttonText, tooltipText, iconPath) {
        //const gameNameElement = document.getElementById("appHubAppName");
        const torrentLinksBlockEntity = document.querySelector(`div.block_content div.rightcol div.glance_ctn .${LINKS_BLOCK_WRAPPER_CLASS} .${LINKS_BLOCK_CLASS}`);
        if (torrentLinksBlockEntity) {
            const linkButton = document.createElement("a");
            linkButton.href = searchLink;
            linkButton.setAttribute("target", "_blank");

            const img = new Image();
            img.src = iconPath;
            img.alt = buttonText;
            //img.style.width = '64px';
            img.style.height = '32px';
            img.style.objectFit = 'contain';

            linkButton.appendChild(img);
            linkButton.title = tooltipText;
            //linkButton.style.marginRight = '10px';
            torrentLinksBlockEntity.appendChild(linkButton);
        }
    }

    initializeContainer();

    const formattedGameName = document.getElementById("appHubAppName").textContent.trim().toLowerCase().replace(/'/g, '').replace(/_/g, ' ');

    const steamDBSearchLink = `https://online-fix.me/index.php?do=search&subaction=search&story=${formattedGameName}`;
    createButton(steamDBSearchLink, "Online Fix", "Search on Online Fix", "https://i.imgur.com/WAXRAUw.png");

    const site1SearchLink = `https://www.skidrowreloaded.com/?s=${formattedGameName}&x=0&y=0`;
    createButton(site1SearchLink, "Skidrow", "Search on Skidrow", "https://i.imgur.com/sfzB2DE.png");

    const site2SearchLink = `https://fitgirl-repacks.site/?s=${formattedGameName}`;
    createButton(site2SearchLink, "FitGirl", "Search on FitGirl", "https://i.imgur.com/GOFbweI.png");

    const newSiteSearchLink = `https://steamrip.com/?s=${formattedGameName}`;
    createButton(newSiteSearchLink, "SteamRIP", "Search on SteamRIP", "https://i.imgur.com/tmvOT86.png");

    const new1SiteSearchLink = `https://dodi-repacks.site/?s=${formattedGameName}`;
    createButton(new1SiteSearchLink, "Dodi", "Search on Dodi", "https://i.imgur.com/g71t1Ge.png");

    const new2SiteSearchLink = `https://gload.to/?s=${formattedGameName}`;
    createButton(new2SiteSearchLink, "Gload", "Search on Gload", "https://gload.to/logo.png");

})();

image_2023-12-28_174403911

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.