Fix App Image Not Found

Fix App Image Not Found on steam pages

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

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

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         Fix App Image Not Found
// @namespace    https://greasyfork.org/users/2205
// @version      0.1
// @description  Fix App Image Not Found on steam pages
// @author       Rudokhvist
// @match        https://steamcommunity.com/id/*
// @match        https://steamcommunity.com/profiles/*
// @license      Apache-2.0
// @run-at       document-idle
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
 	var images=document.querySelectorAll("img[src$='338200c5d6c4d9bdcf6632642a2aeb591fb8a5c2.gif']");
        if (!images.length) { return; }
	for (var index = 0;index<images.length;index++) {
		var appidRegex = images[index].parentElement.href.match(/(?:store\.steampowered|steamcommunity)\.com\/(app|market\/listings)\/(\d+)\/?/);
		if (appidRegex != null) {
			var appid = appidRegex[2];
			if (appid != 223530) { //TODO: check if there is other exceptions. if there are - make more complex condition here
				images[index].src="https://steamcdn-a.akamaihd.net/steam/apps/" + appid + "/capsule_184x69.jpg";
			}
		}
	}
})();