User:Btilm/displaytitle.js

This is an old revision of this page, as edited by Btilm (talk | contribs) at 00:47, 13 November 2009 (me). 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.
addOnloadHook(function()
    addPortletLink(
      "p-personal", //target tab - personal links
      javascript:dt(), //link URL
      "dt", //link text
      "pt-dt" //id of new button
      "dt", //hover text
      "", //???
));
 
  if (___location.href.indexOf("&action=edit&dt=") == -1) return;
  dtRegExp = /&action=edit&newstatus=(.*)/;
  dt = dtRegExp.exec(___location.href)[1];
  document.getElementById('wpTextbox1').value = "{{" + dt + "}}" + document.getElementById('wpTextbox1').value;
  document.getElementById('wpSummary').value = "added displaytitle tag";
  document.getElementById('wpMinoredit').checked = true;
  document.getElementById('editform').submit();
});

function dt() {
var pro2=prompt('Enter desired title','wgTitle');
if (pro2==null || pro2==wgTitle || pro2=="") {
 alert('Aborted');
 return};
document.___location=wgServer + wgScript + "?title=" + wgPageName + "&action=edit&dt=" + pro2;
}