update to suppport up to version 40

This commit is contained in:
wphiphi 2022-01-02 14:41:01 +01:00 committed by GitHub
parent a8167f9bc5
commit d53a0786ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -870,6 +870,12 @@ function QRDecode(data){
if(mode == 0b0001){
var length_indicator = 10;
if ( version > 9 && version <= 26 ){
length_indicator = 12;
} else if ( version > 26 ){
length_indicator = 14;
}
var num = "";
length = parseInt(data_bits.substring(0, length_indicator), 2);
temp_data += "["+data_bits.substring(0, length_indicator)+"] [";
@ -908,6 +914,12 @@ function QRDecode(data){
} else if(mode == 0b0010){
var length_indicator = 9;
if ( version > 9 && version <= 26 ){
length_indicator = 11;
} else if ( version > 26 ){
length_indicator = 13;
}
var current_data = "";
length = parseInt(data_bits.substring(0, length_indicator), 2);
temp_data += "["+data_bits.substring(0, length_indicator)+"] [";
@ -950,6 +962,10 @@ function QRDecode(data){
} else if(mode == 0b0100){
var length_indicator = 8;
if ( version > 9 ){
length_indicator = 16;
}
var current_data = "";
length = parseInt(data_bits.substring(0, length_indicator), 2);
temp_data += "["+data_bits.substring(0, length_indicator)+"] [";
@ -1232,4 +1248,4 @@ function readDataBits(data_bits){
}
return data.join("");
}
}