Use Greasemonkey to change URL links within a given domain
I'm new to Greasemonkey (Tampermonkey actually), and I'd like to write a very short script that:
-
Is valid within a given domain (e.g. "mydomain.com")
-
Parses all button-related URL links within the active tab
-
Replaces them as follows :
Original URL link:
[string_1]/[useful_part]?[string_2]
To be replaced with:
[replacement_1]/[useful_part]
So everything after the "?" can be discarded, including the "?" itself.
More specifically, URL links are as follows:
http://127.0.0.1:6878/webui/player/[useful_part]?autoplay=true
So string 1 = "https://ift.tt/JuzOUHN" and string 2 = "autoplay=true"
I've seen a similar question here: Rewrite parts of links using Greasemonkey and FireFox
But I'm not good enough at RegEx, so I couldn't adapt the script to my own needs.
I've also looked for Firefox extensions, but the available extensions don't seem to allow the level of text replacement that I'm seeking.
Comments
Post a Comment