Total noob looking for (hopefully) simple greasemonkey script
I have knowledge of the basic concepts of programming in general and html and some very basic knowledge of javascript, but this specific task is proving a little beyond me. I'm actually using...
I have knowledge of the basic concepts of programming in general and html and some very basic knowledge of javascript, but this specific task is proving a little beyond me. I'm actually using tampermonkey, in case that matters.
www.bricklink.com is a site to buy Lego from private sellers. By default, when looking at a shop's listing of items, it shows 25 per page. I would like to automatically switch to 100 per page every time.
Here's a randomly selected store page (no affiliation) at the default 25 per page:
https://store.bricklink.com/TheBricky#/shop?o={"itemType":"P","catID":"18","showHomeItems":0}
Now, same page set to display 100 per page. Note how "pgSize" is added to the url but doesn't appear by default:
What I would like is for pgSize to be set to 100 only IF
"shop" appears in the url
AND
"pgSize" does not appear in the url OR "pgSize" does appear in the url but does not equal 100.
Since Bricklink remembers pgSize per shop page per session, once pgSize is set to 100 for a particular shop greasemonkey doesn't need to do anything. Intercepting the url before the page loads would be nice but unnecessary since loading is fast and I'm not worried about bandwidth.
I tried making this but wasn't sure how to input what I'm trying to test for in the url. Of course now that I've thought about it some more it seems the task is more probably difficult than I thought it would be at first. Any help would be appreciated.
EDIT: This comment below seems to be working, although the way Bricklink makes their urls feels funky at times.