User:CBM/nostubtagtab.js

From wikishia

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// Remove stub tags from article 
// Originally by [[User:ais523]], on a request by [[User:thesublime514]].
// ([[User:ais523/stubtagtab.js]])

// Modified slightly by CBM

// <source lang="javascript">
addOnloadHook(function(){
  if(wgNamespaceNumber==0&&wgAction=="view")
  {
    if(document.getElementById("ca-edit"))
      addPortletLink('p-cactions', 'javascript:rmstubtagtab()', 'nostub', 'ca-nostubtag',
                                   'Remove stub tags from this page', '');
  }
  if(location.href.indexOf("&autormstubtag=")!=-1&&  
                 document.getElementById('wpTextbox1')!=null)
  {
    var x=decodeURIComponent(location.href.split("&autormstubtag=")[1]);
    if(x=="") x="stub"; else x+="-stub";
    var text = document.getElementById('wpTextbox1').value;
    text = text.replace(/\{\{[a-zA-Z -]+-stub\}\}/g,  '');
    document.getElementById('wpTextbox1').value = text ;
    document.getElementById('wpSummary').value=
      "Removing stub tag(s)";
    document.getElementById('wpDiff').click();
  }
});

function rmstubtagtab()
{
  location.href=wgServer+wgScript+"?title="+encodeURIComponent(wgPageName)+                                  
                "&action=edit&autormstubtag=1";
}

// </source> [[Category:Wikipedia scripts]]