Jump to content

User:Gary/custom minor edits.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gary (talk | contribs) at 05:33, 12 March 2011 (creating). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
/*
	CUSTOM MINOR EDITS
	Description: Force minor edits on whichever namespaces are specificed. Can either use names or numbers, from [[Wikipedia:Namespace]].
	
	Example:
		minorEditNamespaces = ['Main', 2];
		
	The above example would set minor edits as default for the "Main" namespace (for Articles) and "2" namespace (ID number for "User").
*/

if (typeof(unsafeWindow) != 'undefined')
{
	var mw = unsafeWindow.mw;
}

var minorEditNamespaces = ['Main', 2];

function customMinorEdits()
{
	if (mw.config.get('wgAction') != 'edit' || typeof(minorEditNamespaces) == 'undefined' || minorEditNamespaces.length == 0) return false;
	
	var checkbox = $('#wpMinoredit');
	if (!checkbox.length) return false;
	
	if ($.inArray(mw.config.get('wgCanonicalNamespace'), minorEditNamespaces) != -1 || $.inArray(mw.config.get('wgNamespaceNumber'), minorEditNamespaces) != -1)
	{
		checkbox.attr('checked', true);
	}
}

$(document).ready(function()
{
	customMinorEdits();
});