Jump to content

User:Le Deluge/vector.js

From Wikipedia, the free encyclopedia
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.
mw.loader.load('//en.wikipedia.org/w/index.php?title=User%3AAndyZ%2Fpeerreviewer.js&action=raw&ctype=text/javascript'); // [[User:AndyZ/peerreviewer.js]]
// if you are using the "expand citations" gadget, then you'll want to install toolbox2.js instead or the links will be duplicated
importScript("User:Smith609/citations.js");
function addToToolbox() {
  if (mw.config.get('wgCanonicalNamespace') != "Special") {

   var pTb = document.getElementById("p-tb");
   if( !pTb ) return;

   var pStats = pTb.cloneNode(true);

   pStats.id="p-stats";

pStats.innerHTML = "<label id='p-interaction-label'	class='vector-menu-heading '><span class='vector-menu-heading-label'>My links</span></label><div class='vector-menu-content'></div>";
   pTb.parentNode.insertBefore(pStats, pTb.nextSibling);

/*   var now = new Date();
   var month = now.getMonth();
   var year = now.getFullYear();
   var thisMonth = (now.getDay() > 6);
   if (thisMonth) month++;
   if (month == 0) {
      month = 12;
      year--;
   } else month = ((month <10)?'0':'') + month; */
   mw.util.addPortletLink("p-stats", "https://pageviews.toolforge.org/?project=en.wikipedia.org&platform=all-access&agent=user&redirects=0&range=latest-30&pages=" + encodeURI(mw.config.get('wgPageName')), 'Traffic stats', '', "Traffic to this page in the last month");
   mw.util.addPortletLink("p-stats", "https://en.wikipedia.org/w/index.php?action=edit&preview=yes&summary=Created%20with%20the%20help%20of%20Template:Copycat&section=0&preload=Template:Copycat%20preload&title=" + encodeURI(mw.config.get('wgPageName')), 'Copycat', '', "Try to clone a sibling of a YYYY category");
    }
}

if( $.inArray( mw.config.get( 'skin' ), [ "myskin" , "simple" , "monobook" , "modern", "chick" , "vector" ] ) !== -1 ) {
  $( addToToolbox );
}