User:NhacNy2412/Subpages.js

From Meta, a Wikimedia project coordination wiki

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.
/*** Subpages ***/

// Creates a subpages link in the right navigation area
// Documentation at [[User:BrandonXLF/Subpages]]
// By [[User:BrandonXLF]]

$(function() {
	var newpage = {};
	newpage = {
		name : 'Subpages',
		name1 : 'subpages',
		tool : 'Run the Special:PrefixIndex tool'
	};
	if (mw.config.get('wgUserLanguage') == 'vi') {
		newpage.name = 'Trang con';
		newpage.name1 = 'trang con';
		newpage.tool = 'Đến trang Đặc biệt:Tiền tố';
	}
	mw.util.addPortletLink(
		'p-cactions',
		mw.config.get('wgArticlePath').replace('$1', 'Special:PrefixIndex/' + encodeURIComponent(mw.config.get('wgPageName')) + '/'), 
		newpage.name, newpage.name1, newpage.tool, 's'
	);
});