MediaWiki talk:Gadget-CommentsInLocalTime.js

Latest comment: 3 years ago by Ritchie333 in topic Fix for incompatibility with DiscussionTools

Import for changes

edit

{{editprotected}}

Similar to other scripts like Friendly at MediaWiki:Gadget-Friendly.js, please replace this script's page with the following code:

importScript('User:Gary King/localize comments.js');

Sometimes, minor tweaks need to be made and so this allows me to make them immediately when responding to queries. Right now, I use the Gadget version of the script so I am immediately aware of any problems that come up with the script, and if I can update the script and see the script update immediately, then it helps immensely with debugging the script. Gary King (talk) 20:35, 25 January 2009 (UTC)Reply

  Done Oren0 (talk) 21:00, 25 January 2009 (UTC)Reply

{{editprotected}}

Please change the script's name from User:Gary King/localize comments.js to User:Gary King/comments in local time.js. I have already moved the actual script, and redirected the old page to the new one. Gary King (talk) 20:04, 26 January 2009 (UTC)Reply

  Done — {{Nihiltres|talk|log}} 00:24, 27 January 2009 (UTC)Reply

User Gary was renamed

edit

Please change the importScript call to importScript('User:Gary/comments in local time.js');, for the same reason currently being discussed at WP:Village pump (technical)#Why doesn't it leave redirects from .js pages on rename?. --SoledadKabocha (talk) 02:30, 21 February 2014 (UTC)Reply

  DoneMr. Stradivarius ♪ talk ♪ 04:17, 21 February 2014 (UTC)Reply

Interface-protected edit request on 23 January 2020 - copy the code from User:Gary/comments_in_local_time.js and paste it here

edit

I don't understand why it is being loaded from User:Gary/comments_in_local_time.js. This gadget is widely used by local and crosswiki users. If Gary wants to modify their script, he should submit an edit request instead. We have enough interface admins here to take care of edit requests. I am also worried about its users security, Gary can change the script at any time and and move it to somewhere else. Also if his account is renamed the hotlinking would break because their user subpages will be automatically moved by a global renamer. It already happened in the past as you can see. Also ResourceLoader modules are automatically minifed along with other features to provide better performance. Masum Reza📞 07:32, 23 January 2020 (UTC)Reply

Same rationale applies for MediaWiki:Gadget-wikEdDiff.js. The main reason I am asking is for performance improvements and less data costs. As I said ResourceLoader minifies the code. Masum Reza📞 07:45, 23 January 2020 (UTC)Reply

@Gary: are you ok with this? You don't seem to be updating the gadget very often. Masum Reza📞 07:52, 23 January 2020 (UTC)Reply

Some discussion at Wikipedia:Interface_administrators'_noticeboard/Archive_1#Gadgets_sourcing_user_scripts. I've regretted not re-starting that, been busy. ~ Amory (utc) 11:06, 23 January 2020 (UTC)Reply
Sure, the original code can be copied to this page. The code won't be changed much. Gary (talk · scripts) 20:55, 23 January 2020 (UTC)Reply
I don't think this edit request is actionable as such. User:Gary/comments_in_local_time.js contains some ES6 code such as arrow functions and backquote strings, which cannot not be parsed by the ResourceLoader. See phab:T75714. SD0001 (talk) 23:30, 23 January 2020 (UTC)Reply
Damn, that sucks. I don't want to go through the code and revert the changes I made to bring it into the modern JavaScript era. So I'll just wait for this issue to be fixed globally, to ResourceLoader, or someone else can update this script, if they want. Gary (talk · scripts) 01:10, 24 January 2020 (UTC)Reply
You can always choose to use something like babel to automatically bring it down to ES5. SD0001 (talk) 09:36, 24 January 2020 (UTC)Reply
I don't want to transpile the code. I originally wrote it in CoffeeScript, then transpiled to JavaScript. But admins edited the code when something broke. So then the transpiled JS code was out of sync with the original CS code. The same would happen if I transpiled with Babel. So I only want one version of the code to exist. Gary (talk · scripts) 18:48, 24 January 2020 (UTC)Reply
  Not done (not yet) @Masumrezarock100: I agree we should not be loading userspace code to the gadget, however it doesn't appear that a final solution is yet ready to deploy - reactivate the edit request when it is. — xaosflux Talk 14:30, 31 January 2020 (UTC)Reply
