You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
609 B
28 lines
609 B
var qrcode = null;
|
|
var qrtext = null;
|
|
function init() {
|
|
qrtext = document.getElementById("qrtext");
|
|
qrcode = new QRCode(document.getElementById("qrcode"), {
|
|
correctLevel : QRCode.CorrectLevel.L,
|
|
colorDark: '#333',
|
|
colorLight: '#f0f0f0'
|
|
});
|
|
qrtext.focus();
|
|
parseLocation();
|
|
}
|
|
function parseLocation() {
|
|
var term = window.location.search || window.location.hash;
|
|
if(term.length > 1) {
|
|
qrtext.value = decodeURIComponent(term.substring(1));
|
|
makeCode(qrtext);
|
|
}
|
|
}
|
|
function makeCode (input) {
|
|
if (!input.value) {
|
|
qrcode.clear();
|
|
input.focus();
|
|
return;
|
|
}
|
|
|
|
qrcode.makeCode(input.value);
|
|
}
|