mirror of
https://github.com/zxing/zxing.git
synced 2025-01-27 11:01:00 -08:00
Fix manual code entry (HT lachezar)
This commit is contained in:
parent
94825ef448
commit
583cff4221
|
@ -63,7 +63,7 @@
|
||||||
GET = {};
|
GET = {};
|
||||||
$.each(location.search.substr(1).split("&"),function(k,v){
|
$.each(location.search.substr(1).split("&"),function(k,v){
|
||||||
var prm = v.split("=");
|
var prm = v.split("=");
|
||||||
GET[prm[0]] = prm[1];
|
GET[decodeURIComponent(prm[0])] = decodeURIComponent(prm[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check is it possible to use manual mode
|
// Check is it possible to use manual mode
|
||||||
|
@ -88,8 +88,16 @@
|
||||||
var man = prompt("Please type barcode below");
|
var man = prompt("Please type barcode below");
|
||||||
if(man){
|
if(man){
|
||||||
var url = GET.ret;
|
var url = GET.ret;
|
||||||
if(url.indexOf("?") == -1) url = url + "?";
|
if (url.indexOf("{CODE}") == -1) {
|
||||||
url = url + "&{CODE}=" + man;
|
// Return URL has no {CODE} place holder, so add a query parameter
|
||||||
|
if (url.indexOf("?") == -1)
|
||||||
|
url = url + "?" + encodeURIComponent("{CODE}") + "=" + encodeURIComponent(man);
|
||||||
|
else
|
||||||
|
url = url + "&" + encodeURIComponent("{CODE}") + "=" + encodeURIComponent(man);
|
||||||
|
} else {
|
||||||
|
// Replace the {CODE} placeholder in the return URL with the scanned code.
|
||||||
|
url = url.replace("{CODE}", encodeURIComponent(man));
|
||||||
|
}
|
||||||
location = url;
|
location = url;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue