Jump to content

User:Nardog/Consecudiff

From Wikipedia, the free encyclopedia
Consecudiff
DescriptionAdds links to diffs of consecutive edits by the same user on watchlist, history, etc.
UpdatedOctober 26, 2024
    (26 days ago)
BrowsersChrome, Firefox, etc. (ES2017+ needed)
SourceUser:Nardog/Consecudiff.js

This script finds edits made consecutively by the same user to the same page on the watchlist, recent changes, page history, or user contributions, and adds a link to the diff spanning the entire series of edits at the end of each line.

It'll look something like this:

  • (diff | hist) . . Foo; 03:18 . . (−34‎) . . User A (talk | contribs) 2/2
  • (diff | hist) . . Bar; 03:11 . . (+55) . . User B (talk | contribs)
  • (diff | hist) . . Bar; 03:04 . . (+44) . . User C (talk | contribs) [3/3]
  • (diff | hist) . . Bar; 02:58 . . (−15) . . User C (talk | contribs) [2/3]
  • (diff | hist) . . Foo; 02:51 . . (−72‎) . . User A (talk | contribs) 1/2
  • (diff | hist) . . Foo; 02:46 . . (+41‎) . . User D (talk | contribs)
  • (diff | hist) . . Bar; 02:19 . . (+34) . . User C (talk | contribs) [1/3]
  • (diff | hist) . . Bar; 02:00 . . (+65) . . User E (talk | contribs)

"2/2" and "1/2" will link to the diff between the versions at 02:46 and 03:18, and "3/3", "2/3" and "1/3" to the diff between 02:00 and 03:04. The ⟨angle brackets⟩ denote the last edit in the series is the current version of the page.

Installation

[edit]

Add the following to your common.js or global.js:

mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/Consecudiff.js&action=raw&ctype=text/javascript');

Or you may enable the script installer in Preferences → Gadgets and click "Install" in the infobox on this page.

Customization

[edit]

On user contributions, it's impossible to tell from the page which edits were made with no one else intervening, so any edits to the same page made no more than two hours apart are assumed to be consecutive. On the watchlist, recent changes, and page history, diffs between edits made too far apart may not be of much use, so edits with a gap greater than 12 hours are considered not consecutive. These can be customized by substituting your preferred thresholds in minutes in your common.js or global.js. This example doubles the numbers:

window.consecudiffThreshold = 1440;
window.consecudiffHistThreshold = 1440;
window.consecudiffContribsThreshold = 240;

On the watchlist and recent changes, the script by default regards any edits with no intervening edits visible on the list as consecutive, even if there were some that were filtered out. If you add the following, it will detect strictly consecutive edits only:

window.consecudiffDetectInterruptions = true;

Limitations

[edit]
  • The script is purposely lightweight. It doesn't go out of its way to figure out if each edit on the list is part of a larger series of edits; it sticks to what's on the page. So if an edit toward the end of a list was the last in a series of consecutive edits, the script wouldn't recognize it as such. On the JavaScript-assisted (Ajax) watchlist or recent changes, Consecudiff links are recalculated every time the page is updated so only diffs of edits currently visible will appear.