Zum Inhalt springen

„Benutzer:Prolineserver/QRWPcode.js“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
Inhalt gelöscht Inhalt hinzugefügt
Keine Bearbeitungszusammenfassung
QRcode in sidebar
Zeile 20: Zeile 20:
// Set up toolbox basics
// Set up toolbox basics
var tid="t-qrcode",
var tid="t-qrcode",
timgid="t-qrcode-img",
ttxt="QRWP code",
ttxt="QRWP code",
rhref=location.href
rhref=location.href
Zeile 27: Zeile 28:
// Create link
// Create link
var tul=document.getElementById("t-whatlinkshere"),ta=document.createElement("a"),tli=document.createElement("li");
var tul=document.getElementById("t-whatlinkshere"),ta=document.createElement("a"),tli=document.createElement("li");
ta.appendChild(document.createTextNode(ttxt));
//ta.appendChild(document.createTextNode(ttxt));
var timg = document.createElement("img");
timg.id = timgid;
timg.src = thref;
timg.width = 120;
timg.title = ttxt;
timg.alt = ttxt;
ta.appendChild(timg);
ta.href=thref;
ta.href=thref;
tli.appendChild(ta);
tli.appendChild(ta);

Version vom 23. September 2011, 00:18 Uhr

/**************************************************************************/
/* 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",
 timgid="t-qrcode-img",
 ttxt="QRWP code",
 rhref=location.href
 rhref=rhref.replace("de.wikipedia.org/wiki/", "de.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));
var timg = document.createElement("img");
timg.id = timgid;
timg.src = thref;
timg.width = 120;
timg.title = ttxt;
timg.alt = ttxt;
ta.appendChild(timg);
ta.href=thref;
tli.appendChild(ta);
tli.id=tid;
tul.parentNode.appendChild(tli);