User:Btilm/displaytitle.js

This is an old revision of this page, as edited by Xaosflux (talk | contribs) at 11:00, 24 March 2021 (Fix requested on WP:IANB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <nowiki>
//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) {
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) {
addPortletLink("p-cactions", "javascript:rdt()", "rdt", "ca-rdt", "Remove Display Title", "");
}
});