-/**
+/*!
* Add search suggestions to the search form.
*/
( function ( mw, $ ) {
map = {
// SimpleSearch is broken in Opera < 9.6
opera: [['>=', 9.6]],
+ // Older Konquerors are unable to position the suggestions correctly (bug 50805)
+ konqueror: [['>=', '4.11']],
docomo: false,
blackberry: false,
ipod: false,
// 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 ) {
// Generic selector for skins with multiple searchboxes (used by CologneBlue)
'.mw-searchInput'
];
- $( searchboxesSelectors.join(', ') )
+ $( searchboxesSelectors.join( ', ' ) )
.suggestions( {
fetch: function ( query ) {
var $el;
},
result: {
render: renderFunction,
- select: function ( $input ) {
- $input.closest( 'form' ).submit();
+ select: function () {
+ return true; // allow the form to be submitted
}
},
delay: 120,
$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 type="hidden" name="fulltext" value="1"/>' )
- );
- $input.closest( 'form' ).submit();
+ $input.closest( 'form' )
+ .append( $( '<input type="hidden" name="fulltext" value="1"/>' ) );
+ 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 <body>.
// (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.