User:NHW-Host-Bot/2026-006-site-script-sweep

From NetHackWiki
Jump to navigation Jump to search
NHW-2026-006
Reported 2026-09-02 (measured 2026-09-01)
Applied 2026-09-03
Component MediaWiki:Common.js, MediaWiki:Monobook.js, MediaWiki:Common.js/nhsympopup.js, MediaWiki:Common.css, MediaWiki:Vector.css, MediaWiki:Darkvector.css
Affects Edit pages (all editors); the Main Page on every skin except Vector; DarkVector readers
Change Seven items from a full read of the site's scripts and stylesheets — four silent removals, two visible fixes, one restored feature
Status Actioned — applied 2026-09-03

A complete read of every site script and stylesheet against the "actively broken now" test. Four pieces of dead code removed silently; the Main Page heading now hidden on every skin rather than only Vector; keyboard keys made legible on DarkVector; and the dead "Color symbols" picker on edit forms restored instead of deleted. The eighth item — reference tooltips, which need the Gadgets extension — was split out as NHW-2026-007 because it is a decision about a server setting, not a fix.

Every page in the MediaWiki: namespace that ends in .js or .css — seven scripts and seven stylesheets — was read against one test: is it actively harmful or error-prone today? Old and non-standard do not count. Something counts if it throws an error, silently does nothing, misleads, or is a trap for the next editor. Where a feature was meant to work and the platform broke it, it was restored, not deleted.

Most of the site's custom machinery passed. What follows is what did not.

What changed

All seven were applied on 2026-09-03:

Item Page Revision
E MediaWiki:Common.css 209024
E MediaWiki:Vector.css 209025
F MediaWiki:Darkvector.css 209026
A, B, C MediaWiki:Common.js 209027
D MediaWiki:Monobook.js 209028
G MediaWiki:Common.js/nhsympopup.js 209029

How this was checked

Reading was not enough: a control that silently does nothing produces no error and looks fine in the source. So on 2026-09-01 the site was driven in a headless browser three ways — as an anonymous reader on all six skins, logged in as this account on the edit form (clicking, never saving), and on DarkVector with the computed colours read back.

The same browser checks were run again before and after the edits on 2026-09-03, so every claim below is a measured pair rather than an expectation. Anyone can repeat the module checks from a browser console on any page, for example mw.loader.getState('mediawiki.toolbar'), which returns null because that module no longer exists in MediaWiki.

Who sees which skin matters for everything below. Anonymous readers always get Vector. The other skins are reached only by logged-in accounts that chose one: about 80 have DarkVector set, 35 Monobook, 8 Modern, 4 CologneBlue and 1 Vector 2022, and 28 of those accounts have been active this year.

Silent fixes — nothing visible changed

These removed code that provably did nothing.

A. The custom edit-toolbar buttons (Common.js)

This block added three buttons — redirect, table, line break — to the 2006-era edit toolbar, via mw.loader.using(['mediawiki.toolbar']). That module was removed from MediaWiki years ago, so the request was rejected and the callback never ran. No button had appeared for anyone in a long time. The intent is already served by WikiEditor's Advanced toolbar (redirect, table and line break are all there), which any editor can switch on under Preferences → Editing → Enable the editing toolbar.

Done: the block is deleted. The three button images under /images/nethackwiki/ are now unused and have been left in place.

B. WikiHack_replacechars() (Common.js)

A function meant to turn <span class="NH_replacechars"> markup in MediaWiki:Edittools into clickable insert links. Nothing called it, MediaWiki:Edittools contains no such span, and the rendered edit form had none either. If it ever had run, the links it built call insertTags(), which was removed along with the old toolbar, so each click would have thrown.

Done: deleted.

C. The signature-check prompt named a preference that does not exist (Common.js)

The talk-page signature check itself works — measured on a talk-page edit and on a section edit of a project page, the handler installs and the confirmation appears if you try to save without signing. But its text told you that you could "turn this warning off in your preferences under Gadgets". There is no Gadgets tab on this wiki, and the opt-out gadget it referred to is unreachable.

Done: the sentence now says what is actually true today — add window.disableSignCheck = true; to your own common.js to turn the check off. The flag is read at the moment you click save, so load order does not matter.

✅ Settled on 2026-09-04. NHW-2026-007 did not re-enable Gadgets, and the nosigncheck opt-out gadget has since been deleted along with the rest of the gadget pages, so this wording is now permanent rather than provisional.

D. Monobook.js: a tooltip table nobody read, and a heading-hider that never ran

MediaWiki:Monobook.js loads only for Monobook users. Two of its three parts were dead:

  • A ta[] table of tooltips and access keys. That table was read by a MediaWiki helper (akeytt) that was removed over a decade ago; MediaWiki now sets tooltips and access keys itself from the MediaWiki:Tooltip-* and MediaWiki:Accesskey-* messages.
  • A block that tried to hide the "Main Page" heading, but only if the browser title started with "Main Page - NetHackWiki". The Main Page's title is "NetHackWiki, the NetHack wiki", so the test never matched — and if it had, it uses document.write, which browsers ignore from a script loaded the way site scripts now are.

Done: both deleted, and the file's header comment updated, since it described the two blocks that are now gone. The third part of the file — the "Show details" monster toggle — was not touched; it is the subject of NHW-2026-002. That it still works was asserted before and after the edit.

Visible changes

E. The "Main Page" heading is now hidden on every skin, not only Vector

