MediaWiki talk:Gadget-PrettyLog.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Archives
Conversations older than 7 days will be archived automatically.

Problem[edit]

{{Editprotected}} The gadget won't load on RTL languages. Can someone please add support to RTL?--Épine (talk) 01:33, 23 April 2018 (UTC)[reply]

@Épine: Can you be more concrete. The gadget works for me on Chrome and FF also on RTL. -- User: Perhelion 16:14, 18 July 2018 (UTC)[reply]
@Perhelion: it just didn’t load on ckb wiki, so I had to completely shut it off. If you want to experiment in our wiki to see what the problem is let me know. Thanks.--Épine (talk) 17:06, 18 July 2018 (UTC)[reply]
@Épine: I found the problem. The tool uses the Commons own formated CSS class "mw-search-results". But the rest works for me on your Wiki (you need mediawiki.util loaded). -- User: Perhelion 18:34, 18 July 2018 (UTC)[reply]
So, can you edit the code so it works in our wiki as well?--Épine (talk) 22:26, 18 July 2018 (UTC)[reply]
@Épine: ✓ Done you can now import the Commons version per mw.loader.load. -- User: Perhelion 23:46, 18 July 2018 (UTC)[reply]

Performance improvement[edit]

{{Edit request}} Can someone please deploy this minor change ? This ensures that not all 50+ images on the page will be requested at once with the thumbnail server, which will reduce the 429 rate limiting to kick in and leaving you with a bunch of unloaded images if the thumbnailer did not yet have the ready to serve just yet. —TheDJ (talkcontribs) 20:36, 17 October 2023 (UTC)[reply]

@TheDJ: Good idea and ✓ Done for now, but is there a reason to use img.setAttribute( 'loading', 'lazy' ); rather than img.loading = 'lazy';? I would assume that browsers added support for the attribute on the img tag and the property on the HTMLImageElement interface at the same time, and in browsers without support, it would just be a no-op in basically the same way.
I also implemented automatic retrying of thumbnail errors in one of my tools a while back (commit), if you have any thoughts on whether that would be useful to include? (But I’m also happy to just add loading=lazy for now.) Lucas Werkmeister (talk) 18:55, 18 October 2023 (UTC)[reply]
it doesn't really matter. setAttribute can basically never fail, whereas props theoretically can fail. But in this case, it's mostly because i copy pasted the line from another script :D What does matter is the position. it should always be before you set the .src. Wrt retry... I don't think its really needed, lazy loading is pretty reliable as long as you don't put 25+ items on your screen all at once. While theoretically that could be possible here... I'd say a 'give up on this image after x retries' is definitely needed for some situations, as 429's also get thrown for thumbnails that cannot be generated. Infinitely retrying those requests if someone keeps their page open for 10 days seems like a potential problem to me. —TheDJ (talkcontribs) 20:02, 18 October 2023 (UTC)[reply]
Alright, then let’s leave it as it is. Lucas Werkmeister (talk) 20:53, 18 October 2023 (UTC)[reply]