From Wikipedia, the free encyclopedia
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.

/***************************************************************************************************

 * yournav: Customizable navigation portlets

 **************************************************************************************************/

 

// referenceable array for modified portlets

var modifiedPortletsArr = [];

 

// lookup table for links

// links consist of arrays with data to be plugged into addLink()

const links = {

	main_page: "Main Page", "Main page"],

	contents: "Wikipedia:Contents",

	current_events: "Wikipedia:Current events",

	random: "Special:Random", "Random article"],

	about: "Wikipedia:About", "About Wikipedia"],

	contact_us: "Wikipedia:Contact us",

	

	mos: "Wikipedia:Manual of Style",

	

	itn_candidates: "Wikipedia:In the news/Candidates", "In the news candidates"],

	dyk_candidates: "Template talk:Did you know", "Did you know candidates"],

	

	signpost: "Wikipedia:Wikipedia Signpost", "The Signpost"],

	teahouse: "Wikipedia:Teahouse",

	help_desk: "Wikipedia:Help Desk",

	ref_desk: "Wikipedia:Reference desk",

	editor_homepage: "Special:Homepage", "Editor homepage"],

	mentor_dashboard: "Special:Mentor dashboard",

	task_center: "Wikipedia:Task center",

	

	village_pump: "Wikipedia:Village pump",

	vp_policy: "Wikipedia:Village pump (policy)",

	vp_technical: "Wikipedia:Village pump (technical)",

	vp_proposals: "Wikipedia:Village pump (proposals)",

	vp_idea_lab: "Wikipedia:Village pump (idea lab)",

	vp_wmf: "Wikipedia:Village pump (WMF)",

	vp_miscellaneous: "Wikipedia:Village pump (miscellaneous)",

	

	coi_er: "User:AnomieBOT/SPERTable", "CoI edit requests"],

	pb_er: "User:AnomieBOT/SPERTable", "Partial block edit requests"],

	sper: "User:AnomieBOT/SPERTable", "Semi-protected edit requests"],

	eper: "User:AnomieBOT/EPERTable", "Extended-protected edit requests"],

	tper: "User:AnomieBOT/TPERTable", "Template-protected edit requests"],

	per: "User:AnomieBOT/PERTable", "Protected edit requests"],

	iper: "User:AnomieBOT/IPERTable", "Interface-protected edit requests"],

	

	an: "Wikipedia:Administrator's noticeboard", "AN"],

	ani: "Wikipedia:Administrator's noticeboard/Incidents", "AN/I"],

	ufaa: "Wikipedia:Usernames for administrator attention", "UFAA"],

	aiv: "Wikipedia:Administrator intervention against vandalism", "AIV"],

	rfa: "Wikipedia:Requests for adminship",

	

	afd: "Wikipedia:Articles for deletion",

	afd_today: "Wikipedia:Articles for deletion/Log/Today", "AfD today"],

	tfd: "Wikipedia:Templates for deletion",

	tfd_today: "Wikipedia:Templates for deletion/Log/Today", "TfD today"],

	ffd: "Wikipedia:Files for deletion",

	ffd_today: "Wikipedia:Files for deletion/Today", "FfD today"],

	cfd: "Wikipedia:Categories for deletion",

	cfd_today: "Wikipedia:Categories for deletion/Log/Today", "CfD today"],

	rfd: "Wikipedia:Redirects for deletion",

	rfd_today: "Wikipedia:Redirects for deletion/Log/Today", "RfD today"],

	mfd: "Wikipedia:Miscellany for deletion",

	

	google: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.google.com/search?as_eq=wikipedia&q="' + mw.config.get('wgTitle') + '"', "Google", "mel-google");

		}

	},

	

	bing: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.bing.com/search?q="' + mw.config.get('wgTitle') + '" -wikipedia', "Bing", "mel-bing");

		}

	},

	

	ddg: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://duckduckgo.com/?q="' + mw.config.get('wgTitle') + '" -wikipedia', "DuckDuckGo", "mel-ddg");

		}

	},

	

	google_books: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.google.com/search?tbs=bks:1&q="' + mw.config.get('wgTitle') + '" -wikipedia', "Google Books", "mel-google_books");

		}

	},

	

	google_news: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.google.com/search?tbs=nws:1&q="' + mw.config.get('wgTitle') + '" -wikipedia', "Google News", "mel-google_news");

		}

	},

	

	google_scholar: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://scholar.google.com/scholar?q="' + mw.config.get('wgTitle') + '"', "Google Scholar", "mel-google_scholar");

		}

	},

	

	jstor: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.jstor.org/action/doBasicSearch?Query="' + mw.config.get('wgTitle') + '"&acc=on&wc=on', "JSTOR", "mel-jstor");

		}

	},

	

	twl: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://wikipedialibrary.wmflabs.org/search/?q="' + mw.config.get('wgTitle') + '"', "The Wikipedia Library", "mel-twl");

		}

	},

	

	links_here: function(p) {

		mw.util.addPortletLink(p, '/info/en/?search=Special:WhatLinksHere/' + mw.config.get('wgRelevantPageName'), "What links here", "mel-links_here");

	},

	

	related_changes: function(p) {

		mw.util.addPortletLink(p, '/info/en/?search=Special:RecentChangesLinked/' + mw.config.get('wgRelevantPageName'), "Related changes", "mel-related_changes");

	},

	

	permanent_link: function(p) {

		if (mw.config.get("wgIsArticle")) {

		mw.util.addPortletLink(p, 'https://en.wikipedia.org/?title=' + mw.config.get('wgRelevantPageName') + '&oldid=' + mw.config.get("wgCurRevisionId"), "Permanent link", "mel-permalink");

		}

	},

	

	page_information: function(p) {

			mw.util.addPortletLink(p, 'https://en.wikipedia.org/?title=' + mw.config.get('wgRelevantPageName') + '&action=info', "Page information", "mel-page_information");

	},

	

	contributions: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:Contributions/' + mw.config.get('wgRelevantUserName'), "User contributions", "mel-contributions");

		}

	},

	

	user_logs: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:Log/' + mw.config.get('wgRelevantUserName'), "User logs", "mel-user_logs");

		}

	},

	

	mute: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:Mute/' + mw.config.get('wgRelevantUserName'), "User contributions", "mel-contributions");

		}

	},

	

	user_groups: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:UserRights/' + mw.config.get('wgRelevantUserName'), "View user groups", "mel-user_groups");

		}

	},

	

	blocks: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://en.wikipedia.org/?title=Special:Log/block&page=' + mw.config.get('wgPageName'), "View blocks", "mel-blocks");

		}

	},

	

	user_uploads: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:ListFiles/' + mw.config.get('wgRelevantUserName'), "User uploads", "mel-uploads");

		}

	},

	

	user_global: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:CentralAuth/' + mw.config.get('wgRelevantUserName'), "Global account information", "mel-user_global");

		}

	},

	

	filter_log: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://en.wikipedia.org/?title=Special:AbuseLog&wpSearchUser=' + mw.config.get('wgRelevantUserName'), "Filter log", "mel-filter_log");

		}

	},

	

	subpages: function(p) {

		mw.util.addPortletLink(p, '/info/en/?search=Special:PrefixIndex/' + mw.config.get('wgRelevantPageName'), "Subpages", "mel-subpages");

	},

	

	edit_counter: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://xtools.wmcloud.org/ec/en.wikipedia.org/' + mw.config.get('wgRelevantUserName'), "Edit counter", "mel-edit_counter");

		}

	},

	

	pages_created: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://xtools.wmcloud.org/pages/en.wikipedia.org/' + mw.config.get('wgRelevantUserName'), "Pages created", "mel-pages_created");

		}

	},

	

	summary_search: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://sigma.toolforge.org/summary.py?name=' + mw.config.get('wgRelevantUserName'), "Edit summary search", "mel-summary_search");

		}

	},

	

	global_contribs: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://guc.toolforge.org/?by=date&user=' + mw.config.get('wgRelevantUserName'), "Global contributions", "mel-global_contribs");

		}

	},

	

	global_log: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://meta.wikimedia.org/?title=Special:Log&type=globalauth&user=&page=User:' + mw.config.get('wgRelevantUserName') + '@global', "Global log", "mel-global_log");

		}

	},

	

	print: function(p) {

		mw.util.addPortletLink(p, "javascript:print()", "Print", "mel-print");

	}

	

};



