User:Nardog/SymmetricalChanges.js

In today's world, User:Nardog/SymmetricalChanges.js remains a fundamental and intriguing topic that attracts the attention of academics, scientists, professionals and enthusiasts alike. The importance of User:Nardog/SymmetricalChanges.js is manifested in different areas, from medicine to technology, through politics and culture. Throughout history, User:Nardog/SymmetricalChanges.js has been the subject of study and debate, demonstrating its relevance and impact on society. In this article, we will explore different aspects related to User:Nardog/SymmetricalChanges.js, from its origin and evolution to its current influence, with the aim of providing a comprehensive view of this fascinating and constantly changing topic.
$(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);
			});
		};
	});
});