User:Gary/custom minor edits.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Gary/custom minor edits. |
/*
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").
NOTE: "Wikipedia" namespace is "Project" in this script.
*/
if (typeof(unsafeWindow) != 'undefined')
{
mw = unsafeWindow.mw;
}
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();
});