Jump to content

User:QRpedia/vector.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.
// importScript('User:Victuallers/QRcode.js'); //QRWR code on toolbar
/**************************************************************************/
/* Userscript to add a QRWP.org code display option to toolbar
/*
/* Generates a QRWP.org code image using the current Wikipedia page URL.
/* Demo version so use at your own risk!
/*
/*
/* More info on QR codes: http://qrwp.org/QR_code
/* More info on QRWP codes: http://qrpedia.org
/* Created by edent: 3 April 2011 
/**************************************************************************/

// Set up toolbox basics
var tid="t-qrcode",
 ttxt="Create QR code",
 rhref=location.href
 rhref=rhref.replace("wikipedia.org/wiki/", "qrwp.org/"); // Keep language. Change domain name. Correct path
 thref='http://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=q&chl='+rhref; // Google Chart API

// Create link
var tul=document.getElementById("t-whatlinkshere"),ta=document.createElement("a"),tli=document.createElement("li");
ta.appendChild(document.createTextNode(ttxt));
ta.href=thref;
tli.appendChild(ta);
tli.id=tid;
if(tul) tul.parentNode.appendChild(tli);