Merge "'lang' attrib in #mw-content-text should be set to variant code."
[lhc/web/wiklou.git] / resources / mediawiki.special / mediawiki.special.recentchanges.js
1 /* JavaScript for Special:RecentChanges */
2 ( function ( mw, $ ) {
3
4 var checkboxes = [ 'nsassociated', 'nsinvert' ];
5
6 /**
7 * @var select {jQuery}
8 */
9 var $select = null;
10
11 var rc = mw.special.recentchanges = {
12
13 /**
14 * Handler to disable/enable the namespace selector checkboxes when the
15 * special 'all' namespace is selected/unselected respectively.
16 */
17 updateCheckboxes: function () {
18 // The option element for the 'all' namespace has an empty value
19 var isAllNS = $select.find('option:selected').val() === '';
20
21 // Iterates over checkboxes and propagate the selected option
22 $.each( checkboxes, function ( i, id ) {
23 $( '#' + id ).prop( 'disabled', isAllNS );
24 });
25 },
26
27 init: function () {
28 // Populate
29 $select = $( '#namespace' );
30
31 // Bind to change event, and trigger once to set the initial state of the checkboxes.
32 $select.change( rc.updateCheckboxes ).change();
33 }
34 };
35
36 // Run when document is ready
37 $( rc.init );
38
39 }( mediaWiki, jQuery ) );