cleanup
[Biblio-RFID.git] / examples / selfcheck.js
index 4bb42ee..e1917c2 100644 (file)
@@ -68,25 +68,17 @@ function change_page(new_state) {
 function got_visible_tags(data,textStatus) {
        var html = 'No tags in range';
        if ( data.tags ) {
-               scan_tags_active = false;
                html = '<ul class="tags">';
                $.each(data.tags, function(i,tag) {
                        console.debug( i, tag );
                        html += '<li><tt class="' + tag.security + '">' + tag.sid;
-                       var content = tag.content
-                       if (typeof content === undefined && typeof tag.borrower !== undefined) 
-                               content = tag.borrower.cardnumber;
-
-                       var is_book = false;
-                       var is_borrower = false;
+                       var content = tag.content || tag.borrower.cardnumber;
 
                        if ( content ) {
                                var link;
                                if ( content.length = 10 && content.substr(0,3) == 130 ) { // book
-                                       is_book = true;
                                        link = 'catalogue/search.pl?q=';
                                } else if ( content.length == 12 && content.substr(0,2) == 20 ) {
-                                       is_borrower = true;
                                        link = 'members/member.pl?member=';
                                } else {
                                        html += '<b>UNKNOWN TAG</b> '+content;
@@ -106,7 +98,6 @@ function got_visible_tags(data,textStatus) {
                });
                html += '</ul>';
 
-               scan_tags_active = true;
        }
 
        var arrows = Array( 8592, 8598, 8593, 8599, 8594, 8600, 8595, 8601 );
@@ -117,7 +108,7 @@ function got_visible_tags(data,textStatus) {
                + '</div>'
                + html
                ;
-       $('#tags').html( html );
+       $('#tags').html( html ); // FIXME leaks memory?
 
        pending_jsonp--;
 };