diff --git a/src/main/webapp/js/warning.js b/src/main/webapp/js/warning.js index 8bb1198dd..d3123bc38 100644 --- a/src/main/webapp/js/warning.js +++ b/src/main/webapp/js/warning.js @@ -14,18 +14,27 @@ var InlineWarning = (function () { exports.start = function () { // Ignore when GH trigger unchecked - if (!$$(options.input).first().checked) { + if (!document.querySelector(options.input).checked) { return; } - new Ajax.PeriodicalUpdater( - options.id, - options.url, - { - method: 'get', - frequency: 10, - decay: 2 - } - ); + var frequency = 10; + var decay = 2; + var lastResponseText; + var fetchData = function () { + fetch(options.url).then((rsp) => { + rsp.text().then((responseText) => { + if (responseText !== lastResponseText) { + document.getElementById(options.id).innerHTML = responseText; + lastResponseText = responseText; + frequency = 10; + } else { + frequency *= decay; + } + setTimeout(fetchData, frequency * 1000); + }); + }); + }; + fetchData(); }; return exports;