Help:Customizing toolbars
![]() | This help page or section is in a state of significant expansion or restructuring. You are welcome to assist in its construction by editing it as well. If this help page has not been edited in several days, please remove this template. If you are the editor who added this template and you are actively editing, please be sure to replace this template with {{in use}} during the active editing session. Click on the link for template parameters to use.
This page was last edited by Gadget850 (talk | contribs) 12 years ago. (Update timer) |
The left sidebar can be customized by editing Special:MyPage/skin.js or Special:MyPage/common.js. skin.js
applies to only the current skin, where common.js
globally applies to all skins.
Overview
General usage:
mw.util.addPortletLink( 'portletId', 'href', 'text', 'id', 'tooltip', 'accesskey', 'nextnode');
Where:
mw.util.addPortletLink
: the ResourceLoader module to add links to the portlets.portletId
: portlet idp-navigation
: Navigationp-interaction
: Interactionp-tb
: Toolboxcoll-print_export
: Print/export
href
: Link to the Wikipedia or eternal pagetext
: Text that displaysid
: HTML id (optional)tooltip
: Tooltip that displays on mouseover (optional)accesskey
: Shortcut key press (optional)nextnode
: Existing portlet link to place the new portlet link before (optional)
Href
Links to Wikipedia pages are of the form '/wiki/page name'; example: '/wiki/Special:NewPages'.
External links are formatted using the full URL; example: 'http://example.org'.
There are a number of configuration variables that can be used to create more complex links:
wgArticlePath
: Local path, starting at the root, to reference articles, containing a "$1" placeholder that may be replaced by a page title to get a valid URL to that page.wgPageName
: The full name of the page, including the localized namespace name, if the namespace has a name (the main namespace (number 0) doesn't), and with blanks replaced by underscores.wgServer
: The server URL, not terminated by "/".
Given a valid page title title, a valid URL may be constructed using wgArticlePath.replace('$1', title)
wgServer+wgArticlePath.replace("$1", "Special:ArticleFeedbackv5/"+wgPageName)
Examples
Add link to Special:NewPages in the Toolbar:
mw.util.addPortletLink ('p-tb', '/wiki/Special:NewPages', 'New Pages');
Open page in Checklinks
mw.util.addPortletLink ('p-tb', 'http://toolserver.org/~dispenser/cgi-bin/webchecklinks.py/' + wgPageName
+ '?client=script&citeweb=on&overwrite=&limit=20&lang=' + wgContentLanguage, 'Checklinks');
Open page in Reflinks <source lang="javascript"> mw.util.addPortletLink ('p-tb', 'http://toolserver.org/~dispenser/cgi-bin/reflinks.py?lang=' + wgContentLanguage + "&page=' + wgPageName + '&autoclick=wpPreview', 'Reflinks');