Last modified: 2014-11-17 09:21:27 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T67753, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 65753 - Provide way to override the behavior of default search box
Provide way to override the behavior of default search box
Status: UNCONFIRMED
Product: MediaWiki
Classification: Unclassified
Search (Other open bugs)
1.24rc
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-25 22:09 UTC by Niklas Laxström
Modified: 2014-11-17 09:21 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Niklas Laxström 2014-05-25 22:09:47 UTC
I can't find any non-ugly way to alter the default search box suggestion functionality. I would like to change the namespaces and change rendering format a bit.

I checked how Wikidata does their thing, but even they override the whole search box with their own one.
Comment 1 MZMcBride 2014-05-25 22:14:44 UTC
(In reply to Niklas Laxström from comment #0)
> I can't find any non-ugly way to alter the default search box suggestion
> functionality. I would like to change the namespaces and change rendering
> format a bit.

Which file were you looking at specifically?
Comment 2 Bartosz Dziewoński 2014-05-25 22:16:29 UTC
If you're a skin, you can override the 'mediawiki.searchSuggest' module, which is normally loaded, by overriding the Skin::getDefaultModules() method.

If you're a ResourceLoader module, you can just depend on 'jquery.suggestions' *and* 'mediawiki.searchSuggest', and then call .suggestions() to override the rendering and selecting behavior (as well as a couple other things, see jquery.suggestions documentation) using code like below (every object key is optional in this call, and missing ones will keep their previous behavior). 'mediawiki.searchSuggest' actually does just that itself, calling .suggestions() several times.

$( '#searchInput' ).suggestions( {
	result: {
		render: ...,
		select: ...
	},
	special: {
		render: ...,
		select: ...
	}
} );
Comment 3 Niklas Laxström 2014-05-26 18:59:00 UTC
Hmm okay. I will try the RL approach by duplicating searchboxesSelectors and overriding 'fetch' and 'result' by calling .suggestions() in $( document ).ready(). If that works this can be closed as WFM.
Comment 4 Niklas Laxström 2014-06-02 21:44:25 UTC
I had to duplicate 'computeResultRenderCache' which is less than ideal.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links