mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ReplaceText
synced 2024-12-18 09:11:42 +00:00
978c8ead5b
Change-Id: Ic44987189a024e1f07e38907ce7208f9ab3a4d10
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
( function () {
|
|
'use strict';
|
|
|
|
function invertSelections() {
|
|
var form = document.getElementById( 'choose_pages' ),
|
|
numElements = form.elements.length,
|
|
i,
|
|
curElement;
|
|
|
|
for ( i = 0; i < numElements; i++ ) {
|
|
curElement = form.elements[ i ];
|
|
|
|
if ( curElement.type === 'checkbox' && curElement.id !== 'create-redirect' &&
|
|
curElement.id !== 'watch-pages' && curElement.id !== 'doAnnounce' ) {
|
|
curElement.checked = !curElement.checked;
|
|
}
|
|
}
|
|
}
|
|
|
|
$( function () {
|
|
var $checkboxes = $( '#powersearch input[id^=mw-search-ns]' );
|
|
|
|
$( '#replacetext-invert' )
|
|
.on( 'click', invertSelections )
|
|
.prop( 'disabled', false );
|
|
|
|
// Create check all/none button
|
|
$( '#mw-search-togglebox' ).append(
|
|
$( '<label>' )
|
|
.text( mw.msg( 'powersearch-togglelabel' ) )
|
|
).append(
|
|
$( '<input>' ).attr( 'type', 'button' )
|
|
.attr( 'id', 'mw-search-toggleall' )
|
|
.prop( 'value', mw.msg( 'powersearch-toggleall' ) )
|
|
.on( 'click', function () {
|
|
$checkboxes.prop( 'checked', true );
|
|
} )
|
|
).append(
|
|
$( '<input>' ).attr( 'type', 'button' )
|
|
.attr( 'id', 'mw-search-togglenone' )
|
|
.prop( 'value', mw.msg( 'powersearch-togglenone' ) )
|
|
.on( 'click', function () {
|
|
$checkboxes.prop( 'checked', false );
|
|
} )
|
|
);
|
|
} );
|
|
}() );
|