User:QRpedia/vector.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. |
The accompanying .css page for this skin can be added at User:QRpedia/vector.css. |
// 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);