/[RFID]/koha/koha-rfid.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /koha/koha-rfid.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69 - (show annotations)
Thu Feb 11 18:40:24 2010 UTC (14 years, 2 months ago) by dpavlin
File MIME type: application/javascript
File size: 1158 byte(s)
show tabs in koha and pre-fill correct fields

1
2 // XXX dpavlin: RFID support for Koha
3
4 function rfid_scan(data,textStatus) {
5 // console.debug( 'rfid_scan', data, textStatus );
6
7 var span = $('span#rfid');
8 if ( span.size() == 0 ) {
9 $('ul#i18nMenu').append('<li><span id=rfid>RFID reader found<span>');
10 span = $('span#rfid');
11 }
12
13 if ( data.tags ) {
14 if ( data.tags.length === 1 ) {
15 var numbers = data.tags[0].content;
16 if ( span.text() != numbers ) {
17 if ( numbers.substr(0,3) == '130' ) {
18 span.text( numbers ).css('color', 'blue');
19 $('input[name=barcode]').val( numbers );
20 } else {
21 span.text( numbers ).css('color', 'yellow' );
22 $('input[name=findborrower]').val( numbers );
23 }
24 }
25 } else {
26 var error = data.tags.length + ' tags near reader: ';
27 $.each( data.tags, function(i,tag) { error += tag.content + ' '; } );
28 span.text( error ).css( 'color', 'red' );
29 }
30 } else {
31 span.text( 'no tags in range' ).css('color','gray');
32 }
33
34 window.setTimeout( function() {
35 $.getJSON("http://localhost:9000/scan?callback=?", rfid_scan);
36 }, 1000 ); // 1000ms
37 }
38
39 $(document).ready( function() {
40 $.getJSON("http://localhost:9000/scan?callback=?", rfid_scan);
41 });

  ViewVC Help
Powered by ViewVC 1.1.26