User:Writ Keeper/Scripts/mainspaceCreationBlocker.js

mw.hook('wikipage.content').add(function {	if(mw.config.get("wgCanonicalNamespace") == "" && mw.config.get("wgCurRevisionId") == 0)	{		var wgAction = mw.config.get("wgAction");		var draftUrl = "/w/index.php?title=Draft:" + mw.config.get("wgPageName");		if((wgAction == "edit" || wgAction == "submit" || wgAction == "editredlink") || $("html.ve-active").length > 0)		{			if(confirm('You are about to create a page in main article space! Do you want to edit in Draft space instead?\n\n(Hit "OK" to be taken to a draft for this page)'))			{				window.location.assign(draftUrl);			}		}		else		{			$("#ca-edit>a").attr("href", draftUrl).text("Go to Draft");			$("#ca-edit").off("click");			$("#ca-ve-edit>a").attr("href", draftUrl).text("Go to Draft");			$("#ca-ve-edit").off("click");		}	} });