MediaWiki talk:POTY-gallery.js

Creation request

{{Edit request}}

Per the discussions at Commons_talk:Picture_of_the_Year, please create this page with the contents of User:Ingenuity/poty-gallery.js. This script has been thoroughly tested to make sure it won't break anything. Thanks, Ingenuity (talk) 17:34, 19 August 2024 (UTC)

✓ Done Steinsplitter (talk) 10:58, 3 September 2024 (UTC)
@Steinsplitter: could you please change encodeURIComponent on line 438 to encodeURI? Thanks! Ingenuity (talk) 12:51, 3 September 2024 (UTC)
Done. Steinsplitter (talk) 13:13, 3 September 2024 (UTC)
@Steinsplitter: sorry to bother you again! Could you replace the content on line 438 with <img src="${imageUrl}" onclick="window.open('${imageProperties["File:" + candidate.title].url.replaceAll("'", "\\'")}')"> ? Ingenuity (talk) 13:45, 4 September 2024 (UTC)
Done. Steinsplitter (talk) 16:09, 4 September 2024 (UTC)
@Steinsplitter: could you sync this page with the new contents of User:Ingenuity/poty-gallery.js? Hopefully this is the last change that will need to be made. Ingenuity (talk) 18:39, 24 September 2024 (UTC)
✓ Done, though I feel compelled to point out that the current code will not work for all users (it uses async/await which is not supported by all the browsers that MediaWiki supports). --Lucas Werkmeister (talk) 19:34, 25 September 2024 (UTC)
One of my goals for next year is to make voting manually possible, but unfortunately that's not something I have time for this year. Ingenuity (talk) 15:38, 30 September 2024 (UTC)

@Lucas Werkmeister: A couple more bugs have been fixed now, so this needs to by synced with User:Ingenuity/poty-gallery.js again. Thanks. Ingenuity (talk) 15:38, 30 September 2024 (UTC)

✓ Done --Lucas Werkmeister (talk) 18:29, 30 September 2024 (UTC)
@Ingenuity: I’ve also just made some changes of my own to the code (testing them on Commons:Picture of the Year/2023/Gallery/Passeriformes – I hope I didn’t break anything), so please sync your copy from this page before making further changes. (The old code was treating translations from the totally unprotected page Commons:Picture of the Year/i18n.json as trusted HTML. Thank goodness they’re all actually plain text and no attacker noticed this.) Lucas Werkmeister (talk) 19:13, 30 September 2024 (UTC)
Shit, thanks... I meant to request protection for that page but completely forgot. I guess I need a {{whale}} and to be a lot more careful in the future... Ingenuity (talk) 19:21, 30 September 2024 (UTC)
I thought about requesting protection for it myself, but if we’re expecting all the messages to be plain text anyway then I think it’s nicer to try to handle the translations safely and not put barriers in the way of translation ^^ (maybe semiprotection would still be sensible, idk). Lucas Werkmeister (talk) 19:25, 30 September 2024 (UTC)
I've requested semi-protection now, which should probably be sufficient. Ingenuity (talk) 19:40, 30 September 2024 (UTC)

Middle click broken

Hi, clicking on the links and images with middle click (which normally opens in a new tab) does not work, apparently because the script does not create actual links. This breaks basic browser navigation in a very frustrating way. -Ash_Crow (talk) 13:25, 2 October 2024 (UTC)

Ingenuity, could you please look into the issue? Regards, ZI Jony (Talk) 15:31, 2 October 2024 (UTC)
@Ash Crow, when you click either on the image or either on "View file" with left click it already opens both links in a new tab without breaking navigation. So no need for middle click -- Giles Laurent (talk) 15:44, 4 October 2024 (UTC)
I know. I disagree that there is no need though: I can't remove 20+ years of reflexes so easily, so what happens is that I make a middle click by reflex, nothing happens, and I then have to make a left click. Nearly every time I want to open an image on the page, which, as I said above is frustrating. Why does the gadget even add click handlers instead of actual links? Ash_Crow (talk) 10:18, 5 October 2024 (UTC)

Edit request

{{Edit request}}

Please sync this script with User:Ingenuity/poty-gallery.js. Relevant discussion about the changes is at Commons_talk:Picture_of_the_Year. Thanks, Ingenuity (talk) 00:35, 20 August 2025 (UTC)

Diff of changes: Ingenuity (talk) 00:36, 20 August 2025 (UTC)
Steinsplitter, could you please look into this request? Regards, ZI Jony (Talk) 06:10, 20 August 2025 (UTC)
Pinging also Lucas Werkmeister who has helped before and who seems more active these last days -- Giles Laurent (talk) 14:51, 20 August 2025 (UTC)
✓ Done, thanks! I made a few changes to the user script first, let me know if any of them are causing problems. (Also, please be a bit more patient before pinging individual interface admins :) the edit request template / tracking category should work well enough most of the time.) --Lucas Werkmeister (talk) 19:29, 20 August 2025 (UTC)
I've done another bugfix, so this will need to be synced again. Diff: . Thanks, Ingenuity (talk) 00:11, 7 September 2025 (UTC)
✓ Done --Lucas Werkmeister (talk) 19:26, 10 September 2025 (UTC)
And what should hopefully be the last change, switching window.open to <a> to allow middle clicking. Diff: Ingenuity (talk) 21:11, 12 September 2025 (UTC)
@Ingenuity: Are you sure the imageLink, viewFileLink and viewVotesLink are correct? As far as I’m aware, \ isn’t usually an escape character in HTML nor in URLs… would you mind trying a version with encodeURIComponent() instead? (I could try to edit it myself, but I wouldn’t know how to test it.) Lucas Werkmeister (talk) 19:34, 13 September 2025 (UTC)
@Lucas Werkmeister: whoops, you're right, that was leftover from the old code. Should be fixed now. Ingenuity (talk) 20:57, 13 September 2025 (UTC)
✓ Done --Lucas Werkmeister (talk) 15:21, 14 September 2025 (UTC)
@Lucas Werkmeister: and one more bugfix, another small problem with escaping: Ingenuity (talk) 21:20, 15 September 2025 (UTC)
✓ Done --Lucas Werkmeister (talk) 23:01, 15 September 2025 (UTC)