mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ReplaceText
synced 2024-11-11 16:49:09 +00:00
3a6f634385
``` Xml::textarea( $name, $content, $cols = 40, $rows = 5, $attribs ); Xml::input( $name, $size = false, $value = false, $attribs ); Xml::checkLabel( $label, $name, $id, $checked = false, $attribs ); ``` For examples of trouble with Xml::checkLabel, see also I61c8f67127 in CentralAuth and I33bf6ab5e0 in MediaWiki core. For improved clarify, I'm replacing most of these with Html::element(). While at it, I'm also migrating `<input id=…><label for=…>…</label>` to the simpler `<label><input>…</label>` form where this is easy to do. ext.ReplaceTextStyles.less has styles for label/input inside `.ext-replacetext-search-togglebox`, which this patch leaves unchanged. ext.ReplaceText.js refers to the IDs of namespace checkboxes, which this change keeps in-tact. In the future, the namespace checkbox HTML could be simplified further if the JS code selects by `name` instead of `id`. Test Plan: * Given `wfLoadExtension('ReplaceText');` in LocalSettings.php, and a Main_Page containing the word "installed". * View Special:ReplaceText, verify it renders without errors, and each label is click-associated with its checkbox. * Find "Main", Replace "Minor", tick "(Main)" namespace, tick "Replace text in page titles". * Continue * Verify the checkboxes under "For moved pages:" are also associated with their labels. Change-Id: I2060961115b7af23dcf086ed03bfa3f159f5302c
34 lines
891 B
JavaScript
34 lines
891 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 !== 'botEdit' ) {
|
|
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 );
|
|
} );
|
|
} );
|
|
}() );
|