MediaWiki:Gadget-dropdown.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
1 /**
2 * add various useful links to the "More" dropdown menu
3 *
4 * References:
5 * <https://www.mediawiki.org/wiki/ResourceLoader/Core_modules#addPortletLink>
6 * <https://en.wikipedia.org/wiki/Help:Customizing_toolbars>
7 */
8 $( function () {
9 var conf = mw.config.get([
10 'wgPageName',
11 'wgNamespaceNumber',
12 'wgArticlePath'
13 ])
14
15 if (conf.wgNamespaceNumber === -1) {
16 return; // don't run on special pages
17 }
18
19 // link to the most recent diff à la Twinkle
20 mw.util.addPortletLink(
21 'p-cactions',
22 conf.wgArticlePath.replace('$1', encodeURIComponent(conf.wgPageName) + '?diff=cur'),
23 'Last',
24 'ca-diff',
25 'Show most recent diff'
26 );
27
28 // link to subpages of the current page
29 mw.util.addPortletLink(
30 'p-cactions',
31 conf.wgArticlePath.replace('$1', 'Special:PrefixIndex/' + encodeURIComponent(conf.wgPageName) + '/'),
32 'Subpages',
33 'ca-subpages',
34 'List this page\'s subpages'
35 );
36
37 // link to SMW properties for the current page
38 mw.util.addPortletLink(
39 'p-cactions',
40 conf.wgArticlePath.replace('$1', 'Special:Browse/' + conf.wgPageName),
41 'Page properties',
42 'ca-properties',
43 'List this page\'s semantic properties'
44 );
45 });