dblmiddleedit is a mediawiki gadget to open the wiki editor at the position one selects with a double-click of the mouse wheel, anywhere in the text of a page.
I wrote it (with Claude) for the small but relentless tax one pays for every little typo: you spot it while reading, you click edit on the section, and then you have to hunt through the wikitext for a sentence which looks nothing like what was on the screen. For very long texts (and I'm the type of writing those), even finding the nearest [Edit] button can become arduous. This gadget does the hunting.
Double-click the middle button—the wheel—in the text. That is the whole interface.
The wheel rather than the left button is deliberate. A left double-click selects a word, and a cursor sitting inside a highlighted range is not a position one can read precisely. The middle button selects nothing, so the position is clean. Browsers have no native double middle-click, so the two clicks are timed by hand: at most 400 ms apart, and within 6 pixels of each other, otherwise they are two separate clicks and nothing happens.
On arrival in the editor, the word before the cursor is highlighted for a couple of seconds, so the eye can find where the cursor landed. It's like wiki-editing in your slippers. The highlight is pure decoration: the first key, click or paste collapses it before anything is typed, so it can never swallow the word it is showing you.
Middle-clicking a link still opens it in a new tab. That is in fact the one thing the gadget deliberately does not touch, and the reason a double middle-click on a link edits nothing: the first of the two clicks has already opened the tab before the second one arrives, and there is no taking it back. Clever. And sweet.
The rendered page and the wikitext are two different texts, so the cursor is placed by looking for a few plain words on each side of the click and finding them again in the source, allowing for arbitrary markup in between. When that search comes back empty, or comes back twice, the gadget does not guess: it opens the right section with the cursor at its top. That is the floor, and it is never wrong, only imprecise.
It lands on that floor deliberately in a few places:
Code in <syntaxhighlight> blocks, on the other hand, is literally itself in the source, so that works.
Before it can look for words, the gadget has to know which section it is looking in, and it reads that off the page rather than off the wikitext—the nearest heading above the click, and the section number in that heading's own [edit] link. That is only reliable as long as a heading really does sit above the text it heads, which is not something one can take for granted once other gadgets have had their turn at the page. On the 𝕐 pages, microblog gathers each day into a <section> of its own and then moves the date to the foot of it, so the day reads upward: a heading which is above nothing at all. The gadget, walking backwards through the siblings of a post, met only other days' sections, found no heading anywhere, concluded it was in the lead—and opened every yeet on {{MonthNav}}. Since v°1.0 it first asks whether the click sits inside a block which owns a heading of its own, and if it does, that heading is the answer wherever inside the block it has been put. Sideways, upside down, it no longer matters.
The gadget is on for anyone who can edit. Three knobs, to be set in MediaWiki:Common.js if the defaults ever irritate:
window.dblmiddleeditHighlight = 'before'; // 'before' | 'after' | 'none'
window.dblmiddleeditHighlightMs = 2500; // how long the highlight lingers
window.dblmiddleeditNoGo = '.onlinecite'; // never guess in here
The highlight can sit on one side of the cursor or the other, but not on both: the highlight is a genuine selection, a cursor can only be at one end of a selection, and a cursor drawn where it is not would defeat the entire point.
dblmiddleeditNoGo takes the wrappers of any local templates whose rendered text should never be trusted as an anchor. The ones met daily are built in and need not be listed: the {{AI}} exchanges, and on the 𝕐 pages the {{thistime}} stamp—which microblog moves to the head of the post, right where the eye and the wheel both land—together with the day label.
First version v°0.9 on 21 July (2026), v°1.0 on 6 August (2026), living at MediaWiki:Gadget-dblmiddleedit.js, registered in MediaWiki:Gadgets-definition.
It is one file with two halves, since the trick spans two page loads. On the page one is reading, it catches the double click, works out which section the click fell in, picks up a handful of plain words on either side, and stores them. On the edit page which follows, it reads them back, finds them in the wikitext, and puts the cursor between them.