User:GhostInTheMachine/TalkHelper2

Purpose
This script extends TalkHelper to further help when reading a long talk page.

The script does not alter any article but it highlights talk posts so that they are easier to read and provides a table of contents to the new talk posts.

Use
The script hunts for timestamps previously found by the CommentsInLocalTime gadget and selects any that are for yesterday and today.

It then adds a background colour and border around each of the posts.

If any posts were found, the script will: To provide space in the sidebar, the script also alters the existing sidebar menus so that they can be collapsed.
 * add a menu button showing the count - clicking the menu item will scroll to the first post
 * build a table of the posts, sorted into time order, and add this table to the left-hand sidebar.

Prerequisites
This script requires the CommentsInLocalTime gadget.


 * 1) Go to the gadgets tab of your preferences
 * 2) Enable "Change UTC-based times and dates, such as those used in signatures, to be relative to local time"
 * 3) Save

Installing
Add the following line to your common.js file if you want version 2 or this line if you want the latest version

Alternatives
Version 1 of TalkHelper is simpler - it highlights posts from yesterday and today and maybe adds a menu button. It does not alter the sidebar or build a table of contents.

2022-07-27
The TH2 script does not work on Village pump (proposals), but is OK on the other VP pages.
 * investigating why this is, but it seems that the Comments in Local Time gadget is not firing


 * 2022-08-07
 * Cloned a fork of User:Gary/comments in local time.js so I could add debug etc.
 * Sussed — the VP page included the template.
 * The template wraps the Skip to bottom button with a div that has the mw-parser-output class.
 * The CILT script intends to find the article body by looking for the div with the mw-parser-output class, and assumes there should only be one.
 * I removed the template and all was OK again — see Village pump (proposals) change 1102904261 → 1102906240)


 * 2022-08-09
 * Gary altered the CILT gadget to search for the mw-body-content class instead — see User:Gary/comments in local time.js change 1103478700

2022-09-24
Same issue for Village pump (WMF)
 * the was added – the padlock icon is (unnecessarily) wrapped in a div with the mw-parser-output class which causes a similar issue for my CILT clone
 * the mw-parser-output class was added by T188443


 * 2022-09-29
 * quick test to remove the from Village pump (WMF) — confirmed
 * need to alter TH2 to use the live version of CILT rather than my clone

June 2024
Damage due to a series of changes to the HTML created for headings.
 * see and more details in Heading HTML changes

Possible improvements

 * Also add highlighting for all of my own posts
 * How should be highlighted? As  or as  or some hybrid of the two?
 * Maybe split the border and the background to highlight different aspects?
 * Add a lightweight border around all posts?
 * Improve logic for finding the full extent of a post.
 * Embed the awesome User:BrandonXLF/FloatSide to float the sidebar
 * Add a full navigation menu to all highlighted posts
 * Add Infobox Wikipedia user script?