class ModifiedPortlet {

	constructor(name) {

		if (["personal", "namespaces", "views", "cactions", "search", "logo", "coll-print-export", "wikibase-otherprojects", "lang"].includes(name)) {

			throw new Error("Attempting to modify an invalid existing portlet");

		}

		this.name = name;

		name = "p-" + name;

		$("#" + name).find("li").hide();

		modifiedPortletsArr.push(this);

	}

	

	addLink(link) {

		if (link in links) {

			link = linkslink];

		} else {

			if (typeof link == "function") {

				// do not accept manually written functions apart from what is already written here

				// maybe not a perfect fix for injections, but idk how to fully prevent them :/

				return;

			}

		}

		

		// switch based on what kind of link is fed to the system

		switch (typeof link) {

			case "string": // basic links

				this.addBasicLink(link);

				break;

			case "function": // custom functions

				link("p-" + this.name);

				break;

			case "object": // arrays; link and label pairs

				this.addBasicLink(link0], link1]);

				break;

		}

	}

	

	addBasicLink(name, label=name.replace(/[A-Za-z ]*:/, ""), node=null) {

		mw.util.addPortletLink(

			"p-navigation",

			"/info/en/?search=" + name.replace(" ", "_"),

			label,

			"mel-" + name.toLowerCase().replace(" ", "-"),

			null,

			null,

			node

		);

	}

}



