-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnulledit.js
More file actions
35 lines (30 loc) · 818 Bytes
/
nulledit.js
File metadata and controls
35 lines (30 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// From [[User:Splarka/nulledit.js]] and [[User:MZMcBride/nulledit.js]]
function queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches = re.exec(document.location);
if (matches) {
try {
return decodeURI(matches[1]);
} catch (e) {
mw.log.warn(e.toString());
return matches[1];
}
}
return null;
}
$(function () {
if (mw.config.get('wgNamespaceNumber') !== -1 && mw.config.get('wgArticleId') !== 0) {
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'
);
}
});
$(function () {
if (mw.config.get('wgAction') === 'edit' && queryString('nulledit') === 'true') {
document.getElementById('wpSave').click();
}
});