User:Microchip08/stubbifyme.js
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.
// [[en:Cassandra (Doctor Who)|Stubbify me! Stubbify me!]]
// ( adapted from [[en:User:ais523/stubtagtab.js]]) <nowiki>
// <source lang="javascript">
$(function(){
if(wgNamespaceNumber==0&&wgAction=="view")
{
if(document.getElementById("ca-edit"))
mw.util.addPortletLink('p-cactions', 'javascript:stubtagtab()', 'stub', 'ca-stubtag',
'Add a stub tag to this page', '');
}
if(location.href.indexOf("&autoaddstubtag=")!=-1&&document.getElementById('wpTextbox1')!=null)
{
var x=decodeURIComponent(location.href.split("&autoaddstubtag=")[1]);
if(x=="") x="stub"; else x+="-stub";
document.getElementById('wpTextbox1').value.replace("{{stub}}","{{"+x+"}}");
document.getElementById('wpSummary').value=
"Tagging with {"+"{"+x+"}} - [[Wikipedia:Simple_Stub_Project|you can help!]]( [[User:Microchip08/megabook|MB]])";
}
});
function stubtagtab()
{
var x=prompt("Which stub tag? (Leave blank for {"+
"{stub}}; otherwise -stub will be added to the name)");
if(x==null) return;
location.href=mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+
"&action=edit&autoaddstubtag="+encodeURIComponent(x);
}
//</nowiki> (leave these tags in place, or they'll categorise this page as stubs