Comment gadget
Do you mean to have the comment added only to the end of the section (either before the next section header or the end of the page)? Having a script add a comment in the middle of a section, as a reply to a specific comment, would be extremely difficult, but a script that only adds to the end of a section would be fairly simple.
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.
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.
That's because it relies on the newNode
function in Mediawiki:Common.js.
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.
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).
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.
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.
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.