| 1 |
( function () { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
function invertSelections() { |
| 5 |
var form = document.getElementById( 'choose_pages' ), |
| 6 |
numElements = form.elements.length, |
| 7 |
i, |
| 8 |
curElement; |
| 9 |
|
| 10 |
for ( i = 0; i < numElements; i++ ) { |
| 11 |
curElement = form.elements[ i ]; |
| 12 |
|
| 13 |
if ( curElement.type === 'checkbox' && curElement.id !== 'create-redirect' && |
| 14 |
curElement.id !== 'watch-pages' && curElement.id !== 'botEdit' ) { |
| 15 |
curElement.checked = !curElement.checked; |
| 16 |
} |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
$( function () { |
| 21 |
var $checkboxes = $( '#powersearch input[id^="mw-search-ns"]' ); |
| 22 |
|
| 23 |
$( '.ext-replacetext-invert' ).on( 'click', invertSelections ); |
| 24 |
|
| 25 |
|
| 26 |
$( '#mw-search-toggleall' ).on( 'click', function () { |
| 27 |
$checkboxes.prop( 'checked', true ); |
| 28 |
} ); |
| 29 |
$( '#mw-search-togglenone' ).on( 'click', function () { |
| 30 |
$checkboxes.prop( 'checked', false ); |
| 31 |
} ); |
| 32 |
} ); |
| 33 |
}() ); |