From 532bf8a1cd91e1cbe33261fcef8f3fb0b8745595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?= <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de> Date: Sat, 21 May 2022 22:43:50 +0200 Subject: [PATCH] Allow specifying reloading interval for autoreload of plan --- AKPlan/templates/AKPlan/plan_wall.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/AKPlan/templates/AKPlan/plan_wall.html b/AKPlan/templates/AKPlan/plan_wall.html index 0034af43..413d8860 100644 --- a/AKPlan/templates/AKPlan/plan_wall.html +++ b/AKPlan/templates/AKPlan/plan_wall.html @@ -69,8 +69,7 @@ $('.fc-scroller').scrollLeft($('.fc-timeline-now-indicator-line').position().left); } }); - </script> - <script> + // function from: https://stackoverflow.com/questions/5448545/how-to-retrieve-get-parameters-from-javascript/ function findGetParameter(parameterName) { var result = null, @@ -84,8 +83,11 @@ }); return result; } - if(findGetParameter("autoreload")==1) { - window.setTimeout ( function() { window.location.reload(true); }, 300000); + + // Check whether an autoreload frequency was specified and treat it as minutes + var autoreload_frequency = findGetParameter("autoreload"); + if(autoreload_frequency>0) { + window.setTimeout ( function() { window.location.reload(true); }, autoreload_frequency * 60 * 1000); console.log("Autoreload active"); } </script> -- GitLab