User:Splarka/nulledit.js

if(mw.config.get('wgNamespaceNumber') != -1 && mw.config.get('wgArticleId') != 0) addOnloadHook(nullEditButton)

function nullEditButton() {

mw.util.addPortletLink('p-tb', mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit&nulledit=true','Null edit','t-null','Null edit this page');

}

if(mw.config.get('wgAction') == 'edit' && queryString('nulledit') == 'true') addOnloadHook(nullEdit)

function nullEdit() {

document.getElementById('wpSave').click();

}

function queryString(p) {

var re = RegExp('[&?]' + p + '=([^&]*)');

var matches;

if (matches = re.exec(document.location)) {

try {

return decodeURI(matches[1]);

} catch (e) {

}

}

return null;

}