// debug

new ModifiedPortlet("navigation");

modifiedPortletsArr0].addLink("subpages");
From Wikipedia, the free encyclopedia
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.

/***************************************************************************************************

 * yournav: Customizable navigation portlets

 **************************************************************************************************/

 

// referenceable array for modified portlets

var modifiedPortletsArr = [];

 

// lookup table for links

// links consist of arrays with data to be plugged into addLink()

const links = {

	main_page: "Main Page", "Main page"],

	contents: "Wikipedia:Contents",

	current_events: "Wikipedia:Current events",

	random: "Special:Random", "Random article"],

	about: "Wikipedia:About", "About Wikipedia"],

	contact_us: "Wikipedia:Contact us",

	

	mos: "Wikipedia:Manual of Style",

	

	itn_candidates: "Wikipedia:In the news/Candidates", "In the news candidates"],

	dyk_candidates: "Template talk:Did you know", "Did you know candidates"],

	

	signpost: "Wikipedia:Wikipedia Signpost", "The Signpost"],

	teahouse: "Wikipedia:Teahouse",

	help_desk: "Wikipedia:Help Desk",

	ref_desk: "Wikipedia:Reference desk",

	editor_homepage: "Special:Homepage", "Editor homepage"],

	mentor_dashboard: "Special:Mentor dashboard",

	task_center: "Wikipedia:Task center",

	

	village_pump: "Wikipedia:Village pump",

	vp_policy: "Wikipedia:Village pump (policy)",

	vp_technical: "Wikipedia:Village pump (technical)",

	vp_proposals: "Wikipedia:Village pump (proposals)",

	vp_idea_lab: "Wikipedia:Village pump (idea lab)",

	vp_wmf: "Wikipedia:Village pump (WMF)",

	vp_miscellaneous: "Wikipedia:Village pump (miscellaneous)",

	

	coi_er: "User:AnomieBOT/SPERTable", "CoI edit requests"],

	pb_er: "User:AnomieBOT/SPERTable", "Partial block edit requests"],

	sper: "User:AnomieBOT/SPERTable", "Semi-protected edit requests"],

	eper: "User:AnomieBOT/EPERTable", "Extended-protected edit requests"],

	tper: "User:AnomieBOT/TPERTable", "Template-protected edit requests"],

	per: "User:AnomieBOT/PERTable", "Protected edit requests"],

	iper: "User:AnomieBOT/IPERTable", "Interface-protected edit requests"],

	

	an: "Wikipedia:Administrator's noticeboard", "AN"],

	ani: "Wikipedia:Administrator's noticeboard/Incidents", "AN/I"],

	ufaa: "Wikipedia:Usernames for administrator attention", "UFAA"],

	aiv: "Wikipedia:Administrator intervention against vandalism", "AIV"],

	rfa: "Wikipedia:Requests for adminship",

	

	afd: "Wikipedia:Articles for deletion",

	afd_today: "Wikipedia:Articles for deletion/Log/Today", "AfD today"],

	tfd: "Wikipedia:Templates for deletion",

	tfd_today: "Wikipedia:Templates for deletion/Log/Today", "TfD today"],

	ffd: "Wikipedia:Files for deletion",

	ffd_today: "Wikipedia:Files for deletion/Today", "FfD today"],

	cfd: "Wikipedia:Categories for deletion",

	cfd_today: "Wikipedia:Categories for deletion/Log/Today", "CfD today"],

	rfd: "Wikipedia:Redirects for deletion",

	rfd_today: "Wikipedia:Redirects for deletion/Log/Today", "RfD today"],

	mfd: "Wikipedia:Miscellany for deletion",

	

	google: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.google.com/search?as_eq=wikipedia&q="' + mw.config.get('wgTitle') + '"', "Google", "mel-google");

		}

	},

	

	bing: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.bing.com/search?q="' + mw.config.get('wgTitle') + '" -wikipedia', "Bing", "mel-bing");

		}

	},

	

	ddg: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://duckduckgo.com/?q="' + mw.config.get('wgTitle') + '" -wikipedia', "DuckDuckGo", "mel-ddg");

		}

	},

	

	google_books: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.google.com/search?tbs=bks:1&q="' + mw.config.get('wgTitle') + '" -wikipedia', "Google Books", "mel-google_books");

		}

	},

	

	google_news: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.google.com/search?tbs=nws:1&q="' + mw.config.get('wgTitle') + '" -wikipedia', "Google News", "mel-google_news");

		}

	},

	

	google_scholar: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://scholar.google.com/scholar?q="' + mw.config.get('wgTitle') + '"', "Google Scholar", "mel-google_scholar");

		}

	},

	

	jstor: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://www.jstor.org/action/doBasicSearch?Query="' + mw.config.get('wgTitle') + '"&acc=on&wc=on', "JSTOR", "mel-jstor");

		}

	},

	

	twl: function(p) {

		if (["", "Draft", "User"].includes(mw.config.get('wgCanonicalNamespace'))) {

			mw.util.addPortletLink(p, 'https://wikipedialibrary.wmflabs.org/search/?q="' + mw.config.get('wgTitle') + '"', "The Wikipedia Library", "mel-twl");

		}

	},

	

	links_here: function(p) {

		mw.util.addPortletLink(p, '/info/en/?search=Special:WhatLinksHere/' + mw.config.get('wgRelevantPageName'), "What links here", "mel-links_here");

	},

	

	related_changes: function(p) {

		mw.util.addPortletLink(p, '/info/en/?search=Special:RecentChangesLinked/' + mw.config.get('wgRelevantPageName'), "Related changes", "mel-related_changes");

	},

	

	permanent_link: function(p) {

		if (mw.config.get("wgIsArticle")) {

		mw.util.addPortletLink(p, 'https://en.wikipedia.org/?title=' + mw.config.get('wgRelevantPageName') + '&oldid=' + mw.config.get("wgCurRevisionId"), "Permanent link", "mel-permalink");

		}

	},

	

	page_information: function(p) {

			mw.util.addPortletLink(p, 'https://en.wikipedia.org/?title=' + mw.config.get('wgRelevantPageName') + '&action=info', "Page information", "mel-page_information");

	},

	

	contributions: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:Contributions/' + mw.config.get('wgRelevantUserName'), "User contributions", "mel-contributions");

		}

	},

	

	user_logs: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:Log/' + mw.config.get('wgRelevantUserName'), "User logs", "mel-user_logs");

		}

	},

	

	mute: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:Mute/' + mw.config.get('wgRelevantUserName'), "User contributions", "mel-contributions");

		}

	},

	

	user_groups: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:UserRights/' + mw.config.get('wgRelevantUserName'), "View user groups", "mel-user_groups");

		}

	},

	

	blocks: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://en.wikipedia.org/?title=Special:Log/block&page=' + mw.config.get('wgPageName'), "View blocks", "mel-blocks");

		}

	},

	

	user_uploads: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:ListFiles/' + mw.config.get('wgRelevantUserName'), "User uploads", "mel-uploads");

		}

	},

	

	user_global: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, '/info/en/?search=Special:CentralAuth/' + mw.config.get('wgRelevantUserName'), "Global account information", "mel-user_global");

		}

	},

	

	filter_log: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://en.wikipedia.org/?title=Special:AbuseLog&wpSearchUser=' + mw.config.get('wgRelevantUserName'), "Filter log", "mel-filter_log");

		}

	},

	

	subpages: function(p) {

		mw.util.addPortletLink(p, '/info/en/?search=Special:PrefixIndex/' + mw.config.get('wgRelevantPageName'), "Subpages", "mel-subpages");

	},

	

	edit_counter: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://xtools.wmcloud.org/ec/en.wikipedia.org/' + mw.config.get('wgRelevantUserName'), "Edit counter", "mel-edit_counter");

		}

	},

	

	pages_created: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://xtools.wmcloud.org/pages/en.wikipedia.org/' + mw.config.get('wgRelevantUserName'), "Pages created", "mel-pages_created");

		}

	},

	

	summary_search: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://sigma.toolforge.org/summary.py?name=' + mw.config.get('wgRelevantUserName'), "Edit summary search", "mel-summary_search");

		}

	},

	

	global_contribs: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://guc.toolforge.org/?by=date&user=' + mw.config.get('wgRelevantUserName'), "Global contributions", "mel-global_contribs");

		}

	},

	

	global_log: function(p) {

		if (["User", "User talk"].includes(mw.config.get("wgCanonicalNamespace"))) {

			mw.util.addPortletLink(p, 'https://meta.wikimedia.org/?title=Special:Log&type=globalauth&user=&page=User:' + mw.config.get('wgRelevantUserName') + '@global', "Global log", "mel-global_log");

		}

	},

	

	print: function(p) {

		mw.util.addPortletLink(p, "javascript:print()", "Print", "mel-print");

	}

	

};



