2018-12-06 17:42:31 +00:00
|
|
|
( function () {
|
2018-04-11 02:25:55 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-12-06 17:27:46 +00:00
|
|
|
function invertSelections() {
|
|
|
|
var form = document.getElementById( 'choose_pages' ),
|
|
|
|
numElements = form.elements.length,
|
|
|
|
i,
|
|
|
|
curElement;
|
2018-04-11 02:25:55 +00:00
|
|
|
|
2018-12-06 17:27:46 +00:00
|
|
|
for ( i = 0; i < numElements; i++ ) {
|
|
|
|
curElement = form.elements[ i ];
|
2018-04-11 02:25:55 +00:00
|
|
|
|
2018-12-06 17:27:46 +00:00
|
|
|
if ( curElement.type === 'checkbox' && curElement.id !== 'create-redirect' &&
|
|
|
|
curElement.id !== 'watch-pages' && curElement.id !== 'doAnnounce' ) {
|
|
|
|
form.elements[ i ].checked = form.elements[ i ].checked !== true;
|
|
|
|
}
|
2018-04-11 02:25:55 +00:00
|
|
|
}
|
|
|
|
}
|
2018-04-26 14:57:24 +00:00
|
|
|
|
|
|
|
$( function () {
|
2018-12-22 18:21:47 +00:00
|
|
|
var $checkboxes = $( '#powersearch input[id^=mw-search-ns]' );
|
|
|
|
|
2018-04-26 14:57:24 +00:00
|
|
|
$( '#replacetext-invert' )
|
2018-12-06 17:27:46 +00:00
|
|
|
.on( 'click', invertSelections )
|
2018-04-26 14:57:24 +00:00
|
|
|
.prop( 'disabled', false );
|
2018-12-22 18:21:47 +00:00
|
|
|
|
|
|
|
// 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' ) )
|
|
|
|
.click( function () {
|
|
|
|
$checkboxes.prop( 'checked', true );
|
|
|
|
} )
|
|
|
|
).append(
|
|
|
|
$( '<input>' ).attr( 'type', 'button' )
|
|
|
|
.attr( 'id', 'mw-search-togglenone' )
|
|
|
|
.prop( 'value', mw.msg( 'powersearch-togglenone' ) )
|
|
|
|
.click( function () {
|
|
|
|
$checkboxes.prop( 'checked', false );
|
|
|
|
} )
|
|
|
|
);
|
2018-04-26 14:57:24 +00:00
|
|
|
} );
|
2018-12-06 17:42:31 +00:00
|
|
|
}() );
|