add span#rfid in language bar OR before login
[Biblio-RFID.git] / examples / koha-rfid.js
index dd9b470..7932978 100644 (file)
@@ -9,6 +9,21 @@
  *
  * 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:
+
+
+<!-- this is basically remote script injection, doesn't work in Chrome with SSL -->
+//]]></script>
+
+<!-- invoke local RFID javascript -->
+<script type="text/javascript"
+src="http://localhost:9000/examples/koha-rfid.js" 
+>
+
+<script type="text/javascript">
+//<![CDATA[
+
  */
 
 function barcode_on_screen(barcode) {
@@ -33,10 +48,15 @@ function rfid_scan(data,textStatus) {
 //     console.debug( 'rfid_scan', data, textStatus );
 
        var span = $('span#rfid');
-       if ( span.size() == 0 ) {
-               $('ul#i18nMenu').append('<li><span id=rfid>RFID reader found<span>');
-               span = $('span#rfid');
-       }
+
+       if ( span.size() == 0 ) // insert last in language bar on bottom
+               span = $('ul#i18nMenu').append('<li><span id=rfid>RFID reader found<span>');
+
+       if ( span.size() == 0 ) // or before login on top
+               span = $('div#login').prepend('<span id=rfid>RFID reader found</span>');
+
+       span = $('span#rfid');
+
 
        if ( data.tags ) {
                if ( data.tags.length === 1 ) {