]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - resources/src/mediawiki.special/mediawiki.special.recentchanges.js
MediaWiki 1.30.2
[autoinstalls/mediawiki.git] / resources / src / mediawiki.special / mediawiki.special.recentchanges.js
1 /*!
2  * JavaScript for Special:RecentChanges
3  */
4 ( function ( mw, $ ) {
5         var rc, $checkboxes, $select;
6
7         /**
8          * @class mw.special.recentchanges
9          * @singleton
10          */
11         rc = {
12                 /**
13                  * Handler to disable/enable the namespace selector checkboxes when the
14                  * special 'all' namespace is selected/unselected respectively.
15                  */
16                 updateCheckboxes: function () {
17                         // The option element for the 'all' namespace has an empty value
18                         var isAllNS = $select.val() === '';
19
20                         // Iterates over checkboxes and propagate the selected option
21                         $checkboxes.prop( 'disabled', isAllNS );
22                 },
23
24                 init: function () {
25                         $select = $( '#namespace' );
26                         $checkboxes = $( '#nsassociated, #nsinvert' );
27
28                         // Bind to change event, and trigger once to set the initial state of the checkboxes.
29                         rc.updateCheckboxes();
30                         $select.change( rc.updateCheckboxes );
31                 }
32         };
33
34         $( rc.init );
35
36         module.exports = rc;
37
38 }( mediaWiki, jQuery ) );