User:Gary/custom minor edits.js

/*

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();

});