Steam Store - Removed App/Sub Redirect To SteamDB

If the Steam Store App or Sub doesn't exist, is removed or is region-locked, redirect to SteamDB.info instead of store.steampowered.com.

11.12.2016 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Steam Store - Removed App/Sub Redirect To SteamDB
// @namespace    Royalgamer06
// @version      0.4
// @description  If the Steam Store App or Sub doesn't exist, is removed or is region-locked, redirect to SteamDB.info instead of store.steampowered.com.
// @author       Royalgamer06
// @include      *
// @exclude      file:*
// @run-at       document-idle
// @connect      store.steampowered.com
// @grant        GM_xmlhttpRequest
// @grant        unsafeWindow
// ==/UserScript==

if (/^https?:\/\/store\.steampowered.com\/(app|sub)\/.+$/.test(location.href)) {
    if (document.getElementById("error_box")) location.href = location.href.replace("store.steampowered.com", "steamdb.info");
}
document.querySelectorAll("a[href*='://store.steampowered.com/app/'], a[href*='://store.steampowered.com/sub/']").forEach(function(linkElem) {
    linkElem.onclick = function() {
        var w = linkElem.target ? unsafeWindow.open(linkElem.href, linkElem.target) : unsafeWindow.open(linkElem.href, "_self");
        GM_xmlhttpRequest({
            method: "HEAD",
            url: linkElem.href,
            onload: function(response) {
                if (/^https?:\/\/store\.steampowered.com\/?$/.test(response.finalUrl)) {
                    w.location.href = linkElem.href.replace("store.steampowered.com", "steamdb.info");
                }
            }
        });
        return false;
    };
});