Rewrite rendering of Vector simple search
[lhc/web/wiklou.git] / resources / mediawiki / mediawiki.searchSuggest.js
index 7f07862..9fcd42a 100644 (file)
 
                // Compatibility map
                map = {
-                       browsers: {
-                               // Left-to-right languages
-                               ltr: {
-                                       // SimpleSearch is broken in Opera < 9.6
-                                       opera: [['>=', 9.6]],
-                                       docomo: false,
-                                       blackberry: false,
-                                       ipod: false,
-                                       iphone: false
-                               },
-                               // Right-to-left languages
-                               rtl: {
-                                       opera: [['>=', 9.6]],
-                                       docomo: false,
-                                       blackberry: false,
-                                       ipod: false,
-                                       iphone: false
-                               }
-                       }
+                       // 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,
+                       iphone: false
                };
 
                if ( !$.client.test( map ) ) {
@@ -49,7 +38,7 @@
                        $form = context.config.$region.closest( 'form' );
 
                        formAction = $form.attr( 'action' );
-                       baseHref = formAction + ( formAction.match(/\?/) ? '&' : '?' );
+                       baseHref = formAction + ( formAction.match( /\?/ ) ? '&' : '?' );
 
                        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;
                                // make sure paste and cut events from the mouse and drag&drop events
                                // trigger the keypress handler and cause the suggestions to update
                                $( this ).trigger( 'keypress' );
-                       } );
+                       } )
+                       // If the forms include any fulltext search thingies, remove them as they
+                       // would interfere with selecting suggestions
+                       .closest( 'form' ).find( '[name="fulltext"]' ).remove();
 
                // Ensure that the thing is actually present!
                if ( $searchRegion.length === 0 ) {