mw.special.recentchanges fixes:
[lhc/web/wiklou.git] / resources / mediawiki.special / mediawiki.special.recentchanges.js
1 /* JavaScript for Special:RecentChanges */
2 ( function( $ ) {
3
4 var checkboxes = [ 'nsassociated', 'nsinvert' ];
5
6 mw.special.recentchanges = {
7
8 /**
9 * @var select {jQuery}
10 */
11 $select: null,
12
13 init: function() {
14 var rc = this;
15
16 rc.$select =
17 $( 'select#namespace' )
18 .change( rc.updateCheckboxes )
19 // Trigger once set the initial statuses of the checkboxes.
20 .change();
21 },
22
23 /**
24 * Handler to disable/enable the namespace selector checkboxes when the
25 * special 'all' namespace is selected/unselected respectively.
26 */
27 updateCheckboxes: function() {
28 // The 'all' namespace is the FIRST in the list.
29 var isAllNS = mw.special.recentchanges.$select.find( 'option' ).first().is( ':selected' );
30
31 // Iterates over checkboxes and propagate the selected option
32 $.map( checkboxes, function( id ) {
33 $( '#'+id ).attr( 'disabled', isAllNS );
34 });
35 },
36 };
37
38 mw.special.recentchanges.init();
39
40 })( jQuery );