User:Mr. Stradivarius/gadgets/CommonsUploads.js

/* This script adds a toolbox link to a user's Commons uploads when on a page * relevant to them, e.g. their user page or user talk page. To use it, add

importScript('User:Mr. Stradivarius/gadgets/CommonsUploads.js'); // Linkback: User:Mr. Stradivarius/gadgets/CommonsUploads.js

* to your common.js page. */

mw.loader.using( [ 'mediawiki.util' ], function {	"use strict";

var username = mw.config.get( 'wgRelevantUserName' ); if ( !username ) { return; }

mw.util.addPortletLink(		'p-tb',		'https://commons.wikimedia.org/wiki/Special:ListFiles/' + mw.util.wikiUrlencode( username ),		'Commons uploads',		't-cuploads',		'Files this user has uploaded on Commons',		null,		'#t-emailuser'	); } );