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.
//Start stub script

addOnloadHook(function()
{
  //check if called from stub request
  if (document.URL.lastIndexOf("action=edit") != -1)
  {
    if (document.URL.lastIndexOf("&stub=yes") != -1)
    {
      var type = window.prompt("Enter stub type (press cancel or enter for plain stub tag)");
      var tag = "{" + "{stub}}";
      if(type != null){
           tag = "{"+"{"+type+"-stub}}";
      }
      document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + "\n\n"+tag;
      document.editform.wpSummary.value = "Added stub tag";
      document.editform.wpSave.click();
      return;
    }
  }
  if (wgCanonicalNamespace == "Special"){
    return;
}
  mw.util.addPortletLink("p-cactions", "javascript:easyStub(0)", "stub", "ca-stub", "Add stub tag", "");
});
 
function easyStub()
{
  var title = wgPageName.replace("&", "%26").replace("+", "%21");
  location.assign("/w/index.php?action=edit&stub=yes&title=" + title);
}


//End stub script
//