From Wikipedia, the free encyclopedia
DiffUndoDescription | Adds an undo button to each line on the diff while editing |
---|
Updated | October 9, 2024 (57 days ago) |
---|
Browsers | Chrome, Firefox, etc. (ES2020+ needed) |
---|
Source | User:Nardog/DiffUndo.js |
---|
This script adds an undo button to each line on the diff between the current version of the page and yours while editing ("Show changes"). Though inspired by a similar feature in AutoWikiBrowser, it also allows you to redo an undone change by clicking the button again.
It comes in handy especially when reverting edits. If you want to revert only part of an edit, you can click "undo" on page history or a diff and keep certain changes by undoing on the diff. If you want to revert an old edit but MediaWiki's native undo feature doesn't work because later edits interfere, you can go to the editing page of the previous revision, click "Show changes", and restore all the non-problematic edits by undoing the lines.
Add the following to your common.js or global.js:
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Nardog/DiffUndo.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.
You can undo a change as long as the line in the current source (deduced from the closest line number on the diff) matches the line in the "Your text" column of the diff. In case of a removed line (i.e. the cell in the "Your text" column is empty), the preceding line is compared. A redo works just like that except the columns are reversed.
- Undoing a change may clear the browser's native undo cache (Ctrl+Z).
- VisualEditor and the 2017 wikitext editor are not supported.
Nardog's scripts |
---|
Extra functionality
- CatChangesViewer – Lists recent category additions/removals on a category page.
- CodeEditorAssist – Allows customizing the code editor, e.g. changing the color theme and enabling live autocompletion.
- Consecudiff – Adds links to diffs of consecutive edits by the same user on watchlist, history, etc.
- CopyCodeBlock – Adds a button to copy the content of each code block (
<pre> ).
- CopySectLink – Adds a button to copy the unencoded page title or section path next to each heading.
- MoveHistory – Lists the past moves a page has gone through.
- RCMuter – Hides specified users' edits on Watchlist/RecentChanges.
- SmartDiff – Makes links and template calls in diffs clickable (supports red links, avoids WP:SEAOFBLUE).
Editing assistance
- DiffUndo – Adds an undo button to each line on the diff while editing.
- ExpandContractions – Expands contractions.
- InsertAnyChar – Insert any character by searching in the entire Unicode chart.
- IPAInput – Type in IPA symbols by directly looking at an IPA key like Help:IPA/English and clicking on the symbols.
- RefRenamer – Replaces reference names like ":0" with descriptive ones like "Smith-2015".
- Unpipe – Converts each piped link to a non-piped one if both lead to the same article.
Itch scratchers
- AutoSectionLink – Adds or refines the
/* section link */ as you edit so only the modified section will be linked in the summary.
- AutoTestcases – Autofills "Preview page with this template" with the most relevant /testcases page that exists.
- CatChangeLinker – Links "diff" and "hist" for category additions/removals on Watchlist/RecentChanges.
- PasteToCommons – Upload an image to Commons from anywhere on the site by pasting it.
- SortCentralAuthByEditCount – Sorts the list of local accounts on CentralAuth by edit count.
- TemplatePreviewGuard – Warns when you try to use "Preview page with this template" with a page that doesn't transclude the template.
|