/[meteor]/trunk/public_html/koha.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

Diff of /trunk/public_html/koha.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 72 by dpavlin, Sat Mar 28 14:21:21 2009 UTC revision 73 by dpavlin, Sat Mar 28 15:49:36 2009 UTC
# Line 1  Line 1 
1  // Set this to something unique to this client  // Set this to something unique to this client
2    
3  var rfid_visible = {};  var rfid_selected = {};
4    
5  function process(data) {  function process(data) {
6          var a = data.split('|');          var a = data.split('|');
7          console.info('process', a);          console.info('process', a);
8          $('#test').html( a[1] );          $('#test').html( a[1] );
9          if ( a[0] > 0 && ! rfid_visible[ a[0] ] ) {          if ( a[0] > 0 && ! rfid_selected[ a[0] ] ) {
10                  $('#koha').append( '<div class="item" id="' + a[0] + '">Loading item '+a[0]+' from Koha</div>' )                  $('#koha').append( '<div class="item" id="' + a[0] + '">Loading item '+a[0]+' from Koha</div>' )
11                  $('#' + a[0]).load( '/koha/' + a[0] );                  $.get( '/koha/' + a[0], function(data) {
12                  rfid_visible[ a[0] ]++;                          $('#'+a[0]).html( data );
13    
14                            rfid_selected[ a[0] ]++;
15                            var e = $('#clear_selection');
16                            e.attr( 'value', parseInt( e.attr('value') ) + 1 );
17                            console.info('loaded item', a[0], data, 'selected', e.attr('value'));
18                    });
19          } else if ( a[0] < 0 ) {          } else if ( a[0] < 0 ) {
20                  $('#koha').html( 'No RFID chips in range' );                  console.info("No RFID chips in range");
                 rfid_visible = {};  
21          }          }
22  };  };
23    
# Line 38  $(document).ready( function() { Line 43  $(document).ready( function() {
43          // Start streaming!          // Start streaming!
44          Meteor.connect();          Meteor.connect();
45    
46            // clear selection
47            $('#clear_selection').click( function() {
48                    $('#koha').html('No items selected');
49                    $('#clear_selection').attr('value', '0');
50                    rfid_selected = {};
51                    console.debug('clear selection');
52            });
53    
54  });  });

Legend:
Removed from v.72  
changed lines
  Added in v.73

  ViewVC Help
Powered by ViewVC 1.1.26