User:Btilm/displaytitle.js: Difference between revisions

Content deleted Content added
title
me
Line 1:
addOnloadHook(function() {
//created by btilm
addPortletLink(
function adt() {
"p-personal", //target tab - personal links
var pro = prompt('Enter wanted title.',wgTitle);
javascript:dt(), //link URL
if ( pro==null || pro=="" || pro==wgTitle) {
"dt", //link text
alert('Aborted');
"pt-dt" //id of new button
return}
"dt", //hover text
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();
}
if (___location.href.indexOf("&action=edit&dt=") == -1) return;
addOnloadHook(function() {
dtRegExp = /&action=edit&newstatus=(.*)/;
if (document.editform) {
dt = dtRegExp.exec(___location.href)[1];
addPortletLink("p-cactions", "javascript:adt()", "adt", "ca-adt", "Add Display Title", "");
document.editform.getElementById('wpTextbox1').value = '"{{DISPLAYTITLE:'" + prodt + '"}}\n'" + document.editform.getElementById('wpTextbox1').value;
}
document.editform.getElementById('wpSummary').value = '"added displaytitle tag'";
document.editform.getElementById('wpMinoredit').checked = true;
document.getElementById('editform').submit();
});
 
function rdtdt() {
var pro pro2= prompt('Enter wanteddesired title.','wgTitle');
var txt = document.editform.wpTextbox1;
if ( propro2==null || propro2==""wgTitle || propro2==wgTitle"") {
txt.value = txt.value.replace(/{{DISPLAYTITLE.*}}\n/gim, "");
alert('Aborted');
document.editform.wpSummary.value = 'removed displaytitle tag';
return};
document.editform.wpMinoredit.checked = true;
document.___location=wgServer + wgScript + "?title=" + wgPageName + "&action=edit&dt=" + pro2;
document.editform.submit();
}
addOnloadHook(function() {
if (document.editform) {
addPortletLink("p-cactions", "javascript:rdt()", "rdt", "ca-rdt", "Remove Display Title", "");
}
});