User:Smith609/toolbox.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Smith609/toolbox. |
function addToToolbox() {
if (wgCanonicalNamespace != "Special") {
var pTb = document.getElementById("p-tb");
if( !pTb ) return;
var pRef = pTb.cloneNode(true);
var pStats = pTb.cloneNode(true);
pRef.id="p-refs";
pRef.innerHTML = "<h5>Reference formatting</h5><div class=pBody><ul></ul></div>";
pStats.id="p-stats";
pStats.innerHTML = "<h5>Statistics</h5><div class=pBody><ul></ul></div>";
pTb.parentNode.insertBefore(pRef, pTb.nextSibling);
pTb.parentNode.insertBefore(pStats, pRef);
var escPageName = encodeURIComponent(wgPageName);
addPortletLink("p-refs", "http://toolserver.org/~verisimilus/Bot/DOI_bot/doibot.php?edit=toolbar&turbo=1&user="+encodeURIComponent(wgUserName)+"&page="+escPageName, 'Automatic (fast)', '', "Add DOIs to citations and fix common formatting errors. Turbo mode!");
addPortletLink("p-refs", "http://toolserver.org/~verisimilus/Bot/DOI_bot/doibot.php?edit=toolbar&slow=1&user="+encodeURIComponent(wgUserName)+"&page="+escPageName, 'Automatic (thorough)', '', "Add DOIs to citations and fix common formatting errors");
//addPortletLink("p-refs", "http://toolserver.org/~verisimilus/Scholar/RefTool.php?user="+wgUserName+"&wgPageName="+escPageName, 'Semi-automatic (experimental)', '', "Improve formatting of references – manually approve automatic improvements");
var now = new Date();
var month = now.getMonth();
var thisMonth = (now.getDay() > 6);
if (thisMonth) month++;
if (month == 0) var month=12;
else var month = ((month <10)?'0':'') + month;
addPortletLink("p-stats", "http://stats.grok.se/en/" + now.getFullYear() + month + "/"+encodeURI(wgPageName), 'Traffic stats', '', "Traffic to this page " + (thisMonth?'this':'last') + " month");
addPortletLink("p-stats", "http://wikidashboard.parc.com/wiki/"+encodeURI(wgPageName), 'Edit history stats', '', "Statistics about the edit history of this page");
addPortletLink("p-stats", "http://toolserver.org/~mzmcbride/watcher/?db=enwiki_p&titles="+encodeURIComponent(wgPageName), 'Page watchers', "Number of people with this page on their watchlist");
}
}
if( skin == "myskin" || skin == "simple" || skin == "monobook" || skin == "modern" || skin == "chick" || skin == "vector") {
addOnloadHook(addToToolbox);
}
// Add a citation bot button
function addCitationBot() {
if (document.getElementById('wpDiff')){
var diff = document.getElementById('wpDiff');
var cbButton = document.createElement("input");
cbButton.value="Citation bot";
cbButton.type="submit";
originalAction=document.getElementById('editform').getAttribute('action');
cbButton.setAttribute("onmousedown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/DOI_bot/text.php')");
cbButton.setAttribute("onkeydown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/DOI_bot/text.php')");
diff.setAttribute("onmousedown", originalAction);
diff.setAttribute("onkeydown", originalAction);
document.getElementById('wpPreview').setAttribute("onmousedown", originalAction);
document.getElementById('wpPreview').setAttribute("onkeydown", originalAction);
document.getElementById('wpSave').setAttribute("onmousedown", originalAction);
document.getElementById('wpSave').setAttribute("onkeydown", originalAction);
diff.parentNode.insertBefore(cbButton, diff.nextSibling);
}
}
addOnloadHook(addCitationBot);