1 |
<html> |
2 |
<head> |
3 |
<title>3M RFID</title> |
4 |
<script type="text/javascript" src="jquery-1.3.2.min.js"></script> |
5 |
<style type="text/css"> |
6 |
.status { |
7 |
background: #ff8; |
8 |
} |
9 |
|
10 |
.da { |
11 |
background: #fcc; |
12 |
} |
13 |
|
14 |
.d7 { |
15 |
background: #cfc; |
16 |
} |
17 |
|
18 |
label[for=pull-reader] { |
19 |
position: absolute; |
20 |
top: 1em; |
21 |
right: 1em; |
22 |
background: #eee; |
23 |
} |
24 |
|
25 |
</style> |
26 |
<script type="text/javascript"> |
27 |
|
28 |
function got_visible_tags(data,textStatus) { |
29 |
var html = 'No tags in range'; |
30 |
if ( data.tags ) { |
31 |
html = '<ul class="tags">'; |
32 |
$.each(data.tags, function(i,tag) { |
33 |
console.debug( i, tag ); |
34 |
html += '<li><tt class=' + tag.security + '>' + tag.sid; |
35 |
if ( tag.content ) { |
36 |
html += ' <a href="https://koha-dev.rot13.org:8443/cgi-bin/koha/members/member.pl?member=' + tag.content + '" title="lookup in Koha" target="koha-lookup">' + tag.content + '</a>'; |
37 |
html += '</tt>'; |
38 |
html += '<form method=get action=program style="display:inline">' |
39 |
+ '<input type=hidden name='+tag.sid+' value="blank">' |
40 |
+ '<input type=submit value="Blank" onclick="return confirm(\'Blank tag '+tag.sid+'\')">' |
41 |
+ '</form>' |
42 |
; |
43 |
} else { |
44 |
html += '</tt>'; |
45 |
html += ' <form method=get action=program style="display:inline">' |
46 |
+ '<!-- <input type=checkbox name=secure value='+tag.sid+' title="secure tag"> -->' |
47 |
+ '<input type=text name='+tag.sid+' size=12>' |
48 |
+ '<input type=submit value="Program">' |
49 |
+ '</form>' |
50 |
; |
51 |
} |
52 |
}); |
53 |
html += '</ul>'; |
54 |
} |
55 |
|
56 |
var arrows = Array( 8592, 8598, 8593, 8599, 8594, 8600, 8595, 8601 ); |
57 |
|
58 |
html = '<div class=status>' |
59 |
+ textStatus |
60 |
+ ' &#' + arrows[ data.time % arrows.length ] + ';' |
61 |
+ '</div>' |
62 |
+ html |
63 |
; |
64 |
$('#tags').html( html ); |
65 |
window.setTimeout(function(){ |
66 |
scan_tags(); |
67 |
},200); // re-scan every 200ms |
68 |
}; |
69 |
|
70 |
function scan_tags() { |
71 |
console.info('scan_tags'); |
72 |
if ( $('input#pull-reader').attr('checked') ) |
73 |
$.getJSON("http://localhost:9000/scan?callback=?", got_visible_tags); |
74 |
} |
75 |
|
76 |
$(document).ready(function() { |
77 |
$('input#pull-reader').click( function() { |
78 |
scan_tags(); |
79 |
}); |
80 |
$('input#pull-reader').attr('checked', true); // force check on load |
81 |
|
82 |
$('div#tags').click( function() { |
83 |
$('input#pull-reader').attr('checked', false); |
84 |
} ); |
85 |
|
86 |
scan_tags(); |
87 |
}); |
88 |
</script> |
89 |
</head> |
90 |
<body> |
91 |
|
92 |
<h1>RFID tags in range</h1> |
93 |
|
94 |
<label for=pull-reader> |
95 |
<input id=pull-reader type=checkbox checked=1> |
96 |
active |
97 |
</label> |
98 |
|
99 |
<div id="tags"> |
100 |
RFID reader not found or driver program not started. |
101 |
</div> |
102 |
|
103 |
</body> |
104 |
</html> |