From b63ccc136cdbb128f5dc6272497e7c9e32ff449c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 1 Apr 2019 17:38:04 +0200 Subject: [main] Incorporate taskmanager callbacks into slx-fixes.js --- index.php | 2 -- .../main/templates/tm-callback-trigger.html | 15 --------------- script/slx-fixes.js | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 modules-available/main/templates/tm-callback-trigger.html diff --git a/index.php b/index.php index 1ecd2109..1b3eaaec 100644 --- a/index.php +++ b/index.php @@ -232,7 +232,5 @@ if (CONFIG_DEBUG) { . round(Database::getQueryTime(), 3) . 's query time total'), 'main'); } -Render::addTemplate('tm-callback-trigger', array(), 'main'); - // Send page to client. Render::output(); diff --git a/modules-available/main/templates/tm-callback-trigger.html b/modules-available/main/templates/tm-callback-trigger.html deleted file mode 100644 index cd03a1fe..00000000 --- a/modules-available/main/templates/tm-callback-trigger.html +++ /dev/null @@ -1,15 +0,0 @@ - \ No newline at end of file diff --git a/script/slx-fixes.js b/script/slx-fixes.js index 925ac44f..29f52449 100644 --- a/script/slx-fixes.js +++ b/script/slx-fixes.js @@ -87,3 +87,20 @@ $(document).ready(function() { }; $('button[data-confirm]').click($function); }); + +// Taskmanager callbacks for running tasks +$(document).ready(function() { + var slxCbCooldown = 0; + function slxCheckCallbacks() { + $.post('api.php?do=cb', { token: TOKEN }, function(data) { + if ( data.indexOf('True') >= 0 ) { + slxCbCooldown += 1; + } else { + slxCbCooldown += 10; + } + if (slxCbCooldown < 30) + setTimeout(slxCheckCallbacks, slxCbCooldown * 1000); + }, 'text'); + } + slxCheckCallbacks(); +}); -- cgit v1.2.3-55-g7522