This is not a Userscript for SG but for the Steam store. I thought I would share it nonetheless since it's something that has bugged me for a long time.

When browsing the Steam store the URL often contains additions at the end like "?snr=1_4_4__100" to track where you clicked on the link. This is helpful for Valve to see what areas of the Steam store are used the most. For me it became annoying because I bookmark interesting games and ended up with lots of duplicates because of the different URL endings.

This script will automatically replace the URL with a cleaned one without reloading the page. So "http://store.steampowered.com/app/440/?snr=1_4_4__100" for example would become "http://store.steampowered.com/app/440/".

Download

7 years ago*

Comment has been collapsed.

Isn't it better to just copy-paste the relevant part of the link or am I missing something?

7 years ago
Permalink

Comment has been collapsed.

I used to do that but considering the amount of bookmarks I have it became annoying to always do that.

7 years ago
Permalink

Comment has been collapsed.

I think you got the terminology wrong. It's rather an URL cleaner, than an URL shortener.

7 years ago
Permalink

Comment has been collapsed.

I have very little experience with this so you might be right, I don't know. Thanks for the input.

7 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 3 years ago.

7 years ago
Permalink

Comment has been collapsed.

Ah, crap. :D Thanks.

7 years ago
Permalink

Comment has been collapsed.

I just noticed I forgot to finish reading your comment because I was so focused on getting rid of the German link. It's not my first script but the first one I published. My first one was the previous take on this problem with which I added a button to the Store that leads to the cleaned URL. I wanted to make it work automatically but didn't know how back then.

7 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 3 years ago.

7 years ago
Permalink

Comment has been collapsed.

Thanks for your offered help but I am just stupid like that, I want to learn it on my own. (facepalm)

7 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 3 years ago.

7 years ago
Permalink

Comment has been collapsed.

I would go with Sighery's method too,
done the same for a dozen sites (for various reasons).

Although i must say i love regex, not being very objective here. ^^

7 years ago
Permalink

Comment has been collapsed.

I improved your script a bit:

// ==UserScript==
// @name        Steam Store - URL Cleaner
// @namespace   Steam Store - URL Cleaner
// @description Cleans the URL for Steam Store pages
// @version     1.0
// @grant       none
// @run-at      document-start
// @include     /^https?:\/\/store\.steampowered\.com.*$/
// ==/UserScript==

if (window.location.search.length > 0) window.location.href = window.location.href.replace(window.location.search, "");
7 years ago
Permalink

Comment has been collapsed.

It took me some time to understand your changes but yeah, your solution is a lot cleaner (no pun intended). I found it hard to write the script because I wasn't even sure what I had to look for. You never stop learning, thanks. :) It's not my work so I won't change my script but of course you are free to publish it on your own.

7 years ago
Permalink

Comment has been collapsed.

This is literally just one line of code. Feel free to use it. I'm only here to help you learn :)

7 years ago
Permalink

Comment has been collapsed.

thanks, i didn't want to create a greasyfork account to dl. ^^

7 years ago
Permalink

Comment has been collapsed.

Did it change? It requires an account now to download?

7 years ago
Permalink

Comment has been collapsed.

still seems to require an account yeah.

View attached image.
7 years ago
Permalink

Comment has been collapsed.

Well that sucks. Time to migrate to github, I guess.

7 years ago
Permalink

Comment has been collapsed.

wait no, yours are fine. it turns out vonRaven submitted it as mature content on accident is all. mature content requires an account, but your greasyfork pages are fine.

7 years ago
Permalink

Comment has been collapsed.

Ah ok. That makes sense.

7 years ago
Permalink

Comment has been collapsed.

Mature userscripts? Oh my I wonder what those are -- dat sexy code. xD

7 years ago
Permalink

Comment has been collapsed.

Aw, didn't know about this or I would have offered another way. Thanks for the heads-up.

7 years ago
Permalink

Comment has been collapsed.

np ^^

7 years ago
Permalink

Comment has been collapsed.

Deleted

This comment was deleted 3 years ago.

7 years ago
Permalink

Comment has been collapsed.

I'm not even sure how he did it, because the only options I get to create a script are public, unlisted or library. No private.

7 years ago
Permalink

Comment has been collapsed.

I think I found the issue: When I published the script I saw a section about "mature content" and skipped it because usually it's opt-in but it's opt-out on Greasyfork. I have changed it now but it seems like a moderator needs to validate it first. Well, now I know better for the next time.

7 years ago*
Permalink

Comment has been collapsed.

Isn't it easier to include http://store.steampowered.com/*? I don't think the store is offered on HTTPS, at least not for me.

7 years ago
Permalink

Comment has been collapsed.

Use can use https.

7 years ago
Permalink

Comment has been collapsed.

You can also replace the URL without reloading the page at all:

if (window.location.search.length > 0) {
    window.history.pushState(null, null, window.location.href.replace(window.location.search, ""));
}

Thanks Royal for making me aware of window.location.search. I didn't know about it, could come very in handy. :)

7 years ago
Permalink

Comment has been collapsed.

I will test this later, thanks!

7 years ago
Permalink

Comment has been collapsed.

I used window.history.pushState in my scripts without problem.

You can also use @match to read easier

// @match *://store.steampowered.com/*
7 years ago*
Permalink

Comment has been collapsed.

Works great, kudos. :-)

7 years ago
Permalink

Comment has been collapsed.

Good deal. Vielen Dank.

7 years ago
Permalink

Comment has been collapsed.

taking a mix of all of the above for my use.. so many suggestions ^^

in case anyone wants the mix i'm using. (credit goes to all the other people here other then me, mostly ofc vonRaven)

// ==UserScript==
// @name        Steam Store - URL Cleaner
// @namespace   Steam Store - URL Cleaner
// @description Cleans the URL for Steam Store pages
// @version     1.0
// @grant       none
// @run-at      document-start
// @match *://store.steampowered.com/*
// ==/UserScript==

if (window.location.search.length > 0) {
    window.history.pushState(null, null, window.location.href.replace(window.location.search, ""));
}
7 years ago
Permalink

Comment has been collapsed.

Sign in through Steam to add a comment.