Jump to content

User:RealFakeKim/Scripts/pageInfo.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
(function () {
// consts
const pagename = mw.config.get( 'wgPageName' );

const pagenameProcessed = encodeURIComponent(
  mw.config
    .get("wgPageName")
    .replace(/_/g, " ")
    .split("/")[0]
);

const username = pagenameProcessed
	.replace("User%3A", "")
	.replace("User%20talk%3A", "");

// All pages
mw.util.addPortletLink(
	"p-tb",
	mw.config.get("wgServer") + "/wiki/Special:Log?type=protect&user=&page=" + pagename,
	"Protection log",
	"t-protectionLog",
	`Protection log of ${pagename}`,
	null,
	'#t-mute'
);

mw.util.addPortletLink(
	"p-tb",
	mw.config.get("wgServer") + "/w/index.php?title=Special:WhatLinksHere/" + pagename + "&hidelinks=1&hidetrans=1&limit=500",
	"What redirects here",
	"t-whatRedirectsHere",
	`Redirects to ${pagename}`,
	null,
	'#t-recentchangeslinked'
);

mw.util.addPortletLink(
	'p-tb',
	// mw.cofig.get("wgServer") + '/w/index.php?title=Special:PrefixIndex/' + pagename + '/', -- Not sure why it doesn't work
	mw.util.getUrl( 'Special:PrefixIndex/' ) + pagename + '/',
	'Subpages',
	't-subpages',
	`Subpages of ${pagename}`,
	null,
	"#t-permalink"
);

// Mainspace
if (mw.config.get("wgNamespaceNumber") === 0) 
{
	mw.util.addPortletLink(
		"p-tb",
		mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Articles+for+deletion%2F" + pagenameProcessed + "&to=Articles+for+deletion%2F" + pagenameProcessed + "+%28z&namespace=4",
		"AfD discussions",
		"t-AFDDiscussions",
		`Articles for deletion discussions for ${pagename}`,
		null
	);
	
	mw.util.addPortletLink(
		"p-tb",
		mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Peer review%2F" + pagenameProcessed + "&to=Peer review%2F" + pagenameProcessed + "%2Farchivez&namespace=4",
		"Peer reviews",
		"t-peerReviews",
		`Peer reviews for ${pagename}`,
		null
	);
	
	mw.util.addPortletLink(
		"p-tb",
		mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=" + pagenameProcessed + "%2FGA1&to=" + pagenameProcessed + "%2FGAz&namespace=1",
		"GA nominations",
		"t-GANominations",
		`Good article nominations for ${pagename}`,
		null
	);
	
	mw.util.addPortletLink(
		"p-tb",
		mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Good article reassessment%2F" + pagenameProcessed + "%2F1&to=Good article reassessment%2F" + pagenameProcessed + "%2Fz&namespace=4",
		"GA reassesments",
		"t-GAReassesments",
		`Good article reassesments for ${pagename}`,
		null
	);
	mw.util.addPortletLink(
		"p-tb",
		mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Featured article candidates%2F" + pagenameProcessed + "&to=Featured article candidates%2F" + pagenameProcessed + "%2Farchivez&namespace=4",
		"FA nominations",
		"t-FANominations",
		`Featured article nominations for ${pagename}`,
		null
	);
	mw.util.addPortletLink(
		"p-tb",
		mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Featured article review%2F" + pagenameProcessed + "&to=Featured article review%2F" + pagenameProcessed + "%2Farchivez&namespace=4",
		"FA reviews",
		"t-FAReviews ",
		`Featured article reviews for ${pagename}`,
		null
	);
}

// User and user talk
if (mw.config.get("wgNamespaceNumber") === 2 || mw.config.get("wgNamespaceNumber") === 3) 
{
	mw.util.addPortletLink(
		"p-tb",
		mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Requests+for+bureaucratship%2F" + username + "&to=Requests+for+bureaucratship%2F" + username + "%20z&namespace=4",
		"Requests for bureaucratship",
		"t-RFB",
		`Requests for bureaucratship by ${username}`,
		null,
		"#t-upload"
	);
	
	mw.util.addPortletLink(
		"p-tb",
		mw.config.get("wgServer") + "/w/index.php?title=Special%3AAllPages&from=Requests+for+adminship%2F" + username + "&to=Requests+for+adminship%2F" + username + "%20z&namespace=4", 
		"Requests for adminship",
		"t-RFA",
		`Requests for adminship by ${username}`,
		null,
		"#t-RFB"
	);
}

//[[Category:Wikipedia scripts]]
}());