Minecraft Wiki

The Minecraft Wiki has moved from Fandom; see the linked discussion page for details.

READ MORE

Minecraft Wiki
Advertisement

Link URL encoding[]

When you click on one of the padlocks, it goes to the intended page correctly. But if the target page is namespaced (they all are) the colon will be encoded to %3A in the URL. This doesn't break anything, unless some userscripts expect an actual colon there, but it just isn't correct. So is it really need to encode the link argument of the mimicIndicator() function with encodeURIComponent()? The values that get encoded are defined by this same script, it's not user input, so I can't see the harm in just removing this encode function call. – Jack McKalling [ Talk Contrib ] 17:43, 3 November 2018 (UTC)

Removing the URL encoding doesn't seem to break the script. However, the href attribute remains urlencoded even if the call is removed. Also, if there are non-ASCII characters in the link, they'll be urlencoded in the attribute as well.
The browser I use (Firefox 63) displays the decoded version of the target page in the bottom left corner in either case. --AttemptToCallNil (report bug, view backtrace) 18:00, 3 November 2018 (UTC)
After a long session of testing and analysing what went wrong, Attempt and I concluded that it does work if we remove the encoding from the URL of the padlock link. So please could someone replace this:
var encodedLink = encodeURIComponent(link.replace(/ /g, "_"));
With:
var encodedLink = link.replace(/ /g, "_");
Please? And also maybe rename that variable then-appropriately, but not very important. Thanks. – Jack McKalling [ Talk Contrib ] 20:59, 3 November 2018 (UTC)
 Done. Is this correct, Jack McKalling?-- Madminecrafter12Orange Glazed TerracottaTalk to meLight Blue Glazed Terracotta 21:44, 3 November 2018 (UTC)
Yep, thanks! It's exactly right, and it works how I intended and tested it. For the record, I used the browser devtools to check whether the script would work, but I can't test if it would break anything anywhere. Theoretically it should very likely not. – Jack McKalling [ Talk Contrib ] 21:47, 3 November 2018 (UTC)
Advertisement