Comment gadget

Jump to navigation Jump to search

Append at the end would be just fine.

LA2 (talk)19:21, 24 February 2013

Okay, here's my attempt: User:Yair rand/addcomment.js. It's still very buggy in a number of ways: The Preview button doesn't always work quite right (sometimes not giving an accurate preview), there is no "Cancel" button for add comment, it doesn't handle edit conflicts, and the "comment" button is at the top of a section instead of the bottom, among other issues.

Yair rand (talk)21:57, 26 February 2013

Excellent! I got it to work at the Beer Parlour. I also tried to cross-import it to sv.wikipedia (sv:w:User:LA2/common.js) but that didn't work.

LA2 (talk)23:24, 3 March 2013

That's because it relies on the newNode function in Mediawiki:Common.js.

Yair rand (talk)23:55, 3 March 2013

Copying that function seems a reasonable burden. :) It would be nice if you could format the script as a gadget and add a couple lines of instructions to install it on any other wiki: I'd then copy them on some mw: page and link from the pages of other (abandoned) systems.

Nemo08:43, 4 March 2013

What does it mean exactly to "format [a] script as a gadget"?

Yair rand (talk)06:30, 6 March 2013
 
 
 

I found a bug: the script directly uses "/w/api.php", and that doesn't work in wikis where the script path isn't "w". Please change it to use wgScriptPath. Btw, I assume wgEnableWriteAPI is also needed, so that could be an "early exit" test.

Waldir (talk)09:08, 4 March 2013

Done.

Yair rand (talk)21:19, 4 March 2013

Great, thanks! It's working now :) One question: the preview doesn't seem to apply indentation, but after saving the comment is properly indented. Would it be possible to also have the indentation show in the preview? Also, the "Assisted" link should probably use the wikipedia:wikt: prefix to make sure it works in other wikis (including non-WMF ones).

Waldir (talk)05:51, 5 March 2013

Hmmm, that probably wouldn't work very well. If I understand correctly "wikipedia:wikt:" only directs to the English Wiktionary from English-language projects that are not Wikipedia itself. I don't know of any set of interwiki prefixes that would reliably lead to the correct page.

Re the indentation: Usage of "*" complicates this somewhat. The preview would need to be done in isolation, but some indentation doesn't look the same if it's preceded by other indented content. Example:

  • Lorem
    • Ipsum

shows one dot before the second word, whereas

    • Ipsum

alone shows two. I still haven't thought of a solution to this issue.

Yair rand (talk)06:29, 6 March 2013

It is tempting to make a perfect solution, but this might be overkill. Often I need this tool when I only have my phone at hand. Later, when I'm back at my laptop, I can correct any minor errors by full editing.

LA2 (talk)13:17, 6 March 2013
 

Actually, it seems one can use directly the "wiktionary" prefix, which links to the English Wiktionary (check here for mediawiki's default values, and here for a non-English WMF wiki with a customized interwiki map).

Regarding the indentation, how about indenting the text box as much as the last comment, in order to discourage usage of constructs such as **, :*, etc? The indentation in the preview seems to be working well already; I'll let you know if I come across any edge cases.

Finally, appending a warning under the text box --say, right after the cancel button-- when a signature is added (3 to 5 tildes) would be a nice touch, like LQT already does.

Waldir (talk)17:22, 7 March 2013