// Adds [[Template:Italic title]]]
// Created by [[User:Legoktm|Legoktm]]
// Modified by [[User:Riley Huntley|Riley Huntley]]
// Adds a tab at the top of the page says "It"
if(wgNamespaceNumber == 0) {
if(wgAction == 'edit' || wgAction == 'submit') {
addOnloadHook(function () { mw.util.addPortletLink('p-cactions','javascript:doIt()','___IT___','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 () { mw.util.addPortletLink('p-cactions',url,'___IT___','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 = 'Adding {' '{[[Template:Italic title|Italic title]]}}';
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;
}