Fixed a bug and reordered a line of code in the JavaScript demo script.

pull/4/head
Nayuki Minase 9 years ago
parent 5692e951dd
commit ee88ce819c

@ -78,17 +78,17 @@ function redrawQrCode() {
stats += "alphanumeric"; stats += "alphanumeric";
else if (mode == qrcodegen.QrSegment.Mode.BYTE) else if (mode == qrcodegen.QrSegment.Mode.BYTE)
stats += "byte"; stats += "byte";
else if (mode == qrcodegen.QrSegment.Mode.BYTE) else if (mode == qrcodegen.QrSegment.Mode.KANJI)
stats += "kanji"; stats += "kanji";
else else
stats += "unknown"; stats += "unknown";
} else } else
stats += "multiple"; stats += "multiple";
stats += ", error correction = level " + "LMQH".charAt(qr.getErrorCorrectionLevel().ordinal) + ", ";
var databits = 0; var databits = 0;
segs.forEach(function(seg) { segs.forEach(function(seg) {
databits += 4 + seg.getMode().numCharCountBits(qr.getVersion()) + seg.getBits().length; databits += 4 + seg.getMode().numCharCountBits(qr.getVersion()) + seg.getBits().length;
}); });
stats += ", error correction = level " + "LMQH".charAt(qr.getErrorCorrectionLevel().ordinal) + ", ";
stats += "data bits = " + databits + "."; stats += "data bits = " + databits + ".";
var elem = document.getElementById("statistics-output"); var elem = document.getElementById("statistics-output");
while (elem.firstChild != null) while (elem.firstChild != null)

Loading…
Cancel
Save