Jump to content

User:Finnrind/toolbox.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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.
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(mw.config.get('wgPageName'));

   mw.util.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!");
   mw.util.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;
   mw.util.addPortletLink("p-stats", "http://stats.grok.se/en/" + now.getFullYear() + month + "/"+encodeURI(wgPageName), 'Traffic stats', '', "Traffic to this page " + (thisMonth?'this':'last') + " month");
   mw.util.addPortletLink("p-stats", "http://wikidashboard.parc.com/wiki/"+encodeURI(wgPageName), 'Edit history stats', '', "Statistics about the edit history of this page");
   mw.util.addPortletLink("p-stats", "http://toolserver.org/~mzmcbride/watcher/?db=enwiki_p&titles="+encodeURIComponent(mw.config.get('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);
}