Gadgets/autocomplete
< Gadgets
- Summary: A context aware autocomplete that suggest links when user typing [[, and template when user type {{. The gadget takes advantage of TemplateData, and can also help to fill parameters names.
More general info about Gadgets
Setup
editTo setup the gadget in new project:
- Add the source code
- To turn it as a gadget that user can select in their preferences (requires sysop rights):
- create MediaWiki:Gadget-autocomplete.js with the following code:
mw.loader.load('//he.wikipedia.org/w/load.php?modules=ext.gadget.autocomplete');
- create MediaWiki:Gadget-autocomplete with short description
- add it to MediaWiki:Gadgets-definition
- create MediaWiki:Gadget-autocomplete.js with the following code:
- To test it (if you aren't sysop):
- add the source code to your personal JS (Special:MyPage/common.js).
mw.loader.load('//he.wikipedia.org/w/load.php?modules=ext.gadget.autocomplete');
- add the source code to your personal JS (Special:MyPage/common.js).
- To turn it as a gadget that user can select in their preferences (requires sysop rights):
FAQ
editLinks
edit- The gadget use the same mechanism as the suggestion in the searchbox, only pages that appear in the search will be suggested.
- The gadget suggest links when user start to type [[ and typed at least the beginning of the pagename.
- The gadget suggest links also when a template parameter is filled is expecting page name based on template data (see #Templatedata)
- The gadget supports links to sections (such as Wikipedia:Featured articles#Biology when user type [[Wikipedia:Featured articles#). By design this is supported only when editing pages not in main space.
Templates
edit- Similarly to links, the gadget suggest template names when user start to type {{
Templatedata
edit- The gadget complete parameter names when user is within a template and typed | if the template has templatedata.
- For templates expecting unnamed parameters, the gadget expect the user to first fill the unnamed parameters and doesn't suggest parameter name. For example
- Template source: the user page is [[User:{{{1|{{{Username}}}}}}]]
- when user typed {{template|User<span style=" it isn't possible to know whether the user typed a name of a user starting with "User" or started to type the parameter name "Username". The gadget assume the first option.
- For parameters indicated as referring to other pages, the gadget suggest filling similar to links and templates. Supported parameters types:
- wiki-page-name
- wiki-file-name
- wiki-user-name
Keyboard shortcuts
edit- ESC - close the suggestions
- arrow keys - move between different suggestions.