Highlight specific friends who play

Highlights specific friends on the "who play" page and on the store page

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Highlight specific friends who play
// @match       https://steamcommunity.com/id/*/friendsthatplay/*
// @match       https://store.steampowered.com/app/*
// @icon        https://www.google.com/s2/favicons?sz=64&domain=steampowered.com
// @author      rdavydov
// @description Highlights specific friends on the "who play" page and on the store page
// @license MIT
// @version 0.0.1.20220829135439
// @namespace https://greasyfork.org/users/952134
// ==/UserScript==

////////////////////////////////////////////////////////////////////////////////////////
// Add links to your friends' profiles (without a slash at the end), separated by commas
// Each link should be surrounded with apostrophes ('), see the example below //////////
////////////////////////////////////////////////////////////////////////////////////////
var friends = ['https://steamcommunity.com/id/gabelogannewell','https://steamcommunity.com/id/gaben'];
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
////////////////////////////////////////////////////////////////////////////////////////

document.querySelectorAll('.friendBlockLinkOverlay').forEach(function(element, index) {
    if (friends.indexOf(element.href) >= 0) {
        document.querySelectorAll('.friendBlockLinkOverlay')[index].style.background = 'rgba(0, 255, 0, 0.20)';
    }
});

document.querySelectorAll('.friend_blocks_grid a').forEach(function(element, index) {
    if (friends.indexOf(element.href.slice(0,-1)) >= 0) {
        document.querySelectorAll('.friend_blocks_grid a')[index].style.background = 'green';
    }
});