user:btilm/displaytitle.js
//
//created by btilm
function adt() {
var pro = prompt('Enter wanted title.',wgTitle);
if ( pro==null || pro=="" || pro==wgTitle) {
alert('Aborted');
return}
document.editform.wpTextbox1.value = '{{DISPLAYTITLE:' + pro + '}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = 'added displaytitle tag';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
addOnloadHook(function() {
if (document.editform) {
mw.util.addPortletLink("p-cactions", "javascript:adt()", "adt", "ca-adt", "Add Display Title", "");
}
});
function rdt() {
var txt = document.editform.wpTextbox1;
txt.value = txt.value.replace(/{{DISPLAYTITLE.*}}\n/gim, "");
document.editform.wpSummary.value = 'removed displaytitle tag';
document.editform.wpMinoredit.checked = true;
document.editform.submit();
}
addOnloadHook(function() {
if (document.editform) {
mw.util.addPortletLink("p-cactions", "javascript:rdt()", "rdt", "ca-rdt", "Remove Display Title", "");
}
});
//