diff --git a/modules/ext.managewiki.oouiform.styles.less b/modules/ext.managewiki.oouiform.styles.less index acb8036ae..4d2f6077a 100644 --- a/modules/ext.managewiki.oouiform.styles.less +++ b/modules/ext.managewiki.oouiform.styles.less @@ -47,8 +47,6 @@ } .oo-ui-tabPanelLayout.managewiki-search-matched { - display: block !important; - > fieldset > legend { max-width: none; padding: 5px 10px; diff --git a/modules/ext.managewiki.oouiform.tabs.js b/modules/ext.managewiki.oouiform.tabs.js index 8a19a93eb..1b30237a1 100644 --- a/modules/ext.managewiki.oouiform.tabs.js +++ b/modules/ext.managewiki.oouiform.tabs.js @@ -111,16 +111,23 @@ var index, texts; function buildIndex() { index = {}; - var $fields = tabs.contentPanel.$element.find( - '[class^=mw-htmlform-field-]:not( .managewiki-search-noindex )' + var $fields = tabs.contentPanel.$element.find( '[class^=mw-htmlform-field-]:not( .managewiki-search-noindex )' ); + var $descFields = $fields.filter( + '.oo-ui-fieldsetLayout-group > .oo-ui-widget > .mw-htmlform-field-HTMLInfoField' ); - $fields.each( function () { + $fields.not( $descFields ).each( function () { var $field = $( this ); var $wrapper = $field.parents( '.managewiki-fieldset-wrapper' ); var $tabPanel = $field.closest( '.oo-ui-tabPanelLayout' ); + var $labels = $field.find( + '.oo-ui-labelElement-label, .oo-ui-textInputWidget .oo-ui-inputWidget-input, p' + ).add( + $wrapper.find( '> .oo-ui-fieldsetLayout > .oo-ui-fieldsetLayout-header .oo-ui-labelElement-label' ) + ); + $field = $field.add( $tabPanel.find( $descFields ) ); function addToIndex( $label, $highlight ) { - var text = $label.val() || $label[ 0 ].innerText.toLowerCase().trim().replace( /\s+/, ' ' ); + var text = $label.val() || $label[ 0 ].textContent.toLowerCase().trim().replace( /\s+/, ' ' ); if ( text ) { index[ text ] = index[ text ] || []; index[ text ].push( { @@ -132,9 +139,7 @@ } } - $field.find( '.oo-ui-labelElement-label, .oo-ui-textInputWidget .oo-ui-inputWidget-input, p' ).add( - $wrapper.find( '> .oo-ui-fieldsetLayout > .oo-ui-fieldsetLayout-header .oo-ui-labelElement-label' ) - ).each( function () { + $labels.each( function () { addToIndex( $( this ) ); // Check if there we are in an infusable dropdown and collect other options @@ -155,6 +160,7 @@ mw.hook( 'managewiki.search.buildIndex' ).fire( index ); texts = Object.keys( index ); } + function infuseAllPanels() { tabs.stackLayout.items.forEach( function ( tabPanel ) { var wasVisible = tabPanel.isVisible(); @@ -188,6 +194,7 @@ tabs.$element.toggleClass( 'managewiki-tabs-searching', isSearching ); tabs.tabSelectWidget.toggle( !isSearching ); tabs.contentPanel.setContinuous( isSearching ); + $( '.managewiki-search-matched' ).removeClass( 'managewiki-search-matched' ); $( '.managewiki-search-highlight' ).removeClass( 'managewiki-search-highlight' ); var hasResults = false; @@ -219,5 +226,6 @@ if ( search.getValue() ) { search.emit( 'change', search.getValue() ); } + } ); }() );