From 565d576f704c337b82a583d192c77d43bfca2648 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Wed, 10 Aug 2022 22:35:07 -0400 Subject: WIP: add upload functionality, part 1 The upload button now calls logic, which does a rudimentary upload. The new item can successfully be saved to the server, but the event does not immediately show up in the InfCloud view. The user has to reload the web page to see the new event, which of course is not ideal. There must be a way to add the new object immediately. --- radicale_infcloud/web/cache_handler.js | 63 ++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 30 deletions(-) (limited to 'radicale_infcloud/web/cache_handler.js') diff --git a/radicale_infcloud/web/cache_handler.js b/radicale_infcloud/web/cache_handler.js index e21fb63..4926b20 100644 --- a/radicale_infcloud/web/cache_handler.js +++ b/radicale_infcloud/web/cache_handler.js @@ -43,37 +43,40 @@ window.applicationCache.addEventListener('updateready', function(){ // Check if a new cache is available on page load. window.addEventListener('load', function(e) { - window.applicationCache.addEventListener('cached', function(e) - { - if(!isUserLogged) - window.location.reload(); - else - $('#cacheDialog').css('display','block'); - }, false); + if(window.applicationCache) + { + window.applicationCache.addEventListener('cached', function(e) + { + if(!isUserLogged) + window.location.reload(); + else + $('#cacheDialog').css('display','block'); + }, false); - window.applicationCache.addEventListener('updateready', function(e) - { - if(!isUserLogged) - window.location.reload(); - else - $('#cacheDialog').css('display','block'); - }, false); + window.applicationCache.addEventListener('updateready', function(e) + { + if(!isUserLogged) + window.location.reload(); + else + $('#cacheDialog').css('display','block'); + }, false); - window.applicationCache.addEventListener('obsolete', function(e) - { - if(!isUserLogged) - window.location.reload(); - else - $('#cacheDialog').css('display','block'); - }, false); + window.applicationCache.addEventListener('obsolete', function(e) + { + if(!isUserLogged) + window.location.reload(); + else + $('#cacheDialog').css('display','block'); + }, false); - window.applicationCache.addEventListener('noupdate', function(e) - { - if(!isUserLogged) - { - clearInterval(globalCacheUpdateInterval); - globalCacheUpdateInterval=setInterval(function(){window.applicationCache.update();}, 300000); - //$('#LoginPage .window').css('display', 'inline-block'); - } - }, false); + window.applicationCache.addEventListener('noupdate', function(e) + { + if(!isUserLogged) + { + clearInterval(globalCacheUpdateInterval); + globalCacheUpdateInterval=setInterval(function(){window.applicationCache.update();}, 300000); + //$('#LoginPage .window').css('display', 'inline-block'); + } + }, false); + }; }, false); -- cgit