From bbeda61ab3d8d49de87c4c4694cb8638338bb20d Mon Sep 17 00:00:00 2001 From: "Fedor A. Fetisov" Date: Thu, 18 Mar 2021 02:55:54 +0300 Subject: [PATCH] Make plugin compatible with tracking for all types of button --- js/refresh.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/refresh.js b/js/refresh.js index 18c1022..90ada10 100644 --- a/js/refresh.js +++ b/js/refresh.js @@ -1,7 +1,10 @@ (function(Mibew) { Mibew.APIFunctions.refreshButton = function(data) { - // Refresh the button image - var img = document.getElementById("mibew-agent-button").getElementsByTagName("img")[0]; + // Refresh the button image (if exists) + var button = document.getElementById("mibew-agent-button"); + if (!button) { return; } + var img = button.getElementsByTagName("img")[0]; + if (!img) { return; } var originalSrc = img.src.replace(/&dummy=\d+/, ''); img.src = originalSrc + "&dummy=" + (new Date()).getTime();