wiki.techinc.nl/resources/mediawiki.special/mediawiki.special.recentchanges.js
Krinkle 0e82a6cfd0 Applying whitespace conventions in core JS files.
* Mostly whitespace in callers: $('foo').bar(baz,quux) => $( 'foo' ).bar( baz, quux )
* Also several occurrences of mixes spaces and tabs in the indention in front of a line, converted to tabs.
* And double spaces -> single spaces at random.
2011-08-12 21:48:10 +00:00

39 lines
977 B
JavaScript

/* JavaScript for Special:RecentChanges */
( function( $ ) {
var checkboxes = [ 'nsassociated', 'nsinvert' ];
/**
* @var select {jQuery}
*/
var $select = null;
var rc = mw.special.recentchanges = {
/**
* Handler to disable/enable the namespace selector checkboxes when the
* special 'all' namespace is selected/unselected respectively.
*/
updateCheckboxes: function() {
// The option element for the 'all' namespace has an empty value
var isAllNS = ('' === $select.find('option:selected').val() );
// Iterates over checkboxes and propagate the selected option
$.each( checkboxes, function( i, id ) {
$( '#' + id ).prop( 'disabled', isAllNS );
});
},
init: function() {
// Populate
$select = $( '#namespace' );
// Bind to change event, and trigger once to set the initial state of the checkboxes.
$select.change( rc.updateCheckboxes ).change();
}
};
// Run when document is ready
$( rc.init );
})( jQuery );