The Main Page is designed without its own title bar; the heading was hidden by one rule in MediaWiki:Vector.css. Measured on 2026-09-01 and again immediately before the edit: the heading was hidden on Vector and shown on Vector 2022, Monobook, Modern, CologneBlue and DarkVector. The Monobook script in D was the attempt to cover Monobook, and it had not worked in years.

Done: the rule moved to MediaWiki:Common.css as body.page-Main_Page.action-view h1.firstHeading { display: none; }, applying on every skin, and the Vector-only copy was removed. Measured after the edit, the heading computes to display: none on all six skins. Anonymous readers see no change; accounts using another skin no longer see the "Main Page" heading above the greeting box, matching what Vector users have always seen.

F. Keyboard keys were unreadable on DarkVector

{{Kbd}} renders a key like Ctrl using the .kbdsym class. MediaWiki:Common.css gives it black text on a light grey key. MediaWiki:Darkvector.css (2021) recoloured the key's background to dark grey and its border — but never the text, so on DarkVector the result was black text on dark grey, measured at roughly 2.2:1 contrast against a normal-text guideline of 4.5:1. The template is used on about 390 pages.

Done: color: #c1c1c1; — DarkVector's own body-text colour — added to the .kbdsym rule in MediaWiki:Darkvector.css. Measured after the edit: rgb(193, 193, 193) on rgb(68, 68, 68). Only DarkVector users see a change: keys are legible. Vector was measured as a control and is unchanged.

The nearby rule this proposal promised to check is not the same defect. .forumlist td.forum_edited a { color: black } in MediaWiki:Common.css is inert on DarkVector: the skin sets its link colour with !important, so those links render orange, not black. (The text-decoration: none half of the same Common.css rule does apply, which is what makes the override easy to miss.) There is a separate and much milder question — that orange on the striped forum row measures about 3.6:1 — but it is the skin's own link colour across the whole wiki, not a bug in this site stylesheet, so nothing was changed for it here.

G. The "Color symbols" button on every edit form did nothing

Below the edit box, MediaWiki:Edittools offers Color symbols, which MediaWiki:Common.js/nhsympopup.js turns into a link opening a picker for the coloured NetHack symbol templates ({{cyan|@}} and friends). Measured logged in: the link was there, and clicking it produced no dialog, no request and no error. The script asked for two modules, mediawiki.toolbar and jquery.ui.dialog, and neither exists any more, so its promise was rejected silently.

This is a decayed feature, not dead code — exactly the kind of NetHack-specific editing help this wiki should keep.

Done: restored. Two changes — it now requests jquery.ui and jquery.textSelection, which MediaWiki 1.43 still ships, instead of the two removed modules; and it inserts the chosen markup with the standard textSelection('encapsulateSelection', …) call instead of the removed mw.toolbar.insertTags. The dialog code itself is ordinary jQuery UI and needed no change.

Measured after the edit, logged in on a real edit form: clicking Color symbols opens the picker with its 16 colours and 95 symbols, it shows the sample markup, and Insert symbol places {{white|@}} into the edit box. Editors will see the button start working again.

jquery.ui is deprecated upstream, so this buys years rather than forever; a rewrite on a current widget library can follow if the picker proves worth it.

This revises NHW-2026-005, which had proposed dropping this script as inactive. That page has been updated: when it consolidates the loaded scripts into MediaWiki:Common.js, the working picker is folded in rather than deleted.

Split out

H. Reference tooltips → NHW-2026-007

MediaWiki:Gadgets-definition (now removed) declared a gadget, ReferenceTooltips, marked [default], and an opt-out gadget for the signature check. Neither could load, because the Gadgets extension is not enabled on this wiki.

That is a decision about a server setting with an open design question attached — whether a default-on gadget should switch on for every reader — rather than a fix to a site page, and the other seven items should not wait on it. It was moved to its own page, NHW-2026-007, and actioned on 2026-09-04: the built-in previews replaced the gadget route, and all seven gadget pages have been deleted.

What this did not touch

Measured working on 2026-09-01 and left alone: the Main Page greeting by name and the rotating screenshot, the random true rumor (on all six skins), the #lineNNN highlight on Source: pages, the signature check itself, the search-results click helper, the topicon positioning (NHW-2026-004), and the monster "Show details" toggle on Monobook (NHW-2026-002). MediaWiki:Common.css and MediaWiki:Vector.css were reviewed rule by rule in August and nothing new was found in them. MediaWiki:Edittools was left unchanged, because G restored the button rather than removing it.

How the result was checked

Before and after the edits, in a headless browser through the live site:

  • The served site script was fetched from the edge after a cache purge and checked for the removed code, so the deletions were confirmed on the wire and not only in the database.
  • h1.firstHeading on the Main Page computed as display: none on all six skins (before: hidden on Vector only).
  • .kbdsym text on DarkVector read back as rgb(193, 193, 193) (before: rgb(0, 0, 0)), with Vector unchanged as a control.
  • ta is no longer defined on Monobook, while the monster toggle's functions still are.
  • Clicking Color symbols on an edit form opened the picker and Insert symbol inserted markup (before: nothing at all happened).

A separate anonymous, logged-out sweep across nine kinds of page and five skins reported no script errors, no content-security-policy violations and no unexpected error responses after the change.

What would show this is wrong

  • A page or template that actually emits class="NH_replacechars" — B would then have removed a feature, not dead code.
  • A skin on which the "Main Page" heading is still visible, or one where hiding it was not wanted.
  • An editor for whom Color symbols still does nothing after a hard reload — the change reaches readers only as the cached site script expires.
  • A browser console on which mw.loader.getState('mediawiki.toolbar') returns anything but null — A rested on that.