User:Nardog/SymmetricalChanges.js

$(function symmetricalChanges {	if (!document.getElementById('p-tb')) return;	let callback = $diff => {		let $rows = $diff			.find('.diff-deletedline:not(.diff-empty) ~ .diff-addedline:not(.diff-empty)')			.parent;		if (!$rows.length) return;		$rows.addClass('symmetricalchange');		$rows.prev.has('.diff-context').addClass('symmetricalchange-context')			.prev.has('.diff-context').addClass('symmetricalchange-context');		$rows.next.has('.diff-context').addClass('symmetricalchange-context')			.next.has('.diff-context').addClass('symmetricalchange-context');		if (document.getElementById('t-symmetricalchanges')) return;		mw.loader.using('mediawiki.util', => { mw.util.addPortletLink('p-tb', '#', 'Toggle symmetrical changes', 't-symmetricalchanges').firstElementChild.addEventListener('click', e => {				e.preventDefault;				document.body.classList.toggle('symmetricalchanges-enabled');			}); });	};	mw.hook('wikipage.diff').add(callback);	mw.hook('ve.activationComplete').add( => { let setDiffAndReview = ve.ui.MWSaveDialog.prototype.setDiffAndReview; ve.ui.MWSaveDialog.prototype.setDiffAndReview = function (promise) { setDiffAndReview.apply(this, arguments); promise.then( => {				callback(this.$reviewWikitextDiff);			}); };	}); });