X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fmediawiki%2Fmediawiki.searchSuggest.js;h=6999610756059d5e6756944d9ed4c8a78a364372;hb=be148901bc02f5adc6e9f04d187852478ace6d1f;hp=0713541d065400b56a9c1c6a6c30e5a02d4e71fa;hpb=70ae276db1c02e82d2f324c658fe1f61c7a204d0;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/mediawiki/mediawiki.searchSuggest.js b/resources/mediawiki/mediawiki.searchSuggest.js index 0713541d06..6999610756 100644 --- a/resources/mediawiki/mediawiki.searchSuggest.js +++ b/resources/mediawiki/mediawiki.searchSuggest.js @@ -1,4 +1,4 @@ -/** +/*! * Add search suggestions to the search form. */ ( function ( mw, $ ) { @@ -32,13 +32,13 @@ // Compute form data for search suggestions functionality. function computeResultRenderCache( context ) { - var $form, formAction, baseHref, linkParams; + var $form, baseHref, linkParams; // Compute common parameters for links' hrefs $form = context.config.$region.closest( 'form' ); - formAction = $form.attr( 'action' ); - baseHref = formAction + ( formAction.match(/\?/) ? '&' : '?' ); + baseHref = $form.attr( 'action' ); + baseHref += baseHref.indexOf( '?' ) > -1 ? '&' : '?'; linkParams = {}; $.each( $form.serializeArray(), function ( idx, obj ) { @@ -125,7 +125,7 @@ // Generic selector for skins with multiple searchboxes (used by CologneBlue) '.mw-searchInput' ]; - $( searchboxesSelectors.join(', ') ) + $( searchboxesSelectors.join( ', ' ) ) .suggestions( { fetch: function ( query ) { var $el; @@ -153,8 +153,8 @@ }, result: { render: renderFunction, - select: function ( $input ) { - $input.closest( 'form' ).submit(); + select: function () { + return true; // allow the form to be submitted } }, delay: 120, @@ -178,22 +178,24 @@ $searchInput.suggestions( { result: { render: renderFunction, - select: function ( $input ) { - $input.closest( 'form' ).submit(); + select: function () { + return true; // allow the form to be submitted } }, special: { render: specialRenderFunction, select: function ( $input ) { - $input.closest( 'form' ).append( - $( '' ) - ); - $input.closest( 'form' ).submit(); + $input.closest( 'form' ) + .append( $( '' ) ); + return true; // allow the form to be submitted } }, $region: $searchRegion } ); + // If the form includes any fallback fulltext search buttons, remove them + $searchInput.closest( 'form' ).find( '.mw-fallbackSearchButton' ).remove(); + // In most skins (at least Monobook and Vector), the font-size is messed up in . // (they use 2 elements to get a sane font-height). So, instead of making exceptions for // each skin or adding more stylesheets, just copy it from the active element so auto-fit.