GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing en.wikipedia.org — Help:Customizing toolbars - Wikipedia
The left sidebar and the top personal toolbar can be customized by editing skin.js or common.js. OverviewGeneral usage: $.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function () { mw.util.addPortletLink( 'portletId', 'href', 'text', 'id', 'tooltip', 'accesskey', 'nextnode' ); } ); // or alternative syntax with explicit names: mw.loader.using('mediawiki.util').then( () => { mw.util.addPortletLink( 'p-tb', { href: 'https://www.mediawiki.org/', text: 'mediawiki.org', id: 't-mworg', tooltip: 'Go to mediawiki.org', accesskey: 'm', nextnode: '#t-print' } ); } ); Where:
The optional fields must be included in the above order. To skip a field without changing it, use the value null. addPortletLink API documentation HrefLinks 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. A configuration variable is read using the function
mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace("$1", "Special:ArticleFeedbackv5/"+ encodeURI( mw.config.get( 'wgPageName' ) ) ) However, for local links it may be more advisable, and simple, to use the method mw.util.getUrl( 'C++' ) // "/wiki/C%2B%2B" mw.util.getUrl( 'C++', { action: 'history' } ) // "/w/index.php?title=C%2B%2B&action=history" PlacementExamplesWherever username is shown, replace it with the desired user name; likewise, replace pagename with the desired page name.
Add portlet to a user subpage on the left toolbar: mw.util.addPortletLink ('p-tb', '/wiki/User:username/pagename', 'My pagename'); Add portlet to Special:NewPages on the left toolbar: mw.util.addPortletLink ('p-tb', '/wiki/Special:NewPages', 'New Pages');
mw.util.addPortletLink ('p-tb', 'http://toolserver.org/~dispenser/cgi-bin/webchecklinks.py/' + encodeURI( mw.config.get( 'wgPageName' ) ) + '?client=script&citeweb=on&overwrite=&limit=20&lang=' + mw.config.get( 'wgContentLanguage'), 'Checklinks'); Open the current page in Reflinks on the left toolbar: mw.util.addPortletLink ('p-tb', 'http://toolserver.org/~dispenser/cgi-bin/reflinks.py?lang=' + mw.config.get( 'wgContentLanguage' ) + '&page=' + encodeURIComponent( mw.config.get( 'wgPageName' ) ) + '&autoclick=wpPreview', 'Reflinks'); Open page in Reflinks, on the personal toolbar; formatted in multiple lines: mw.util.addPortletLink( 'p-personal', 'http://toolserver.org/~dispenser/cgi-bin/reflinks.py?lang=' + mw.config.get( 'wgContentLanguage' ) + '&page=' + encodeURIComponent( mw.config.get( 'wgPageName' ) ) + '&autoclick=wpPreview', 'Reflinks'); Add a portlet to open user subpages to the personal toolbar, placed before the Preferences portlet: mw.util.addPortletLink( 'p-personal', '/wiki/Special:PrefixIndex/User:username', 'subpages', 'pt-subpages', 'Your subpages', null, '#pt-preferences' ); | |||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |