From 51689abb64019baf95151631919f263d80fa1b8d Mon Sep 17 00:00:00 2001 From: Philip Schell Date: Wed, 3 Jul 2019 15:53:19 +0200 Subject: [PATCH] #12 Make icon transparent if there is no data update --- CHANGELOG | 2 +- Lora-Map/resources/js/marker.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 086a2c5..5b79439 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,7 @@ ## 1.2.8 ### New Features -* +* #12 Make icon transparent if there is no data update ### Bugfixes * Implement #13 fixing issue with port when using proxy * Implement #14 show description on map in tooltip on area diff --git a/Lora-Map/resources/js/marker.js b/Lora-Map/resources/js/marker.js index 996efeb..b46bcff 100644 --- a/Lora-Map/resources/js/marker.js +++ b/Lora-Map/resources/js/marker.js @@ -58,6 +58,18 @@ function parseAjaxLoc() { } } } + var lasttime = timeCalculation(positionItem['Recievedtime'], "diffraw"); + if (lasttime <= 5 * 60) { + markers[key]._icon.style.opacity = 1; + } else if (lasttime > 5 * 60 && lasttime <= 15 * 60) { + markers[key]._icon.style.opacity = 0.9 - (((lasttime - (5 * 60)) / ((15 * 60) - (5 * 60))) * (0.9 - 0.7)); + } else if (lasttime > 15 * 60 && lasttime <= 30 * 60) { + markers[key]._icon.style.opacity = 0.7 - (((lasttime - (15 * 60)) / ((30 * 60) - (15 * 60))) * (0.7 - 0.5)); + } else if (lasttime > 30 * 60 && lasttime <= 60 * 60) { + markers[key]._icon.style.opacity = 0.5 - (((lasttime - (30 * 60)) / ((30 * 60) - (30 * 60))) * (0.5 - 0.25)); + } else if (lasttime > 60 * 60) { + markers[key]._icon.style.opacity = 0.25; + } } } }