From 97f2bf7eb02b146ba100aebe1f9e72b3aa8e406c Mon Sep 17 00:00:00 2001 From: shadow974 Date: Thu, 22 Feb 2018 08:08:47 +0100 Subject: [PATCH] Reload image only if its visible --- www/tablet/js/widget_image.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/www/tablet/js/widget_image.js b/www/tablet/js/widget_image.js index 1d18dbad..10190640 100755 --- a/www/tablet/js/widget_image.js +++ b/www/tablet/js/widget_image.js @@ -106,12 +106,14 @@ var Modul_image = function () { setInterval(function () { counter++; if (counter >= refresh) { - counter = 0; if (url.match(/_=\d+/)) { url = addurlparam(url, '_', new Date().getTime()); } ftui.log(2, 'Update image widget source. URL=' + url); - elemImg.attr('src', url); + if (elemImg.is(":visible") == true) { + elemImg.attr('src', url); + counter = 0; + } } }, 1000); }