Usuari:Victuallers/vector.js

De la Viquipèdia, l'enciclopèdia lliure

Nota: Després de desar, heu de netejar la memòria cau del navegador per veure els canvis. En la majoria de navegadors amb Windows o Linux, premeu Ctrl+F5 o bé premeu Shift i cliqueu el botó "Actualitza" (Ctrl i "Actualitza" amb Internet Explorer). Vegeu més informació i instruccions per a cada navegador a Viquipèdia:Neteja de la memòria cau.

/**************************************************************************/
/* Userscript to add a QRWP code display option to toolbar
/*
/* Generates a QRWP code image using the current Wikipedia page URL.
/* Demo version so use at your own risk!
/*
/* Initial failure to display in the Toolbox may be due to:
/* . needing to purge the page cache
/* . or you may be on a page without "What links here"
/* . the order of javascript changes might stop the link being added. If you 
/*   have 'addOnloadHook', it may need to run there rather than earlier.
/*
/* Link: http://enwp.org/User:Fæ/QRcode.js
/* More info on QR codes: http://enwp.org/QR_code
/* More info on QRWP codes:
/* Created by Fae: 2 Feb 2011 
/* Modified March 2011 to use enwp.org or qrwp.org in preference by Victuallers
/**************************************************************************/
 
// Set up toolbox basics
var tid="t-qrcode",
 ttxt="QRWP code",
 rhref=location.href
 rhref=rhref.replace("ca.wikipedia.org/wiki/", "ca.QRWp.Org/"); /* change domain name and lose /wiki */
 thref='http://qrcode.kaywa.com/img.php?s='+5+'&d='+rhref; /* parameters: s=size, d=url */
 
// 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;
tul.parentNode.appendChild(tli);