projects
/
Biblio-RFID.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added working indicator
[Biblio-RFID.git]
/
examples
/
selfcheck.js
diff --git
a/examples/selfcheck.js
b/examples/selfcheck.js
index
3c825bb
..
29ec92f
100644
(file)
--- a/
examples/selfcheck.js
+++ b/
examples/selfcheck.js
@@
-16,6
+16,7
@@
if(!window.console) {
var state;
var scan_timeout;
var pending_jsonp = 0;
var state;
var scan_timeout;
var pending_jsonp = 0;
+var only_reader = '';
// timeout warning dialog
var tick_timeout = 25; // s
// timeout warning dialog
var tick_timeout = 25; // s
@@
-36,11
+37,13
@@
function change_page(new_state) {
$('.checkin').show();
circulation_type = 'checkin';
borrower_cardnumber = 0; // fake
$('.checkin').show();
circulation_type = 'checkin';
borrower_cardnumber = 0; // fake
+ only_reader = '/only/3M';
} else if ( new_state == 'checkout' ) {
new_state = 'circulation'; // page has different name
$('.checkout').show();
$('.checkin').hide();
circulation_type = 'checkout';
} else if ( new_state == 'checkout' ) {
new_state = 'circulation'; // page has different name
$('.checkout').show();
$('.checkin').hide();
circulation_type = 'checkout';
+ only_reader = '/only/3M';
}
state = new_state;
}
state = new_state;
@@
-59,6
+62,7
@@
function change_page(new_state) {
book_barcodes = {};
$('ul#books').html(''); // clear book list
$('#books_count').html( 0 );
book_barcodes = {};
$('ul#books').html(''); // clear book list
$('#books_count').html( 0 );
+ only_reader = '';
scan_tags();
}
scan_tags();
}
@@
-134,16
+138,22
@@
function got_visible_tags(data,textStatus) {
pending_jsonp--;
};
pending_jsonp--;
};
+var wait_counter = 0;
+
function scan_tags() {
if ( pending_jsonp ) {
function scan_tags() {
if ( pending_jsonp ) {
- console.debug('scan_tags disabled ', pending_jsonp, ' requests waiting');
+ wait_counter++;
+ console.debug('scan_tags disabled ', pending_jsonp, ' requests waiting counter', wait_counter);
+ if ( wait_counter > 3 ) $('#working').show();
} else {
} else {
- console.info('scan_tags');
+ console.info('scan_tags'
, only_reader
);
pending_jsonp++;
pending_jsonp++;
- $.getJSON("/scan?callback=?", got_visible_tags).fail( function(data) {
- console.error('scan error
'
);
+ $.getJSON("/scan
"+only_reader+"
?callback=?", got_visible_tags).fail( function(data) {
+ console.error('scan error
pending jsonp', pending_jsonp
);
pending_jsonp--;
});
pending_jsonp--;
});
+ wait_counter = 0;
+ $('#working').hide();
}
if ( tick > 0 ) {
}
if ( tick > 0 ) {