Only just returning to this, sorry, but @Xaosflux and Gary: what about loading a specific oldid of the userpage? That way, if something happens to Gary, a malicious editor wouldn't be able to change the code. It would still mean filing an edit request whenever you update the code, Gary, but you've said you wouldn't mind. It does mean an intadmin should review the code changes, but then again we should anyway... If there's no opposition I'll do it today or tomorrow. ~ Amory (utc) 11:46, 3 February 2020 (UTC)Reply
@Amorymeltzer: I much prefer the "promote to production" process of just "copy the code to the gadget page", gadgets are meant to be community-maintained after all. — xaosflux Talk 12:24, 3 February 2020 (UTC)Reply
Mais oui, but in the absence of a full-measure, half a loaf is better than none. ~ Amory (utc) 14:28, 3 February 2020 (UTC)Reply

Fix for incompatibility with DiscussionTools

edit

Pinging author @Gary.

Please sync with User:SD0001/comments in local time.js (compare). This fixes a major issue with this gadget that was reported on VPT (Wikipedia:Village pump (technical)#Option to change time from UTC to local timezone stops working) – all comments go back to being in UTC time whenever the new DiscussionTools beta feature is used to reply to a comment (because discussionTools uses an AJAX reload).

Also reported on User talk:Gary/comments in local time.js#The script isn't compatible with page-updating user scripts by @Jack who built the house. – SD0001 (talk) 11:00, 1 April 2021 (UTC)Reply

@Gary: I'd much prefer to just import this to the primary gadget, instead of it being an import of your personal script (nothing would stop you from using your own script) - any concerns here? — xaosflux Talk 13:13, 1 April 2021 (UTC)Reply
Directly putting the code in the gadget page will not work because this is written in ES6 which the ResourceLoader doesn't support. – SD0001 (talk) 13:49, 1 April 2021 (UTC)Reply
I've got no problems with any of the suggested changes, from both this thread and the linked thread, from being made. I just don't have the time to fix all bugs that might arise, etc. I'm not familiar with the new JavaScript hooks that now exist. So I'll let the community make any necessary changes to the script as needed. Gary (talk · scripts) 14:52, 1 April 2021 (UTC)Reply
  Done @SD0001 and Gary:{ I've synced this in to close the ER; would still prefer someone converts this in to an actual gadget though if anyone is up for it. — xaosflux Talk 14:43, 6 April 2021 (UTC)Reply
  Undone this seems to have had some breaking impact - see Wikipedia:Village_pump_(technical)#Editing_a_talk_page_blanks_the_entire_discussion. — xaosflux Talk 15:33, 6 April 2021 (UTC)Reply
Further fixes to this gadget should likely be by a rewrite that will allow this to be a native gadget. — xaosflux Talk 15:37, 6 April 2021 (UTC)Reply
Huh what? This is a gadget that merely changes the way timestamps are displayed, and has nothing whatsoever to do with editing of pages. It's extremely unlikely the changes here had anything to do with the VPT thread. FWIW the modified version has been in my common.js for the past 5 days and I didn't face any issues. – SD0001 (talk) 17:03, 6 April 2021 (UTC)Reply
@SD0001: possible collision with something else? If Gary wants to do whatever with this it is up to him since it is a personal page, but only if we de-list it from the gadgets page and make him directly responsible I suppose? — xaosflux Talk 22:43, 6 April 2021 (UTC)Reply
SD0001, I think the problem might have been if ($content[0].querySelector('.localcomments')) { return; } When I was running into the problem I noticed there was a <span> tag with a class "localcomments". Or at least, I think that's the case, since the code was reverted, I get a <textarea> tag as expected. Ritchie333 (talk) (cont) 11:04, 7 April 2021 (UTC)Reply

Integration into MediaWiki

edit


It looks like phab:T240360 is the task for making CommentsInLocalTime part of mediawiki (as part of DiscussionTools extension). – SD0001 (talk) 16:29, 3 April 2021 (UTC)Reply