User talk:Mxn/CommentsInLocalTime
Hang
This script hangs on Wikipedia:WikiProject Black Lives Matter in multiple browsers, probably due to something unusual about the participant signatures towards the bottom.
GAN page
WP:GAN has not been loading for me for the past couple of days; commenting out this script fixed it. Perhaps there are too many nominations (timestamps) to convert? I had no issues with other pages. Olivaw-Daneel (talk) 17:19, 27 May 2022 (UTC)
:@Olivaw-Daneel: We finally figured out why the hang occurs and it should be fixed now. Sorry for the inconvenience and delay! Minh Nguyễn 💬 18:07, 24 December 2022 (UTC)
::Thank you! Olivaw-Daneel (talk) 18:19, 24 December 2022 (UTC)
Hanging
The page WP:DRN/V uses 100% CPU forever in Chrome and Firefox (at least on Linux), which is weird because it doesn't contain any comment timestamps! I wonder if the bare list of users at the bottom is the problem. Thparkth (talk) 20:12, 18 November 2022 (UTC)
:I created an edit request to fix this issue here. Thparkth (talk) 22:01, 18 November 2022 (UTC)
Provide a way to re-run
I use a discussions script that can AJAX reload the entire page, and I need a way to run this wonderful script of @Mxn after that, but currently, the script can't be loaded twice. Any ideas? Just having an additional function for re-processing after the initial loading would be enough as the script has separate hooks for the first time and subsequent times.
See also c:User talk:Jack who built the house/Convenient Discussions#Hook for after replying. Aaron Liu (talk) 19:11, 15 April 2024 (UTC)
:@Mxn Any follow-up on this? See the fix Aaron Liu made at c:User talk:Jack who built the house/Convenient Discussions#Hook for after replying. waddie96 ★ (talk) 15:22, 5 January 2025 (UTC)
::@Aaron Liu @Waddie96: Sorry for the delay; I wasn't watching this page very closely. The whole script runs on the wrapTimestamps()
and formatTimestamps()
functions, but they aren't exposed externally. It looks like m:Special:PermanentLink/28055331#L-58 relies on the convenientDiscussions.commentsReady
hook; would it be appropriate for me to add that hook directly to this user script? I'm not particularly familiar with Convenient Discussions (and am kind of intimidated by it). Minh Nguyễn 💬 02:34, 24 January 2025 (UTC)
:::I just need a function exposed to skip parts of the construction that aren't needed and just check for all the timestamps again. CD isn't necessarily the only script that should call for CILT to re-run. Aaron Liu (talk) 03:04, 24 January 2025 (UTC)
::::@Aaron Liu @Waddie96: OK, I've exposed window.LocalComments.wrapTimestamps()
and window.LocalComments.formatTimestamps()
. You can call either function as many times as you need. wrapTimestamps()
is pretty cheap, but if you know the timestamps are already wrapped in <time>
elements, then you can skip right to calling wrapTimestamps()
. Minh Nguyễn 💬 01:00, 26 January 2025 (UTC)
:::::Great, thanks! Aaron Liu (talk) 00:12, 1 February 2025 (UTC)
Moment.js deprecation
@Mxn Thanks again for the wonderful script! According to phab:T392532 which was just sent out via tech news, Moment.js is being pushed for removal and is recommended to replaced with vanilla JS Intl or a new DateFormatter JS module they wrote for this, apparently: wmdoc:mediawiki-core/master/js/module-mediawiki.DateFormatter.html. Aaron Liu (talk) 02:32, 6 May 2025 (UTC)
:@Aaron Liu: Thanks for the heads-up. I've rewritten the user script at User:Mxn/CommentsInLocalTime/sandbox.js. For now, it mostly uses Intl.DateTimeFormat
and Intl.RelativeTimeFormat
directly, but once gerrit:1149440 lands, I'll make DateFormatter
the default, so that the raw formatters will only be called if the user chooses to customize the format options. Minh Nguyễn 💬 09:38, 8 June 2025 (UTC)
:@Amaury @Hidden Lemon @BubbaJoe123456 @Mandarax: I see that you've installed this user script and customized it nontrivially. In preparation for upcoming changes in MediaWiki, I'm forced to rewrite this user script, removing the customization options you've been relying on. Fortunately, the default behavior will more closely match your date formatting preferences, and there's [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#date-time_component_options a more limited set of options] you can use to customize the timestamp or tooltip based on the interface language's normal date formats. If you do need more advanced customization, you can still set any of the formats to a JavaScript function.
:I'd appreciate your help testing this rewrite of the user script. Please temporarily replace any reference to User:Mxn/CommentsInLocalTime in your user script with:
:
:Thanks for your help! Minh Nguyễn 💬 09:51, 8 June 2025 (UTC)