X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=examples%2Fkoha-rfid.js;h=2dfe352f5f562263420351d8ac65f4cada6d09b0;hb=df7f188b073ae8e6cef33b7cd2bdf5693e24fdef;hp=dd9b470ef380647ecbe3669e594aeb01f3832cbf;hpb=32854d778c5239801c83ac4aa53fc4d14478ef78;p=Biblio-RFID.git diff --git a/examples/koha-rfid.js b/examples/koha-rfid.js index dd9b470..2dfe352 100644 --- a/examples/koha-rfid.js +++ b/examples/koha-rfid.js @@ -9,6 +9,12 @@ * * to provide overlay for tags in range and emulate form fill for Koha Library System * which allows check-in and checkout-operations without touching html interface + * + * You will have to inject remote javascript in Koha intranetuserjs using: + +// inject JavaScript RFID support +$.getScript('http://localhost:9000/examples/koha-rfid.js'); + */ function barcode_on_screen(barcode) { @@ -33,10 +39,15 @@ function rfid_scan(data,textStatus) { // console.debug( 'rfid_scan', data, textStatus ); var span = $('span#rfid'); - if ( span.size() == 0 ) { - $('ul#i18nMenu').append('
  • RFID reader found'); - span = $('span#rfid'); - } + + if ( span.size() == 0 ) // insert last in language bar on bottom + span = $('ul#i18nMenu').append('
  • RFID reader found'); + + if ( span.size() == 0 ) // or before login on top + span = $('div#login').prepend('RFID reader found'); + + span = $('span#rfid'); + if ( data.tags ) { if ( data.tags.length === 1 ) { @@ -48,7 +59,11 @@ function rfid_scan(data,textStatus) { var circulation = url.substr(-14,14) == 'circulation.pl'; var returns = url.substr(-10,10) == 'returns.pl'; - if ( t.content.substr(0,3) == '130' ) { + if ( t.content.length == 0 ) { // empty tag + + span.text( t.sid + ' empty' ).css('color', 'red' ); + + } else if ( t.content.substr(0,3) == '130' ) { // books if ( circulation ) rfid_secure( t.content, t.sid, 'D7' );