Jump to content

User talk:Jeeputer/coordInserter

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Fixing issue

[edit]

@Suntooooth: Hi, let's follow the discussion here. I use the legacy vector too, and it works fine for me on both of those articles. On ¡Cu-Cut! incident you should get a notification on which you have to click to get the template copied to the clipboard. On Ahsham-e Sartal, the template should be placed correctly. I need some info to understand the issue. First, please check if coordInserter=1 is present in the URL after the page is opened in a new tab. Secondly, please open your browser's console (Windows: Ctrl+⇧ Shift+i) and check if you can find any errors related to this script. Maybe it's due to incompatibility with another script you have installed. Thanks. Jeeputer Talk 20:26, 4 September 2024 (UTC)[reply]

"coordInserter=1" is in the URL, and I can't see any console log messages that mention this script. Suntooooth, it/he (talk/contribs) 20:39, 4 September 2024 (UTC)[reply]
I've just tried on my alt, without any other scripts and on a different browser (Chrome rather than Firefox), and it's the same - coordInserter is in the URL, there's no errors relating to the script in the browser console, but nothing happens. It's very strange. Suntooooth, it/he (talk/contribs) 20:53, 4 September 2024 (UTC)[reply]
@Jeeputer The problem is that the mw.config.get call returns null in the edit screen.

Currently, ithedit mode, this variable inoset. Sephab:T185437.
— mw:Manual:Interface/JavaScript#Page specific (Wikibase extension)

Aaron Liu (talk) 21:06, 4 September 2024 (UTC)[reply]
Huh, looking at the subscribing logs, I apparently tried to do something with this in February but I can't recall ever doing that... Aaron Liu (talk) 21:09, 4 September 2024 (UTC)[reply]
Out of curiosity, why the random bold formatting? :P Suntooooth, it/he (talk/contribs) 21:09, 4 September 2024 (UTC)[reply]
I have Bionic Reader installed. I was also somehow too lazy to manually link the text, so I pasted it and clicked on ConvenientDiscussions's handy "convert rich text to wikitext" button. Aaron Liu (talk) 21:54, 4 September 2024 (UTC)[reply]
@Aaron Liu: I see! But why is it available to me? lol
I will look for a workaround. Thanks for letting me know. Jeeputer Talk 21:14, 4 September 2024 (UTC)[reply]
It works under the editing tab for you‽
If you're interested, you could run an instance of MediaWiki and see if adding the hook mentioned in the task works. Aaron Liu (talk) 21:53, 4 September 2024 (UTC)[reply]
@Aaron Liu: Yes and that's why I thought the script is ready to use. I also made some edits to pages using this script. I wish Special:Diff/1244070481 kills the bug. Jeeputer Talk 21:57, 4 September 2024 (UTC)[reply]
Yep, it works! :] Suntooooth, it/he (talk/contribs) 22:00, 4 September 2024 (UTC)[reply]
@Suntooooth: Great! Have a good time using it. :) Jeeputer Talk 22:01, 4 September 2024 (UTC)[reply]
@Aaron Liu: I am not a programmer. Actually, I'm an artist interested in Javascript (and only Javascript) as a hobby and my programming activity is limited to Wikimedia projects. So I don't know what a hook is lol. Jeeputer Talk 22:00, 4 September 2024 (UTC)[reply]
Good for you. I don't program in PHP, the language that MediaWiki uses, either.
A hook is a function that is called ("fired") when a specific event happens. Aaron Liu (talk) 22:03, 4 September 2024 (UTC)[reply]
I'll add the script to the next WP:S++ edition soon. This ES5 script is pretty good, though I do feel like some sort of error handling should be added to the $.get call. Aaron Liu (talk) 22:06, 4 September 2024 (UTC)[reply]
@Aaron Liu: Thank you. I will work further to improve this script. Error handling is the next step. Jeeputer Talk 22:27, 4 September 2024 (UTC)[reply]

Feature request

[edit]

After using the script a bit tonight, my main feedback is:

  1. If the template is inserted, the script should also remove the {{coord missing}} template that generates Category:Articles missing coordinates with coordinates on Wikidata in the first place, since it's very easy to forget to remove it.
  2. It would be nice if the edit summary was also automatically changed if there's no coordinates parameter and the template is copied to clipboard.

Thanks so much for all your work on this script! :] Suntooooth, it/he (talk/contribs) 00:16, 5 September 2024 (UTC)[reply]

@Suntooooth: coordInserter now removes {{coord missing}} (or any of its redirects) from the page. The summary will be set when a "paste" event happens, but it does not unset the summary if you revert your paste (e.g. using Ctrl+Z) or manually remove the pasted text. So, for example, if you paste the template, then remove it and make minor typo fixing and then save the page, your edit will be saved with the summary filled by the script. It also doesn't remove {{coord missing}} when pasting, just to make sure it doesn't get removed without inserting the coord template, but it throws a notification which reminds you to remove the coord missing template. Is it good enough? Do you have any ideas to improve these new features? Jeeputer Talk 04:29, 7 September 2024 (UTC)[reply]
  1. The summary setting on paste doesn't seem to be working - no summary is set for me.
  2. Removing {{coord missing}} works fine in a lot of cases (example diff), but if there's a comment that mentions the coord template (which is fairly common, since some infoboxes have a comment about it in their examples) then the script sees that as being {{coord missing}} and removes it, without removing the actual thing it's meant to be removing (example diff).
Suntooooth, it/he (talk/contribs) 07:55, 7 September 2024 (UTC)[reply]