Fix App Image Not Found

Fix App Image Not Found on steam pages

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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";
			}
		}
	}
})();