mirror of
https://github.com/Merricx/qrazybox.git
synced 2024-11-22 02:52:57 +01:00
add textarea text dump in decode mode
This commit is contained in:
parent
6f5439d7a7
commit
3181e2bc6f
1 changed files with 28 additions and 4 deletions
30
js/main.js
30
js/main.js
|
@ -296,6 +296,24 @@ function getInfoBits(){
|
|||
return result;
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* Create text format compatible with Strong Decoder based on qr_array values
|
||||
* from https://github.com/saitouena/qrazybox/commit/b64a0580be81e0d091c544abae3fff5e246dc09c
|
||||
***/
|
||||
function dump_qr_array() {
|
||||
let sz = qr_array.length;
|
||||
dump_qr = "";
|
||||
for(let i=0;i<sz;i++) {
|
||||
let line = qr_array[i].map(x => x===1 ? 'X' : '_').join('');
|
||||
console.log(line);
|
||||
dump_qr += line + "\n"
|
||||
}
|
||||
|
||||
return dump_qr;
|
||||
|
||||
}
|
||||
|
||||
/***
|
||||
*
|
||||
* generate QR code made from canvas based on qr_array values
|
||||
|
@ -303,7 +321,7 @@ function getInfoBits(){
|
|||
***/
|
||||
function generateResult(){
|
||||
|
||||
var c = document.getElementById("qr-result");
|
||||
var c = document.getElementById("qr-result-canvas");
|
||||
var size = 17+(qr_version*4);
|
||||
var ctx = c.getContext("2d");
|
||||
|
||||
|
@ -346,6 +364,12 @@ function generateResult(){
|
|||
}
|
||||
}
|
||||
|
||||
$("#qr-result-dump").attr('rows', qr_version*4 +17 );
|
||||
$("#qr-result-dump").attr('cols', qr_version*4 +17 );
|
||||
$("#qr-result-dump").css( 'font-family', 'Courier New');
|
||||
$("#qr-result-dump").css("font-size", "7px");
|
||||
$("#qr-result-dump").val( dump_qr_array() );
|
||||
|
||||
$("#qr-result").show();
|
||||
$("#qr-table").hide();
|
||||
$("#qr-overlay").hide();
|
||||
|
@ -857,7 +881,7 @@ function bruteForceFormatInfo(){
|
|||
qr_format_array = format_information_bits[i][j].split("").reverse();
|
||||
saveInfoTable(qr_size);
|
||||
generateResult();
|
||||
var image = document.getElementById("qr-result").toDataURL();
|
||||
var image = document.getElementById("qr-result-canvas").toDataURL();
|
||||
if(i == 3 && j == 7){
|
||||
decodeFromBase64(image, function(data){
|
||||
brute_result.push(data);
|
||||
|
@ -1590,7 +1614,7 @@ $(document).ready(function(){
|
|||
$("#div-brute-force-loader").show();
|
||||
bruteForceFormatInfo();
|
||||
} else {
|
||||
var image = document.getElementById("qr-result").toDataURL();
|
||||
var image = document.getElementById("qr-result-canvas").toDataURL();
|
||||
$("#decode-message").val("");
|
||||
$("#div-decode").show();
|
||||
decodeFromBase64(image, function(decodedData){
|
||||
|
|
Loading…
Reference in a new issue