On 6 May 2015, at 20:26, Jack Phoenix jack@countervandalism.net wrote:
On Wed, May 6, 2015 at 9:06 PM, Brad Jorsch (Anomie) bjorsch@wikimedia.org wrote:
On Wed, May 6, 2015 at 1:31 PM, Jack Phoenix jack@countervandalism.net wrote:
How can I totally strip out the "Category:" [..]
Hit api.php?action=query&meta=siteinfo&siprop=namespaces to get the localized name of the Category namespace. Or you should be safe just removing everything up to the first colon.
Yeah, probably better to avoid the extra HTTP request.
Namespace information and variants thereof are readily available via mw.config wgNamespaceIds.
You can manually remove any values with id 14 (category), or use mw.Title to do it for you.
As for the UI library, I'd recommend using the jquery.suggestions module in a MediaWiki context. Avoid jQuery UI.
This is already used for page inputs (e.g. search), and user name inputs (e.g. Special:Log).
Creating an instance of it for categories should be straight forward.
You can use mediawiki.searchSuggest or mediawiki.userSuggest as starting point: https://github.com/wikimedia/mediawiki/blob/master/resources/src/mediawiki/m... https://github.com/wikimedia/mediawiki/blob/master/resources/src/mediawiki/mediawiki.userSuggest.js
-- Krinkle