Fix App Image Not Found

Fix App Image Not Found on steam pages

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

(I already have a user style manager, let me install it!)

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