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>