User:Enterprisey/reply-link

A userscript to add a "reply" link after signatures on a discussion page. When you click on the link, a form comes up that lets you type your response without having to go through the edit window first. Posts are auto-indented and auto-signed.

Warning! This script is still being tested and debugged. Bugs are still present. When you use this script, please verify that no other comments have been touched and your reply has been added properly. If there are any problems, please let me know at User talk:Enterprisey/reply-link. This script has a newsletter informing people of important updates; you can sign up at User:Enterprisey/Reply-link updates.

As of September 2021, this script is no longer developed. Its ideas live on in mw:Extension:DiscussionTools, which you can install at under "Discussion tools". So long and thanks for all the fish!

Features

 * Automatically places your reply below other replies to the same comment, if any
 * One-click closing of edit requests
 * Automatically pings the user who wrote the comment to which you're replying (can be turned off)
 * (Almost) always uses correct characters for indentation, even on XfDs

Installation instructions
Hint: It's much easier if you get ScriptInstaller, then navigate to User:Enterprisey/reply-link.js and click "Install" at the top.

However, here's the manual method:
 * 1) Place  on Special:MyPage/common.js or Special:MyPage/skin.js.
 * 2) Press "Publish Changes".
 * 3) When you have pressed "Publish Changes", a message will pop up saying "The document contains errors. Are you sure you want to publish?". Please ignore that message and press "OK", the script will still work anyway.
 * 4) Enjoy!

Usage
When you load any discussion page, "(reply)" links should appear after every signature. When you click on one, it will open a form where you can type your reply to that comment; click the "Reply" button (or use the keyboard shortcut Ctrl-Enter) when you're done. The script will automatically sign and indent your comment.

Options
The reply-link script has a number of options that allow you to customize the script's behavior. To set any of the preferences, follow the following pattern (on a new line in your common.js file):

For example, if I wanted to set the option  to   and the option   to , I would put the following lines somewhere in my common.js:

There are also a few of other options for development and such, like replyLinkDryRun, replyLinkTestMode, and replyLinkTestInstantReply, that are only documented, for now, in the code.

History
In October 2017, I got angry at the dreadful user interface of Wikipedia discussions, and wanted a "reply" button just like Reddit had. While procrastinating other work, I wrote some code to go through all the HTML elements in a page, find the comments, and insert a "reply" link after the signature. I then connected it to some dreadful code to find the corresponding comment in the page's wikitext and some even more dreadful code to insert the new comment on a new line in the wikitext (with the appropriate indentation), and the first version of reply-link was born. I modeled some parts of the interface (the text area and how it was arranged with the buttons) after Flow, actually - the circle of life.

I uploaded the first version to GitHub and Wikipedia in November 2017. It was, as I said, dreadful, but it was already much more convenient than editing wikitext. I kept running into various exciting issues: signatures that used strange link syntax, or user talk pages that had been wrapped in tables or other containers to add style. The regular expression to match signatures grew to a frightening size. The subsystem (and it really was a subsystem!) to locate a comment in wikitext given its HTML version went through a few iterations. At the very beginning, it used Parsoid, but I found the interface unworkable, so I went to some awful regular expression-based stuff that used timestamps. That went through a couple of revisions, then I went back to Parsoid in January 2019 in order to handle replying in a discussion transcluded from another page.

As one could imagine, I constantly found pages, discussions, comments, and signatures that the script couldn't handle. The test suite was never good because I never prioritized it, so I can't say it was ever that robust. Handling the edge cases would've required a simply ridiculous amount of time. However, it performed decently well for what it was.

That is, besides some hilarious mistakes: soon after I'd released the script, I accidentally included my signature, so for 42 hours until I fixed it, everyone signed as me. I also made everyone wait for 5 seconds for no reason (I think that's what that code did, anyway...) until 2019. Also, a highlight: I got to this feature request in 13 minutes.

In October 2019, I had a call with the WMF's Editing team about the design of reply-link and other things. They're wonderful people and cared a lot about the work. DiscussionTools (specifically, the Reply Tool) hit beta on the first set of production Wikipedias in February 2020, and it was really cool! The WMF could put a lot more resources into such a tool than I could, especially around internationalization/localization, which was always a deficient area of the script, and it's very much the sort of tool that you want people working full-time on. In September 2021, I recognized that DiscussionTools was far ahead of reply-link in terms of performance, usability, and robustness and I saw no further reason to continue developing reply-link. I deeply appreciate their hard work, and look forward to where DiscussionTools goes in the future!