Make plugin compatible with tracking for all types of button

This commit is contained in:
Fedor A. Fetisov 2021-03-18 02:55:54 +03:00
parent 52c54dd5a5
commit bbeda61ab3

View File

@ -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();