User:Oshwah/AddCustomTabs.js

//This script will only function on the Vector skin. It will not create a tab on the Monobook skin. if (mw.config.get('wgNamespaceNumber') != -1) { /**************************************************	Add Portlet link - see https://www.mediawiki.org/wiki/ResourceLoader/Core_modules#addPortletLink and https://doc.wikimedia.org/mediawiki-core/master/js/#!/api/mw.util-method-addPortletLink for documentation ***************************************************	The first parameter ("p-views") is the Portlet ID of where to add this link. In this instance, 'p-views' is the Portlet ID referring to the vector tabs (Content, Edit, History, etc.)

The second parameter is the URL that the link will take the user to.

The third parameter ("Logs") is the link text, or the name that the Portlet Link will display as.

The fourth parameter ("ca-pageLogs") is the ID name of the link to be given to the new Portlet link you're creating. It should be unique and preferably have the appropriate prefix ('ca-', 'pt-', 'n-' or 't-').

The fifth parameter ("View logs for this page") is the tooltip that is displayed on the new Portlet link being created.

The sixth parameter ('o') is the access key that you wish to assign to the new portlet link. See https://en.wikipedia.org/wiki/Wikipedia:Keyboard_shortcuts#List_of_access_keys to view a list of access keys that are already used by the MediaWiki software.

The seventh parameter ("#ca-history") is the element that the new item should be added before. Must be another item in the same list, or it will be ignored otherwise. Can be specified as DOM reference, as jQuery object, or as CSS selector string. **************************************************/	mw.util.addPortletLink ( 'p-views', 'https://' + mw.config.get("wgServerName") + '/w/index.php?title=Special:Log&page=' + encodeURIComponent(mw.config.get('wgPageName')), 'Logs', 'ca-pageLogs', 'View logs for this page', 'o', '#ca-history');

if(mw.config.get('wgNamespaceNumber') == 2 || mw.config.get('wgNamespaceNumber') == 3){ mw.util.addPortletLink ( 'p-views', 'https://' + mw.config.get("wgServerName") + '/wiki/Special:Contributions/' + encodeURIComponent(mw.config.get('wgRelevantUserName')), 'Contributions', 'ca-contribs', 'View contributions by this user', 'a', '#ca-pageLogs'); } }