User:Daniel Mietchen/toolbox.js

From Citizendium
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
function addToToolbox() {
  if (wgCanonicalNamespace != "Special") {

   var pTb = document.getElementById("p-tb");
   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);

   addPortletLink("p-refs", "http://tools.wikimedia.de/~verisimilus/Bot/DOI_bot/doibot.php?edit=toolbar&turbo=1&user="+wgUserName+"&page="+wgPageName, 'Automatic (fast)', '', "Add DOIs to citations and fix common formatting errors. Turbo mode!");
   addPortletLink("p-refs", "http://tools.wikimedia.de/~verisimilus/Bot/DOI_bot/doibot.php?edit=toolbar&slow=1&user="+wgUserName+"&page="+wgPageName, 'Automatic (thorough)', '', "Add DOIs to citations and fix common formatting errors");
   addPortletLink("p-refs", "http://tools.wikimedia.de/~verisimilus/Scholar/RefTool.php?user="+wgUserName+"&wgPageName="+wgPageName, 'Semi-automatic (experimental)', '', "Improve formatting of references – manually approve automatic improvements");

   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 + "/"+wgPageName, 'Traffic stats', '', "Traffic to this page " + (thisMonth?'this':'last') + " month");
   addPortletLink("p-stats", "http://wikidashboard.parc.com/wiki/"+wgPageName, 'Edit history stats', '', "Statistics about the edit history of this page");

    }
}
addOnloadHook(addToToolbox);