forked from zed-0xff/openwrt-scan-server
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
92 lines (82 loc) · 2.53 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
<html><head>
<style>
* { font-size: 30pt }
a { text-decoration: none }
table { margin-top: 0 }
iframe { border: 0; width: 210px; height: 40px; }
img#spinner {
position:absolute; top:40px; left:90px; display:none;
}
._75dpi { font-size: 10pt; }
._100dpi { font-size: 8pt; }
._150dpi { font-size: 15pt; }
._200dpi { font-size: 8pt; }
._300dpi { font-size: 30pt; }
._600dpi { font-size: 10pt; }
._1200dpi { font-size: 8pt; }
</style>
<title>Scanner</title>
</head><body>
<center>
<a href="/data/scan.jpg" style="display:block; width:210px; height:297px; position:relative">
<img id="spinner" src="/ajax.gif" />
<img id="preview" width="210" height="297" src="/data/scan.jpg" style="border:solid 1px #ccc" />
</a>
<iframe id="info" src="/data/info.html"></iframe>
<table><tr><td>
<form method="POST" action="/cgi-bin/scan/75">
<input type="submit" value="75dpi" class="_75dpi">
</form>
<form method="POST" action="/cgi-bin/scan/100">
<input type="submit" value="100dpi" class="_100dpi">
</form>
</td><td>
<form method="POST" action="/cgi-bin/scan/150">
<input type="submit" value="150dpi" class="_150dpi">
</form>
<form method="POST" action="/cgi-bin/scan/200">
<input type="submit" value="200dpi" class="_200dpi">
</form>
</td><td>
<form method="POST" action="/cgi-bin/scan/300">
<input type="submit" value="300dpi" class="_300dpi">
</form>
</td><td>
<form method="POST" action="/cgi-bin/scan/600">
<input type="submit" value="600dpi" class="_600dpi">
</form>
<form method="POST" action="/cgi-bin/scan/1200">
<input type="submit" value="1200dpi" class="_1200dpi">
</form>
</td></tr></table>
</center>
</body>
<script src="/jquery-1.6.1.min.js"></script>
<script>
$('form').submit(function(){
$('#spinner').show();
var dpi = parseInt($('input',this).val());
function reload_image() {
$('#preview').attr('src', '/data/scan.jpg?r=' + Math.random());
}
var image_reloader = setInterval(reload_image, dpi * 2);
$.ajax({
url: "/cgi-bin/scan/"+dpi,
complete: function(){
$('#preview').attr('src', '/data/scan.jpg?r=' + Math.random());
$('#info').attr('src', '/data/info.html?r=' + Math.random());
$('#spinner').hide();
var ds = (new Date()).toISOString().replace(/[^0-9]/g, "").slice(0, 14);
var a = document.createElement('a');
a.href = "/data/scan.jpg?r=" + Math.random();
a.download = "scan_" + ds + ".jpg";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
clearInterval(image_reloader);
}
});
return false;
});
</script>
</html>