User:Btilm/bt.js

From Wikipedia, the free encyclopedia
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.
function bt() {
document.location=mw.config.get('wgServer') + mw.config.get('wgScript') + "?title=" + wgPageName + "&action=edit&bt=yes";
}
 
$(function() {
mw.util.addPortletLink("p-cactions","javascript:bt()","bold","ca-bt","Bold the title","");
 
  if (location.href.indexOf("&action=edit&bt=yes") == -1) return;
  var textbox = document.getElementById('wpTextbox1').value
  var bold = textbox.replace(wgTitle,"\'\'\'" + wgTitle + "\'\'\'");
  document.getElementById('wpTextbox1').value = bold;
  document.getElementById('wpSummary').value = "bolded title";
  document.getElementById('wpMinoredit').checked = true;
  document.getElementById('editform').submit();
});