// <nowiki>
function startstub() {
if (location.href.indexOf('&action=edit&stub') == -1) return;
var editb = document.editform.wpTextbox1.value;
var str = /\n(\n)?{{.*stub}}/
var result = str.test(editb);
if (result==false)
addit();
else
removeit();
}
function stub() {
var encode=encodeURIComponent(mw.config.get('wgPageName'))
document.location=mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + encode + "&action=edit&stub";
}
function addit() {
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n\n{{stub}}';
addede=true;
end1()}
function removeit() {
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n(\n)?{{.*stub}}/, "");
addede=false;
end1()}
function end1() {
var addremove;
if (addede==true)
addremove = 'Added'
else
addremove = 'Removed'
document.editform.wpSummary.value = addremove + ' stub tag.';
document.editform.wpMinoredit.checked = false;
document.editform.submit();}
$(function() {
mw.util.addPortletLink("p-cactions", "javascript:stub()", "±stub", "ca-stub", "Add stub tag.", "");
startstub()
});
// </nowiki>