LockOldComments locks the reply box of article and blog comments, whenever the original comment was posted 60 days ago or earlier. The amount of days can be configured if custom JS is enabled on the wiki.
Installation
Customization
Locked comments are marked by the class LockOldComments-locked. This way, their appearance can be customized via CSS. For example, to completely hide the reply box (along with the message in it), you can use:
.LockOldComments-locked [class^="ReplyCreate"] {
display: none;
}
Configuration
There are currently three details that can be configured: Changing the amount of days before the message is locked, displaying a message above the first locked comment in a page, and limiting the namespaces that the script runs on.
Configuration has to be done on the wiki's custom JS page (typically MediaWiki:Common.js). For that, custom JS has to be enabled on the wiki and the code itself has to be submitted for approval after saving it.
The first step of the configuration should be creating the object:
window.lockOldComments = (window.lockOldComments || {});
Then, any of the following lines can be added:
window.lockOldComments.limit = 100;
window.lockOldComments.addNoteAbove = true;
window.lockOldComments.namespaceNumbers = [0];
The first line sets the number of days before locking (the number "100" is an example and can be modified).
The second line tells the script to add a note above the first locked message. By default, that note won't be displayed. When added, the note also has the class LockOldComments-above.
The third line sets the script to only lock comments on the main namespace (0) and not on the user blog namespace (500). Typically these two are the only namespaces that have comments, though some wikis may have comments on custom namespaces (you can view available namespaces on a wiki using an api call, substitute dev.fandom with the name of your wiki).
Known issues
- Users with decent technical knowledge can circumvent the script - this is true for any solution of this sort. However, it is reasonable to assume that most users either won't know how to bypass it or won't bother.
- The script is sensitive to changes Fandom may do in the HTML used for the comments section. If that happens, the script wouldn't work until being adjusted. Please leave a note on the script's talk page if such an issue arises.
Changelog
- April 27, 2021
- Initial release.
- May 2, 2021
- Bug fixing.
- May 4, 2021
- Adding i18n-based messages.
- June 9, 2021
- Adding FandomDesktop support.
- December 5, 2024
- Make namespaces configurable rather than preset