class ModifiedPortlet {

	constructor(name) {

		if (["personal", "namespaces", "views", "cactions", "search", "logo", "coll-print-export", "wikibase-otherprojects", "lang"].includes(name)) {

			throw new Error("Attempting to modify an invalid existing portlet");

		}

		this.name = name;

		name = "p-" + name;

		$("#" + name).find("li").hide();

		modifiedPortletsArr.push(this);

	}

	

	addLink(link) {

		if (link in links) {

			link = linkslink];

		} else {

			if (typeof link == "function") {

				// do not accept manually written functions apart from what is already written here

				// maybe not a perfect fix for injections, but idk how to fully prevent them :/

				return;

			}

		}

		

		// switch based on what kind of link is fed to the system

		switch (typeof link) {

			case "string": // basic links

				this.addBasicLink(link);

				break;

			case "function": // custom functions

				link("p-" + this.name);

				break;

			case "object": // arrays; link and label pairs

				this.addBasicLink(link0], link1]);

				break;

		}

	}

	

	addBasicLink(name, label=name.replace(/[A-Za-z ]*:/, ""), node=null) {

		mw.util.addPortletLink(

			"p-navigation",

			"/info/en/?search=" + name.replace(" ", "_"),

			label,

			"mel-" + name.toLowerCase().replace(" ", "-"),

			null,

			null,

			node

		);

	}

}



// debug

new ModifiedPortlet("navigation");

modifiedPortletsArr0].addLink("subpages");

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook