Merge "Further tweaks to pipe trick documentation (follow-up Iaf365e31)"
[mediawiki.git] / resources / mediawiki.special / mediawiki.special.recentchanges.js
blobd1c1354f0eb921d4129503d98fde30d8b3634652
1 /**
2  * JavaScript for Special:RecentChanges
3  */
4 ( function ( mw, $ ) {
5         var rc, $checkboxes, $select;
7         rc = {
8                 /**
9                  * Handler to disable/enable the namespace selector checkboxes when the
10                  * special 'all' namespace is selected/unselected respectively.
11                  */
12                 updateCheckboxes: function () {
13                         // The option element for the 'all' namespace has an empty value
14                         var isAllNS = $select.val() === '';
16                         // Iterates over checkboxes and propagate the selected option
17                         $checkboxes.prop( 'disabled', isAllNS );
18                 },
20                 init: function () {
21                         $select = $( '#namespace' );
22                         $checkboxes = $( '#nsassociated, #nsinvert' );
24                         // Bind to change event, and trigger once to set the initial state of the checkboxes.
25                         rc.updateCheckboxes();
26                         $select.change( rc.updateCheckboxes );
27                 }
28         };
30         $( document ).ready( rc.init );
32         mw.special.recentchanges = rc;
34 }( mediaWiki, jQuery ) );