X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.rcfilters%2Fui%2Fmw.rcfilters.ui.FormWrapperWidget.js;h=4e1ae973a2903157ed6b30e0e2ff06fe3f5d31f4;hb=f7e1770fb832aa77bf4e16ce8cc815f2b24dd10d;hp=d786025b8f81302f540c3c9cfc2c3b068fb85da4;hpb=005a128c0f9da54734074d71b3bf84636f6d9c44;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js b/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js index d786025b8f..4e1ae973a2 100644 --- a/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js +++ b/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js @@ -72,9 +72,13 @@ // Collect all data from form $( e.target ).find( 'input:not([type="hidden"],[type="submit"]), select' ).each( function () { + var value = ''; + if ( !$( this ).is( ':checkbox' ) || $( this ).is( ':checked' ) ) { - data[ $( this ).prop( 'name' ) ] = $( this ).val(); + value = $( this ).val(); } + + data[ $( this ).prop( 'name' ) ] = value; } ); this.controller.updateChangesList( data ); @@ -101,6 +105,8 @@ // Replace the entire fieldset this.$element.empty().append( $fieldset.contents() ); + // Make sure enhanced RC re-initializes correctly + mw.hook( 'wikipage.content' ).fire( this.$element ); this.cleanUpFieldset(); @@ -111,6 +117,9 @@ * Clean up the old-style show/hide that we have implemented in the filter list */ mw.rcfilters.ui.FormWrapperWidget.prototype.cleanUpFieldset = function () { + var $namespaceSelect = this.$element.find( '#namespace' ), + collapseCookieName = 'changeslist-state'; + this.$element.find( '.rcshowhideoption[data-feature-in-structured-ui=1]' ).each( function () { // HACK: Remove the text node after the span. // If there isn't one, we're at the end, so remove the text node before the span. @@ -123,5 +132,25 @@ // Remove the span itself this.parentNode.removeChild( this ); } ); + + // Hide namespaces and tags + if ( mw.config.get( 'wgStructuredChangeFiltersEnableExperimentalViews' ) ) { + $namespaceSelect.closest( 'tr' ).detach(); + this.$element.find( '.mw-tagfilter-label' ).closest( 'tr' ).detach(); + } + + // Collapse legend + // see resources/src/mediawiki.special/mediawiki.special.changelist.legend.js + this.$element.find( '.mw-changeslist-legend' ) + .makeCollapsible( { + collapsed: mw.cookie.get( collapseCookieName ) === 'collapsed' + } ) + .on( 'beforeExpand.mw-collapsible', function () { + mw.cookie.set( collapseCookieName, 'expanded' ); + } ) + .on( 'beforeCollapse.mw-collapsible', function () { + mw.cookie.set( collapseCookieName, 'collapsed' ); + } ); + }; }( mediaWiki ) );