Boycot Microsoft Games On Steam

Highlight games by Microsoft on Steam

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Boycot Microsoft Games On Steam
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Highlight games by Microsoft on Steam
// @author       SwanKnight
// @match        https://store.steampowered.com/*
// @icon         https://www.google.com/s2/favicons?domain=store.steampowered.com
// @grant        none
// @license     GPLv3
// ==/UserScript==

(function() {
    'use strict';

    // List of publishers/developers to check for
    const publishers = [
        '343 Industries',
        'The Coalition',
        'Compulsion Games',
        'Double Fine',
        'inXile Entertainment',
        'Mojang',
        'Ninja Theory',
        'Obsidian',
        'Playground Games',
        'Rare',
        'Turn 10 Studios',
        'Undead Labs',
        'World\'s Edge',
        'Xbox',
        'Bethesda',
        'id Software',
        'Arkane Studios',
        'MachineGames',
        'ZeniMax',
        'Activision',
        'Infinity Ward',
        'Treyarch',
        'Sledgehammer Games',
        'Raven Software',
        'High Moon Studios',
        'Beenox',
        'Blizzard Entertainment'
    ];

    // Function to check and highlight games by specific publishers/developers
    function highlightGamesByPublishers() {
        // Find all DIVs with class "dev_row"
        let devRows = document.getElementsByClassName('dev_row');

        // Loop through each dev_row DIV
        for (let i = 0; i < devRows.length; i++) {
            let devRow = devRows[i];

            // Find all anchor tags within the dev_row
            let anchors = devRow.getElementsByTagName('a');

            // Loop through each anchor tag
            for (let j = 0; j < anchors.length; j++) {
                let anchor = anchors[j];
                let anchorText = anchor.textContent.toLowerCase();

                // Check if the anchor's text content includes any of the publishers (case-insensitive)
                for (let k = 0; k < publishers.length; k++) {
                    if (anchorText.includes(publishers[k].toLowerCase())) {
                        // Find the DIV with ID "appHubAppName" and set its background color to bright red
                        let appHubAppName = document.getElementById('appHubAppName');
                        if (appHubAppName) {
                            // Check if the text has already been modified
                            if (!appHubAppName.innerText.startsWith("(Boycot Microsoft)")) {
                                appHubAppName.style.backgroundColor = 'red';
                                appHubAppName.style.color = 'grey';
                                appHubAppName.style.textDecoration = "line-through";
                                appHubAppName.innerText = "(Boycot Microsoft) " + appHubAppName.innerText;
                            }
                        }
                        break; // Exit the loop once the first match is found
                    }
                }
            }
        }
    }

    // Run the function when the page loads
    window.addEventListener('load', highlightGamesByPublishers);
})();