@ -1,4 +1,3 @@
@@ -1,4 +1,3 @@
var waitingTorrentFiles = false ;
var is _seed = true ;
var current _hash = "" ;
@ -273,6 +272,7 @@ var filesDynTable = new Class({
@@ -273,6 +272,7 @@ var filesDynTable = new Class({
} ,
} ) ;
var loadTorrentFilesDataTimer ;
var loadTorrentFilesData = function ( ) {
if ( $ ( 'prop_files' ) . hasClass ( 'invisible' ) ) {
// Tab changed, don't do anything
@ -281,7 +281,7 @@ var loadTorrentFilesData = function() {
@@ -281,7 +281,7 @@ var loadTorrentFilesData = function() {
var new _hash = myTable . getCurrentTorrentHash ( ) ;
if ( new _hash == "" ) {
fTable . removeAllRows ( ) ;
loadTorrentFilesData . delay ( 1500 ) ;
loadTorrentFilesDataTimer = loadTorrentFilesData . delay ( 1500 ) ;
return ;
}
if ( new _hash != current _hash ) {
@ -289,16 +289,13 @@ var loadTorrentFilesData = function() {
@@ -289,16 +289,13 @@ var loadTorrentFilesData = function() {
current _hash = new _hash ;
}
var url = 'json/propertiesFiles/' + current _hash ;
if ( ! waitingTorrentFiles ) {
waitingTorrentFiles = true ;
var request = new Request . JSON ( {
url : url ,
noCache : true ,
method : 'get' ,
onFailure : function ( ) {
$ ( 'error_div' ) . set ( 'html' , '_(qBittorrent client is not reachable)' ) ;
waitingTorrentFiles = false ;
loadTorrentFilesData . delay ( 2000 ) ;
loadTorrentFilesDataTimer = loadTorrentFilesData . delay ( 2000 ) ;
} ,
onSuccess : function ( files ) {
$ ( 'error_div' ) . set ( 'html' , '' ) ;
@ -337,12 +334,15 @@ var loadTorrentFilesData = function() {
@@ -337,12 +334,15 @@ var loadTorrentFilesData = function() {
else {
fTable . removeAllRows ( ) ;
}
waitingTorrentFiles = false ;
loadTorrentFilesData . delay ( 1500 ) ;
loadTorrentFilesDataTimer = loadTorrentFilesData . delay ( 1500 ) ;
}
} ) . send ( ) ;
}
}
var updateTorrentFilesData = function ( ) {
clearTimeout ( loadTorrentFilesDataTimer ) ;
loadTorrentFilesData ( ) ;
}
fTable = new filesDynTable ( ) ;
fTable . setup ( $ ( 'filesTable' ) ) ;