-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
103 lines (89 loc) · 4.05 KB
/
index.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<img id="c1"><br>
<img id="qr"><br>
Address: <input type="text" id="address" value="DLExRXZ4oXnEWEpP6bNYG4urNLnDr4jJ2n"><br>
<select id="command">
<option value="request">Request 1DGB</option>
<option value="explorer">Explorer URL</option>
<option value="address">Address</option>
<option value="id">DigiID</option>
</select><br>
<select id="logo">
<option value="0">None</option>
<option value="1">Small logo with white box</option>
<option value="2">Small logo with white circle</option>
<option value="3">Small logo with white fit boarder</option>
<option value="4">Small logo with no boarder</option>
<option value="5" selected>Large logo with light circles</option>
<option value="6">Large logo with light squares</option>
<option value="7">Larger logo with small dots</option>
</select><br>
Radius: <input type="range" id="radius" min="0" max="100" value="50"><br>
Width: <input type="number" id="width" value="300"><br>
<br>
<h1>Installation:</h1>
To install on your on web site <a href="digiQR.min.js" download>download digiQR.min.js</a> and put in same folder as your web site then use the bellow code in your page:<br>
<div id="code" style="padding:30px;border:1px solid;"></div>
<hr>
Code here: <a href="https://github.com/mctrivia/DigiQR">GitHub Code</a><br>
Donations Welcome:<br>
<img class="DigiQR" address="DLExRXZ4oXnEWEpP6bNYG4urNLnDr4jJ2n" size="200" logo="6" r="1"><br>
DLExRXZ4oXnEWEpP6bNYG4urNLnDr4jJ2n
<script src="digiQR.min.js"></script>
<script>
function redraw() {
var e=document.getElementById("logo");
var logo=e.options[e.selectedIndex].value;
e=document.getElementById("command");
var command=e.options[e.selectedIndex].value;
var address=document.getElementById("address").value;
var r=document.getElementById("radius").value/100;
var width=document.getElementById("width").value;
var code='<script src="digiQR.min.js"></script><br><br><img id="qr"><br><script><br>';
if (command=="request") {
code+='var amountDGB=1;<br>';
}
code+='document.getElementById("qr").src = DigiQR.';
//document.getElementById("qr").src = DigiQR.text("A",200,6);
if (command=="request") {
document.getElementById("qr").src = DigiQR['request'](address,1,width,logo,r);
code+='request("'+address+'",amountDGB,'+width+','+logo+','+r+');';
} else {
document.getElementById("qr").src = DigiQR[command](address,width,logo,r);
code+=command+'("'+address+'",'+width+','+logo+','+r+');';
}
document.getElementById("code").innerHTML=code+'<br></script>';
/*
Place image tag in your html
<img id="qr">
Set the img src pick one:
All return an encoded image. can be directly set as img tags src
DigiQR.request(address,amount,size,logo,radius);
DigiQR.address(address,size,logo,radius);
DigiQR.explorer(address,size,logo,radius);
DigiQR.text(data,size,logo,radius);
DigiQR.id(uri,size,logo,radius);
DigiQR.gen({
"data": string value to encode in bar code,
"size": unsigned int optional size in pixels. default 200
"logo": unsigned int optional logo. defaults to off
0,false,undefined no logo
1,true logo with white box
2 logo with white circle
4 logo with no boarder
5 large logo with white dots
6 large logo with white squares
"r": unsigned float optional module radius. must be value between 0-1. default 0
"symbol": unsigned int optional defaults to 0
0 DigiByte logo
1 DigiID logo
});
*/
}
document.getElementById("address").addEventListener("change",redraw);
document.getElementById("logo").addEventListener("change",redraw);
document.getElementById("command").addEventListener("change",redraw);
document.getElementById("radius").addEventListener("change",redraw);
document.getElementById("width").addEventListener("change",redraw);
redraw();
</script>