( function () {
var shortdesc = $(mw.util.addPortletLink('p-personal','#','Short Description','Add-a-Short-Description','Add a Short Description','','#pt-mytalk'));
$( shortdesc ).click( function() {
if(document.getElementById("mw-content-text").innerHTML.includes('
')){
alert("This page already has a short description.");
}
else{
var shortd = prompt("Enter Short Description", "");
if (shortd === null || shortd === "") {
} else {
var params = {
action: 'edit',
title: mw.config.get("wgPageName"),
prependtext: `{{Short description|"+shortd+"}}
`,
summary: 'Short Description automatically added with AutoShortDesc',
format: 'json'
};
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
//alert( data );
} );
}
}
});
}() );