mirror of
https://github.com/Merricx/qrazybox.git
synced 2024-11-24 11:42:58 +01:00
commit
e924a9c27a
2 changed files with 32 additions and 32 deletions
22
index.html
22
index.html
|
@ -512,40 +512,40 @@
|
|||
</div>
|
||||
<!-- END DATA MASKING OVERLAY -->
|
||||
|
||||
<!-- START PADDING BITS RECOVERY OVERLAY -->
|
||||
<div class="overlay hide" id="div-padding-recovery">
|
||||
<!-- START PATCHING BITS RECOVERY OVERLAY -->
|
||||
<div class="overlay hide" id="div-patching-recovery">
|
||||
<center>
|
||||
<div class="box large">
|
||||
<h3>Padding Bits Recovery</h3>
|
||||
<h3 id="div-patching-recovery-title"></h3>
|
||||
<div class="space"></div>
|
||||
<div class="preview-box left">
|
||||
<table id="qr-dummy" class="qr-tab"></table>
|
||||
</div>
|
||||
<div class="left">
|
||||
<div id="div-pad-rec-error" class="hide">
|
||||
<div id="div-patch-rec-error" class="hide">
|
||||
<h5 class="left">Error : </h5>
|
||||
<textarea spellcheck="false" readonly style="width:100%;"></textarea>
|
||||
</div>
|
||||
<div id="div-pad-rec-data">
|
||||
<div id="div-patch-rec-data">
|
||||
<h5>Bits before recovery : </h5>
|
||||
<textarea spellcheck="false" id="pad-rec-before" readonly style="width:100%;"></textarea>
|
||||
<textarea spellcheck="false" id="patch-rec-before" readonly style="width:100%;"></textarea>
|
||||
<h5>Bits after recovery : </h5>
|
||||
<textarea spellcheck="false" id="pad-rec-after" readonly style="width:100%;"></textarea>
|
||||
<textarea spellcheck="false" id="patch-rec-after" readonly style="width:100%;"></textarea>
|
||||
</div>
|
||||
<div id="div-pad-rec-warning" class="hide">
|
||||
<div id="div-patch-rec-warning" class="hide">
|
||||
<h5 class="left">Warning : </h5>
|
||||
<textarea spellcheck="false" readonly style="width:100%;"></textarea>
|
||||
</div>
|
||||
<h6><i>Note : Recovered modules are marked with green color</i></h6>
|
||||
<div class="space"></div>
|
||||
<button id="btn-pad-rec-apply">Apply</button>
|
||||
<button id="btn-pad-rec-cancel">Cancel</button>
|
||||
<button id="btn-patch-rec-apply">Apply</button>
|
||||
<button id="btn-patch-rec-cancel">Cancel</button>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</center>
|
||||
</div>
|
||||
<!-- END PADDING BITS RECOVERY OVERLAY -->
|
||||
<!-- END PATCHING BITS RECOVERY OVERLAY -->
|
||||
|
||||
<!-- START WARNING OVERLAY -->
|
||||
<div class="warning hide">
|
||||
|
|
42
js/main.js
42
js/main.js
|
@ -985,19 +985,17 @@ function showMaskPatternArea(){
|
|||
resize(qr_pixel_size);
|
||||
}
|
||||
|
||||
function recoverPadding(){
|
||||
var data_array = JSON.stringify(qr_array);
|
||||
var result = recoverPaddingBits(JSON.parse(data_array));
|
||||
var warning = false;
|
||||
function patchingRecovery(result){
|
||||
var warning = 0;
|
||||
|
||||
$("#qr-dummy").html("");
|
||||
$("#div-pad-rec-warning, #div-pad-rec-error").hide();
|
||||
$("#div-pad-rec-data, #btn-pad-rec-apply").show()
|
||||
$("#div-patch-rec-warning, #div-patch-rec-error").hide();
|
||||
$("#div-patch-rec-data, #btn-patch-rec-apply").show()
|
||||
|
||||
if(typeof result == "string"){
|
||||
$("#div-pad-rec-error").show();
|
||||
$("#div-pad-rec-error textarea").val(result);
|
||||
$("#div-pad-rec-warning, #div-pad-rec-data, #btn-pad-rec-apply").hide();
|
||||
$("#div-patch-rec-error").show();
|
||||
$("#div-patch-rec-error textarea").val(result);
|
||||
$("#div-patch-rec-warning, #div-patch-rec-data, #btn-patch-rec-apply").hide();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1029,23 +1027,23 @@ function recoverPadding(){
|
|||
for(var i=0; i < result.after.length; i++){
|
||||
if(result.before.charAt(i) != "?"){
|
||||
if(result.after.charAt(i) != result.before.charAt(i)){
|
||||
warning = true;
|
||||
break;
|
||||
warning++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(warning){
|
||||
$("#div-pad-rec-warning").show();
|
||||
$("#div-pad-rec-warning textarea").val("There's one or more modules conflict with the already known module of original QR code. Correction may fail.")
|
||||
$("#div-patch-rec-warning").show();
|
||||
$("#div-patch-rec-warning textarea").val("There's are " + warning +" modules conflict with the already known module of original QR code. Correction may fail.")
|
||||
}
|
||||
|
||||
$("#pad-rec-before").val(result.before);
|
||||
$("#pad-rec-after").val(result.after);
|
||||
$("#patch-rec-before").val(result.before);
|
||||
$("#patch-rec-after").val(result.after);
|
||||
|
||||
qr_temp_array = Array.prototype.slice.call(result.result_array);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* Perform Reed-Solomon decode
|
||||
|
@ -1900,21 +1898,23 @@ $(document).ready(function(){
|
|||
****************************/
|
||||
|
||||
$("#tools-pad-recovery").click(function(){
|
||||
recoverPadding();
|
||||
$("#div-padding-recovery").show();
|
||||
patchingRecovery(recoverPaddingBits(JSON.parse(JSON.stringify(qr_array))));
|
||||
$("#div-patching-recovery-title").val("Padding Bits Recovery");
|
||||
$("#div-patching-recovery").show();
|
||||
|
||||
$("#div-tools").hide();
|
||||
})
|
||||
|
||||
$("#btn-pad-rec-apply").click(function(){
|
||||
$("#btn-patching-rec-apply").click(function(){
|
||||
qr_array = JSON.parse(JSON.stringify(qr_temp_array));
|
||||
refreshTable();
|
||||
updateHistory("Padding bits recovery");
|
||||
$("#div-padding-recovery").hide();
|
||||
$("#div-patching-recovery").hide();
|
||||
changed_state = true;
|
||||
})
|
||||
|
||||
$("#btn-pad-rec-cancel").click(function(){
|
||||
$("#div-padding-recovery").hide();
|
||||
$("#btn-patching-rec-cancel").click(function(){
|
||||
$("#div-patching-recovery").hide();
|
||||
})
|
||||
|
||||
/****************************
|
||||
|
|
Loading…
Reference in a new issue