From ce34a4db84b7a80d245e74c6b84c9f6b7161b28e Mon Sep 17 00:00:00 2001 From: Michael Wieland Date: Mon, 19 Apr 2021 19:06:38 +0200 Subject: [PATCH] Prevent updating map while invisible --- DynmapCore/src/main/resources/extracted/web/js/map.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DynmapCore/src/main/resources/extracted/web/js/map.js b/DynmapCore/src/main/resources/extracted/web/js/map.js index 401e9bb2..e7c23f0f 100644 --- a/DynmapCore/src/main/resources/extracted/web/js/map.js +++ b/DynmapCore/src/main/resources/extracted/web/js/map.js @@ -636,6 +636,11 @@ DynMap.prototype = { update: function() { var me = this; + if (document.visibilityState === "hidden") { + setTimeout(function() { me.update(); }, me.options.updaterate); + return; + } + $(me).trigger('worldupdating'); $.getJSON(me.formatUrl('update', { world: me.world.name, timestamp: me.lasttimestamp, reqid: me.reqid }), function(update) { me.reqid++; // Bump request ID always