mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ReplaceText
synced 2024-12-18 17:23:11 +00:00
78e75ed030
Apply CSS coding conventions from: https://www.mediawiki.org/wiki/Manual:Coding_conventions/CSS#Naming * Use class instead of id. * Use class names with the prefix "ext-replacetext-". * Remove stylelint rule: "selector-max-id": null * Add stylelint rule: "selector-class-pattern": "^client-nojs$|^ext-replacetext-" Change-Id: Ia7e3d41030aba7287716a219acbe6115e8fcbe46
34 lines
892 B
JavaScript
34 lines
892 B
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]' );
|
|
|
|
$( '.ext-replacetext-invert' ).on( 'click', invertSelections );
|
|
|
|
// Attach handler for check all/none buttons
|
|
$( '#mw-search-toggleall' ).on( 'click', function () {
|
|
$checkboxes.prop( 'checked', true );
|
|
} );
|
|
$( '#mw-search-togglenone' ).on( 'click', function () {
|
|
$checkboxes.prop( 'checked', false );
|
|
} );
|
|
} );
|
|
}() );
|