User:Italic title bot/IT.js

// Adds Template:Italic title] // Created by Legoktm // Modified by Riley Huntley // Adds a tab at the top of the page says "Italic title bot" if(wgNamespaceNumber == 0) { if(wgAction == 'edit' || wgAction == 'submit') { addOnloadHook(function { addPortletLink('p-cactions','javascript:doIt','Italic title bot','ca-It'); }); } else { var url = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=edit&autoit=true'; addOnloadHook(function { addPortletLink('p-cactions',url,'Italic title bot','ca-It'); }); } } if(queryString('autoit')) addOnloadHook(function { doIt; }) function doIt { var txt = document.getElementById('wpTextbox1'); if(!txt) return; txt.value = '{' + '{' + 'Italic title}}\n' + txt.value; document.getElementById('wpSummary').value += 'Robot: Prepending {'+'{Italic title}} to scientific species articles.'; document.getElementById('wpSave').click; } function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }  return null; }