Jump to content

User:Aua/tag.js

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by Amorymeltzer (talk | contribs) at 15:53, 7 February 2021 (Remove legacy globals per phab:T72470 (via WP:JWB)). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
//Simply to add tag to WikiProjects
//You have to be in edit mode to try it

//<nowiki>
if(mw.config.get('wgCanonicalNamespace') == 'Talk' && mw.config.get('wgAction')=="view") addOnloadHook(function() {
  addPortletLink('p-cactions','javascript:addSomeText("{{Iraq}}")', 'I');
});
function addSomeText(text) { 
    location.href=mw.config.get('wgServer')+mw.config.get('wgScript')+'?title=' + mw.config.get('wgPageName') + "&action=edit";
}
if(mw.config.get('wgCanonicalNamespace') == 'Talk' && mw.config.get('wgAction')=="edit") addOnloadHook(function() {
  addPortletLink('p-cactions','javascript:hmm("{{Iraq}}")', 'I');
});
function hmm(text) { 
    txtb = document.getElementById('wpTextbox1');
    txtb.value += text;
    document.getElementById('wpTextbox1').value+="";
    document.getElementById('wpSummary').value=
      "Tagged with [[WP:IRAQ| WikiProject Iraq]]";
    document.getElementById('wpSave').click();
}
//</nowiki>