Doesn't that make sense? If someone (e.g. a trader) somewhere (e.g. steamtrades) links to a game removed on steam, this script will make sure when you click on it you land on SteamDB instead of http://store.steampowered.com
Comment has been collapsed.
Oh, I thought u meant URL's on the web pages.
But yes, it runs on every website... as it should!
It makes no sense to restrict it to only steamcommunity/steampowered.
What if I link a removed steam game here?
Or anywhere for that matter.
If you don't like that (I don't see a reason why not), you don't have to install this script.
Thanks
Comment has been collapsed.
I know all this... But this is not what I want to do! It makes not sense to restrict this userscript on to the steam web pages (they probably won't contain any removed apps). It should work for every site you visit that happens to have links to steam on the page.
Comment has been collapsed.
Initially it did not work for me (Chrome 54.0.2840.99) until I loaded this page in a new window.
I can see how this script can be useful, but I'm not sure I'd like to add a delay every time I click a Steam store link. When I find a removed game it's typically easy to just google for the game name and add steamdb as a keyword. If there was a way for the script to catch the Steam redirect to the homepage and only then redirect to steamdb it would have more convenient.
Comment has been collapsed.
I had the same thought and just looked into this.It is not possible with userscripts, since the redirect is on HTTP level and scripts get evaluated on the document. It should be possible for a dedicated browser addon though.
@Royalgamer06: I love the idea! Some suggestions for improvement:
Comment has been collapsed.
According to his profile, BcompleXx is German, just like i am. Also i use Tempermonkey and disabled all other scripts and enhanced steam addon to test.
On region locked games, like wolfenstein, i see the usual "product is not available in your region" for a second before i get redirected to steamdb. On removed games (i tried a lot of those you listed in the first post) i get redirected to http://store.steampowered.com/ immediately and without an error in the console.
Edit: i don't know if this helps, but i found out it actually does redirect, but it seems to have problems with lots of tabs in multiple windows. I open a link in a new tab in one window and it works, other links work too, trying to copy & paste said links or "open in new window" will result in nothing. I tried logging finalURL to console ( console.log(response.finalUrl); at the end of the onload function ) but it will not give any output. The region locked ones seem to be working at all of the time though.
Comment has been collapsed.
Does this support regional links (not available in region titles, Steam bundles removed from certain regions during sales)?
Comment has been collapsed.
Example of store link? The Secret World's Store Page isn't accessible from Indonesia.
Comment has been collapsed.
I went ahead and played a little around with your code, trying to eliminate the need to wait for an ajax response every time.
What my code does different, is that it always opens the target url in a new tab first.
Then it fetches the page again in the xhr and does the redirect check. If it was redirecet, the previously opened window is closed and a new tab is opened with the steamdb link.
This way, if it is a valid url, everything just works. If not, you'll see a tab open and close in <1s before you get sent to the right page.
document.querySelectorAll("a[href*='://store.steampowered.com/app/'], a[href*='://store.steampowered.com/sub/']").forEach(function(linkElem) {
linkElem.onclick = function() {
var w = GM_openInTab(linkElem.href);
GM_xmlhttpRequest({
method: "HEAD",
url: linkElem.href,
onload: function(response) {
if (/^https?:\/\/store\.steampowered.com\/?$/.test(response.finalUrl)) {
w.close();
GM_openInTab(linkElem.href.replace("store.steampowered.com", "steamdb.info"));
}
}
});
return false;
};
});
Comment has been collapsed.
I debugged a lot on firefox, but I could never get the real final URL from firefox. Meaning that for example console.log(response.finalUrl) in firefox would output http://store.steampowered.com/app/273580 instead of http://store.steampowered.com.
Comment has been collapsed.
It works on Firefox 52. But not older version like Firefox 39.
I modify some code that compatible with Firefox 39 without Jquery.
var eles = document.querySelectorAll("a[href*='://store.steampowered.com/app/'], a[href*='://store.steampowered.com/sub/']");
for (var i = 0; i < eles.length; i++)
{
eles[i].addEventListener("click", function(ev)
{
ev.preventDefault();
var linkElem = ev.target;
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");
}
}
});
});
}
PS: document.querySelectorAll("...").forEach can only use in FF50+ https://developer.mozilla.org/en/docs/Web/API/NodeList#Browser_compatibility
Comment has been collapsed.
And I was wondering, why left mouse button stopped to work correctly... No thanks, some redirects don't worth broken browser behavior.
Comment has been collapsed.
Still double.
I think you must remove href and restore as ver 1.2 to prevent middle click default behavior in FF.
I edit your code in ver 1.2 to preserve href when right click.
linkElem.onmousedown = function(ev) {
if (ev.button) {
if (ev.button == 1) {
ev.preventDefault();
linkElem.removeAttribute("href");
}
}
};
Comment has been collapsed.
1,247 Comments - Last post 7 minutes ago by WaxWorm
4 Comments - Last post 56 minutes ago by ArtemB1988
82 Comments - Last post 1 hour ago by GarlicToast
71 Comments - Last post 2 hours ago by LighteningOne
149 Comments - Last post 4 hours ago by mikotomaki
145 Comments - Last post 5 hours ago by seaman
253 Comments - Last post 6 hours ago by Bum8ara5h
55 Comments - Last post 7 minutes ago by SilentGuy
28,636 Comments - Last post 9 minutes ago by ha14
760 Comments - Last post 25 minutes ago by Outmind
213 Comments - Last post 29 minutes ago by Kyrrelin
2,433 Comments - Last post 32 minutes ago by kurtoff883
642 Comments - Last post 34 minutes ago by lav29
150 Comments - Last post 35 minutes ago by lav29
[UserScript] Steam Store - Removed App/Sub Redirect To SteamDB
Introduction
Hi, ever wanted to go to the store page of a steam game, only to find out it redirects to the main steam store page? This can be quite annoying at times, especially for a trader who quite often encounter such removed games. This userscript checks each link to a steam store item if it redirects you the main page of the steam store upon clicking. If it does, it will instead open the item in SteamDB. I usually had to do this manually if I wanted to check out games removed from the Steam Store. Now, with this userscript, this happens automatically. It is not really an userscript for SteamGifts, but it is a handy tool for trader who deal with removed games a lot. I hope you enjoy it!
Features
Download
Instructions
Credits
Examples
The following games/bundles are no longer available in the steam store:
Source: TimeKillerz.eu
Comment has been collapsed.