Page MenuHomeWickedGov Phorge

mergeHistory.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

mergeHistory.js

/*!
* JavaScript for MergeHistory special page
* This is similar to the JS used for the history action, but allows
* the same ts for both points, unlike diffs which need two different revisions
*/
$( () => {
'use strict';
const $pagehistory = $( '#mw-mergehistory-list' );
const $lis = $pagehistory.find( '.mw-contributions-list > li' );
/**
* @ignore
* @this Element input
* @param {jQuery.Event} e
* @return {boolean} False to cancel the default event
*/
function updateDiffRadios() {
let disableOld = true;
let disableNew = false;
$lis.each( function () {
const $li = $( this );
const $inputs = $li.find( 'input[type="radio"]' );
const $oldRadio = $inputs.filter( '[name="mergepointold"]' ).eq( 0 );
const $newRadio = $inputs.filter( '[name="mergepoint"]' ).eq( 0 );
if ( !$oldRadio.length || !$newRadio.length ) {
return true;
}
// Disable the "old" radio buttons unless they are below (or the same as) the selected "new" radio button
if ( $newRadio.prop( 'checked' ) ) {
disableOld = false;
}
$oldRadio.prop( 'disabled', disableOld );
$newRadio.prop( 'disabled', disableNew );
// Disable the "new" radio buttons if they are below the selected "old" radio button
if ( $oldRadio.prop( 'checked' ) ) {
disableNew = true;
}
} );
return true;
}
$pagehistory.on( 'change', 'input[name="mergepointold"], input[name="mergepoint"]', updateDiffRadios );
// Set initial state
updateDiffRadios();
} );

File Metadata

Mime Type
text/plain
Expires
Aug 14 2026, 10:09 (14 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fd/33/b058b68dd665043332cacc73e152
Default Alt Text
mergeHistory.js (1 KB)

Event Timeline