X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.special.recentchanges.js;h=c62acd90caae7394d473352c8b0bbee0c5cb013e;hb=dc7511bff320e2d3517e7adbb845047a3d8991ba;hp=d8f73b2368cb1ceff1b143af072810b994ecd9af;hpb=1dee28cb5f1efd6d9e14d6cc1d0c73c3f69269b4;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.special.recentchanges.js b/resources/src/mediawiki.special.recentchanges.js index d8f73b2368..c62acd90ca 100644 --- a/resources/src/mediawiki.special.recentchanges.js +++ b/resources/src/mediawiki.special.recentchanges.js @@ -2,7 +2,7 @@ * JavaScript for Special:RecentChanges */ ( function () { - var rc, $checkboxes, $select; + var rc, $checkboxes, $select, namespaceDropdown; /** * @class mw.special.recentchanges @@ -10,24 +10,34 @@ */ rc = { /** - * Handler to disable/enable the namespace selector checkboxes when the + * Handler to hide/show 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.val() === ''; + var value = $select.val(), + isAllNS = value === 'all' || value === ''; // Iterates over checkboxes and propagate the selected option - $checkboxes.prop( 'disabled', isAllNS ); + $checkboxes.toggleClass( 'mw-input-hidden', isAllNS ); }, init: function () { - $select = $( '#namespace' ); - $checkboxes = $( '#nsassociated, #nsinvert' ); + $select = $( 'select#namespace' ); + $checkboxes = $( '#nsassociated, #nsinvert, .contribs-ns-filters' ) + .closest( '.mw-input-with-label' ); - // Bind to change event, and trigger once to set the initial state of the checkboxes. - rc.updateCheckboxes(); - $select.change( rc.updateCheckboxes ); + if ( $select.length === 0 ) { + $select = $( '#namespace select' ); + if ( $select.length > 0 ) { + namespaceDropdown = OO.ui.infuse( $( '#namespace' ).closest( '[data-ooui]' ) ); + namespaceDropdown.on( 'change', rc.updateCheckboxes ); + } + } else { + // Bind to change event of the checkboxes. + // The initial state is already set in HTML. + $select.on( 'change', rc.updateCheckboxes ); + } } };