X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.rcfilters%2Fui%2Fmw.rcfilters.ui.FormWrapperWidget.js;h=6aa335a58a6eaa589570124b9f49c05aa0d1df77;hb=351be2c1addeec9c9c8e5460e3a22826640d3b3c;hp=5a64edd6362489072564a7023c1b6d345381004e;hpb=19a84db108b86f8d4b94bde8e9c34add9f13cc31;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 5a64edd636..6aa335a58a 100644 --- a/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js +++ b/resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FormWrapperWidget.js @@ -87,7 +87,6 @@ */ mw.rcfilters.ui.FormWrapperWidget.prototype.onChangesModelInvalidate = function () { this.$submitButton.prop( 'disabled', true ); - this.$element.removeClass( 'mw-rcfilters-ui-ready' ); }; /** @@ -96,11 +95,11 @@ * * @param {jQuery|string} $changesList Updated changes list * @param {jQuery} $fieldset Updated fieldset + * @param {string} noResultsDetails Type of no result error * @param {boolean} isInitialDOM Whether $changesListContent is the existing (already attached) DOM */ - mw.rcfilters.ui.FormWrapperWidget.prototype.onChangesModelUpdate = function ( $changesList, $fieldset, isInitialDOM ) { + mw.rcfilters.ui.FormWrapperWidget.prototype.onChangesModelUpdate = function ( $changesList, $fieldset, noResultsDetails, isInitialDOM ) { this.$submitButton.prop( 'disabled', false ); - this.$element.removeClass( 'mw-rcfilters-ui-ready' ); // Replace the entire fieldset this.$element.empty().append( $fieldset.contents() ); @@ -142,24 +141,29 @@ this.$element.find( 'hr' ).detach(); } + // Get rid of all
s, which are inside rcshowhide + // If we still have content in rcshowhide, the
s are + // gone. Instead, the CSS now has a rule to mark all s + // inside .rcshowhide with display:block; to simulate newlines + // where they're actually needed. + this.$element.find( 'br' ).detach(); if ( !this.$element.find( '.rcshowhide' ).contents().length ) { this.$element.find( '.rcshowhide' ).detach(); - // If we're hiding rcshowhide, the '
's are around it, - // there's no need for them either. - this.$element.find( 'br' ).detach(); } if ( this.$element.find( '.cloption' ).text().trim() === '' ) { this.$element.find( '.cloption-submit' ).detach(); } - if ( mw.rcfilters.featureFlags.liveUpdate ) { - this.$element.find( - '.rclistfrom, .rcnotefrom, .rcoptions-listfromreset' - ).detach(); - } + this.$element.find( + '.rclistfrom, .rcnotefrom, .rcoptions-listfromreset' + ).detach(); + + // Get rid of the legend + this.$element.find( 'legend' ).detach(); - if ( this.$element.text().trim() === this.$element.find( 'legend' ).text() ) { + // Check if the element is essentially empty, and detach it if it is + if ( !this.$element.text().trim().length ) { this.$element.detach(); } };