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 |
} else { |
39 |
html += '</tt>'; |
40 |
html += ' <form method=get action=program style="display:inline">' |
41 |
+ '<!-- <input type=checkbox name=secure value='+tag.sid+' title="secure tag"> -->' |
42 |
+ '<input type=text name=tag_'+tag.sid+' size=12>' |
43 |
+ '<input type=submit name="Reprogram tag">' |
44 |
+ '</form>' |
45 |
; |
46 |
} |
47 |
}); |
48 |
html += '</ul>'; |
49 |
} |
50 |
html = '<div class=status>' |
51 |
+ textStatus |
52 |
+ '##########'.substr(0,data.time % 10) |
53 |
+ '</div>' |
54 |
+ html |
55 |
; |
56 |
$('#tags').html( html ); |
57 |
window.setTimeout(function(){ |
58 |
scan_tags(); |
59 |
},200); // re-scan every 200ms |
60 |
}; |
61 |
|
62 |
function scan_tags() { |
63 |
console.info('scan_tags'); |
64 |
if ( $('input#pull-reader').attr('checked') ) |
65 |
$.getJSON("http://localhost:9000/scan?callback=?", got_visible_tags); |
66 |
} |
67 |
|
68 |
$(document).ready(function() { |
69 |
$('input#pull-reader').click( function() { |
70 |
scan_tags(); |
71 |
}); |
72 |
$('input#pull-reader').attr('checked', true); // force check on load |
73 |
|
74 |
$('div#tags').click( function() { |
75 |
$('input#pull-reader').attr('checked', false); |
76 |
} ); |
77 |
|
78 |
scan_tags(); |
79 |
}); |
80 |
</script> |
81 |
</head> |
82 |
<body> |
83 |
|
84 |
<h1>RFID tags in range</h1> |
85 |
|
86 |
<label for=pull-reader> |
87 |
<input id=pull-reader type=checkbox checked=1> |
88 |
active |
89 |
</label> |
90 |
|
91 |
<div id="tags"> |
92 |
RFID reader not found or driver program not started. |
93 |
</div> |
94 |
|
95 |
</body> |
96 |
</html> |