User:Jack who built the house/Convenient Discussions





Convenient Discussions is a JavaScript tool providing a shell over the existing MediaWiki discussion system that allows the user to post and edit comments without switching to a separate page.

The full set of the script features includes much more:
 * creation of topics and subsections;
 * highlighting and navigating new comments;
 * highlighting own comments;
 * desktop notifications about replies to the user's comments and comments in watched sections on open pages (opt-in);
 * watching sections, which affects notifications and highlighting edits on pages that list revisions;
 * jumping to a specific comment from the watchlist and other pages that list revisions;
 * moving topics between talk pages;
 * autofilling of the edit summary with indication of the addressee of the comment;
 * saving comment drafts to restore the forms content after unexpected events such as browser crashes, accidental jumps to a different page etc.;
 * slightly redesigned discussion threads where it's easier to follow which comment replies to which.

The script makes the user forget about:
 * the need to search the code for a place for a comment, count colons, type tildes and other markup;
 * edit conflicts;
 * reading talk pages through diffs;
 * the need to completely reload the page and look for new comments with eyes, or even check the watchlist.

A limitation of the script is that it works only in modern browsers, i.e., doesn't support IE11.

Convenient Discussions is being developed by Jack who built the house since 2017, enriched by the contributions and feedback from the Russian Wikipedia tech community and users. It also borrows the code for parsing timestamps in different formats from Matma Rex and uses solutions and ideas from the Wikimedia engineering and design teams.

Usage
Although a generic version will be available soon, it's best to use versions that are configured to use on particular wikis as every wiki has its own peculiarities which the script can address. Depending on the wiki, they can exist as gadgets or user scripts.

The script is located at User:Jack who built the house/convenientDiscussions.js and can be loaded like this:

You can adjust the script according to your preferences in the settings dialog. It is available at the click of the gear icon which can be found in the "CD" section of the watchlist and in the "Settings" section under any comment form.

The hotkeys can be found at the click of the "?" button under any comment form and on hover over the navigation panel buttons.

Comment background colors

 * Hovered comment
 * Target comment (opened by a link or being jumped to)
 * New comment (a comment is considered new if the page was loaded within 15 minutes since the comment was loaded first time)
 * Own comment

Compatability
To make the script compatible with the script displaying time in the local time zone (en:User:Gary/comments in local time.js), call the latter like this:

FAQ

 * What does "(-)" after the comment text in an edit summary mean?
 * It means that the whole text of the comment is displayed in the edit summary, and there is no more text in the comment other than that is displayed, so no point to open the page if you only want to see the contents of this edit. It's a notation that was used on some old Internet forums.


 * How to change the comment background colors?
 * Add the following code to your personal CSS and change the color values (the CodeEditor linter shows errors, ignore them):


 * The comment links block (Reply/Edit/Thank/...) overlaps a user link, and I can't click it.
 * Make a right click on the block, it will disappear.

Data
Here's what the script stores, why, how, and how to delete the data. Note that you can delete all the data associated with the script in one click, by opening the script settings and pressing the button "Remove all script data" at the bottom. In ruwiki, for historical reasons, the option names use  instead of , and   is used for the watched sections option.

Note that other scripts that you use on wiki pages, as well as side-wide scripts, can have access to this data too.

To execute the code in the "How to delete" column, open the browser's developer tools (done by pressing F12 in most browsers), switch to the "Console" tab, paste the code into the input and press Enter.

Feedback
It's preferrable to post bug reports and proposals on Phabricator under the "convenient-discussions" tag. If you don't have an account there and don't want to create one, post to the talk page.

Development

 * GitHub repository is used to store code.
 * Phabricator tag is used to coordinate efforts. (Post bug reports and proposals there, not at GitHub.)
 * Toolforge has an automatically generated documentation.

Some notes:
 * The main script object is (the modules use the   alias).   is an analog of   for the Convenient Discussions language strings.
 * "Events" in the left panel of the documentation correspond to names used by . For example, to attach a handler to the   event, you need the code
 * To see the message names instead of the messages themselves on a page, add the uselang=qqx parameter to the end of the URL (just like with MediaWiki).

Building
Use:
 * to build the script as a single file for testing in your browser (for example, as a snippet in Chrome DevTools).
 * to build a generic version of the script that should be requested by configuration files specific to the wikis.
 * to build a minified version of the generic version of the script.
 * to build configuration files specific to the wikis.
 * to generate documentation from JSDoc comments.