-
Notifications
You must be signed in to change notification settings - Fork 0
/
sticker.html
54 lines (38 loc) · 1.22 KB
/
sticker.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<html>
<script>
// ?&link=QR_CODE_LINK&sku=SKU
function parse_query_string(query) {
var vars = query.split("&");
var query_string = {};
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
var key = decodeURIComponent(pair.shift());
var value = decodeURIComponent(pair.join("="));
// If first entry with this name
if (typeof query_string[key] === "undefined") {
query_string[key] = value;
// If second entry with this name
} else if (typeof query_string[key] === "string") {
var arr = [query_string[key], value];
query_string[key] = arr;
// If third or later entry with this name
} else {
query_string[key].push(value);
}
}
return query_string;
}
setTimeout(function(){
var parsed_qs = parse_query_string(window.location.search);
var qr_link = parsed_qs.link;
var info_sku = parsed_qs.sku;
var imageUrl = "https://www.barcode-generator.org/phpqrcode/getCode.php?cht=qr&chl="+qr_link+"&chs=180x180&choe=UTF-8&chld=L|0";
document.getElementById('qr-image').src = imageUrl;
document.getElementById("sku").innerHTML = info_sku;
}, 1);
</script>
<center>
<img id="qr-image">
<div id="sku" style="font-size:30"></p>
</center>
</html>