Jump to content

User talk:Equazcion/SkipFileWizard.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Edit request: update and clean up code

[edit]

This userscript relies on outdated and deprecated methods, so I would suggest the following update, which I have written myself basically from scratch. The functionality is the same, but the code is (I hope) cleaner and easier to understand and maintain. Please replace the entire script with the one below.

if (typeof SkipFileWizardOption == 'undefined') {
	SkipFileWizardOption = 'FileSpace';
}

$( 'a.new[href*="wpDestFile"]' ).attr( 'href', function (index, value) {
	if ( SkipFileWizardOption == 'FileSpace' ) {
		var fileTitle = mw.util.getParamValue( 'wpDestFile', value );
		var fileName = mw.config.get( 'wgFormattedNamespaces' )[6] + ':' + fileTitle;
		var params = {
			action: 'edit',
			redlink: 1
		};
		return mw.util.getUrl( fileName, params );
	} else {
		return mw.util.getUrl( 'Special:Upload' );
	}
} );

— Preceding unsigned comment added by HueSatLum (talkcontribs) 16:11, 24 July 2015

Seems like Equazcion (talk · contribs) has left the building. I'll leave this for a JS expert to check through. --Redrose64 (talk) 19:29, 24 July 2015 (UTC)[reply]
Done Thanks for your work on this. — Mr. Stradivarius ♪ talk ♪ 17:03, 25 July 2015 (UTC)[reply]