User:GhostInTheMachine/TalkHelper2

From WikiProjectMed
Jump to navigation Jump to search

GhostInTheMachineTalkAllHelpMiscModulesOtherLayoutPhotosProjectsScriptsTidyingTidyingSDTODOUBXWIP2022-09-29 19:27:32

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:

  • 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.

To provide space in the sidebar, the script also alters the existing sidebar menus so that they can be collapsed.

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

{{subst:Lusc|User:GhostInTheMachine/TalkHelper2.js}}

or this line if you want the latest version

{{subst:Lusc|User:GhostInTheMachine/TalkHelper.js}}

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.

Bugs

2022-07-27

The TH2 script does not work on Wikipedia:Village pump (proposals), but is OK on the other VP pages.

investigating why this is, but it seems that the Wikipedia: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 {{Skip to bottom}} 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 {{Skip to bottom}} template and all was OK again — see Wikipedia: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 Wikipedia:Village pump (WMF)

the {{pp-pc}} 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 phab:T188443
2022-09-29
quick test to remove the {{pp-pc}} from Wikipedia:Village pump (WMF) — confirmed
need to alter TH2 to use the live version of CILT rather than my clone

Possible improvements

  • Also add highlighting for all of my own posts
    • How should posts by me yesterday be highlighted? As by me or as yesterday 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}}?

See also