User:Begoon/addUploadsLink.js

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.
mw.loader.using('mediawiki.util', function () {
	jQuery(function( $ ) {
		var wServerName = mw.config.get('wgServer');
		if (wServerName !== '//commons.wikimedia.org' && document.getElementById("t-contributions")) {
			var rUser =  mw.config.get('wgRelevantUserName');
			var followNode = document.getElementById("t-contributions").nextSibling;
			mw.util.addPortletLink(
				'p-tb', 'https:' + wServerName + '/wiki/Special:ListFiles?limit=250&user=' + rUser.replace(/ /g, '+') + '&ilshowall=1',
				'User file uploads', 't-userfileuploads', 'View list of files uploaded by ' + rUser,'', followNode
			)
		}
	});
});