* 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' );
-
- this.$element.find( '.rcshowhideoption[data-feature-in-structured-ui=1]' ).each( function () {
+ this.$element.find( '.clshowhideoption[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.
// This would be unnecessary if we added separators with CSS.
} );
// Hide namespaces and tags
- $namespaceSelect.closest( 'tr' ).detach();
+ this.$element.find( '.namespaceForm' ).detach();
this.$element.find( '.mw-tagfilter-label' ).closest( 'tr' ).detach();
- // Hide limit and days
- this.$element.find( '.rclinks' ).detach();
+ // misc: limit, days, watchlist info msg
+ this.$element.find( '.rclinks, .cldays, .wlinfo' ).detach();
if ( !this.$element.find( '.mw-recentchanges-table tr' ).length ) {
this.$element.find( '.mw-recentchanges-table' ).detach();
this.$element.find( 'hr' ).detach();
}
+
+ // Get rid of all <br>s, which are inside rcshowhide
+ // If we still have content in rcshowhide, the <br>s are
+ // gone. Instead, the CSS now has a rule to mark all <span>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 '<br>'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();
+ }
+
+ this.$element.find(
+ '.rclistfrom, .rcnotefrom, .rcoptions-listfromreset'
+ ).detach();
+
+ // Get rid of the legend
+ this.$element.find( 'legend' ).detach();
+
+ // Check if the element is essentially empty, and detach it if it is
+ if ( !this.$element.text().trim().length ) {
+ this.$element.detach();
}
};
}( mediaWiki ) );