forked from serpwings/netlify-status-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
updater.js
22 lines (21 loc) · 895 Bytes
/
updater.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(function ($) {
$(function () {
let timeout = null;
let updateTimeInterval = 1500;
let netlifyStatusBadgeImage = $('.netlify-status-badge img');
let netlifyBadgeSrc = netlifyStatusBadgeImage.prop('src');
let updateNetlifyStatusBadgeImage = function () {
if (!netlifyStatusBadgeImage.length) {
$('.netlify-status-badge').text("Netlify Badge Not Set");
return;
}
netlifyStatusBadgeImage.prop('src',
netlifyBadgeSrc + '?_=' + Math.random()
).error(function () {
$('.netlify-status-badge').text("Netlify Badge Not Set");
});
timeout = setTimeout(updateNetlifyStatusBadgeImage, updateTimeInterval);
};
timeout = setTimeout(updateNetlifyStatusBadgeImage, updateTimeInterval);
});
})(jQuery);