mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 04:54:04 -08:00
Fix manual code entry (HT lachezar)
This commit is contained in:
parent
94825ef448
commit
583cff4221
|
@ -63,7 +63,7 @@
|
|||
GET = {};
|
||||
$.each(location.search.substr(1).split("&"),function(k,v){
|
||||
var prm = v.split("=");
|
||||
GET[prm[0]] = prm[1];
|
||||
GET[decodeURIComponent(prm[0])] = decodeURIComponent(prm[1]);
|
||||
});
|
||||
|
||||
// Check is it possible to use manual mode
|
||||
|
@ -88,8 +88,16 @@
|
|||
var man = prompt("Please type barcode below");
|
||||
if(man){
|
||||
var url = GET.ret;
|
||||
if(url.indexOf("?") == -1) url = url + "?";
|
||||
url = url + "&{CODE}=" + man;
|
||||
if (url.indexOf("{CODE}") == -1) {
|
||||
// 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;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue