MediaWiki:Gadget-NoUploadWizard.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
/**
 * This gadget changes the Upload link from UploadWizard to the classic upload form
 *
 * Dependencies: mediawiki.util
 * Rights required: upload
 */
/*global $, mw*/
$( function () {
	var lang, dest;
	lang = mw.config.get( 'wgUserLanguage' );
	// This change is a no-op in 'de' as UW is disabled by default for those users
	// see [[MediaWiki:Upload-url/de]]
	dest = lang === 'en' ? 'Commons:Upload' : 'Special:MyLanguage/Commons:Upload';
	$( 'a#n-uploadbtn, li#n-uploadbtn a' ).attr( 'href', mw.util.getUrl( dest ) );
} );