/[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 70 by dpavlin, Sat Mar 28 03:45:31 2009 UTC revision 76 by dpavlin, Sat Mar 28 17:53:26 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_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 ) {  
10                  $('#koha')          var id = a[0];
11                  .html( 'Loading item '+a[0]+' from Koha' )  
12                  .load( '/koha/' + a[0] )          console.debug( id, rfid_selected[id] === undefined );
13                  ;  
14          } else if ( a[0] < 0 ) {          if ( id > 0 && rfid_selected[ id ] === undefined ) {
15                  $('#koha').html( '--' );                  if ( $('#'+id).length > 0 ) {
16                            console.error('element', id, 'allready exists');
17                    } else {
18                            $('#koha').append( '<div class="item" id="'+id+'">Loading item '+id+' from Koha</div>' )
19                            console.debug('created element', id);
20                    }
21                    $.get( '/koha/' + id, function(data) {
22                            $('#'+id).html( data );
23    
24                            if ( rfid_selected[id] === undefined ) {
25                                    var e = $('#clear_selection');
26                                    e.attr( 'value', parseInt( e.attr('value') ) + 1 );
27                                    console.info('loaded item:', id, ' times:', rfid_selected[ id ], 'total selected:', e.attr('value'));
28                            }
29    
30                            rfid_selected[ id ] = data;
31                    });
32            } else if ( id < 0 ) {
33                    console.info("No RFID chips in range");
34          }          }
35  };  };
36    
# Line 36  $(document).ready( function() { Line 56  $(document).ready( function() {
56          // Start streaming!          // Start streaming!
57          Meteor.connect();          Meteor.connect();
58    
59            // clear selection
60            $('#clear_selection').click( function() {
61                    $('#koha').html('No items selected');
62                    $('#clear_selection').attr('value', '0');
63                    rfid_selected = {};
64                    console.debug('clear selection');
65            });
66    
67  });  });

Legend:
Removed from v.70  
changed lines
  Added in v.76

  ViewVC Help
Powered by ViewVC 1.1.26