diff --git a/static-data/www/shared/main/stats.js b/static-data/www/shared/main/stats.js index 446df900..139db077 100755 --- a/static-data/www/shared/main/stats.js +++ b/static-data/www/shared/main/stats.js @@ -25,6 +25,8 @@ totalRec = document.getElementById('totalRec') securityLevel = document.getElementById('securityLevel') sec_description_str = 'unknown' +statsInterval = null + function showSecStatNotice(){ var secWarnEls = document.getElementsByClassName('secRequestNotice') for (el = 0; el < secWarnEls.length; el++){ @@ -143,7 +145,7 @@ document.addEventListener("visibilitychange", function() { }) getStats() -setInterval(function(){getStats()}, 1000) +statsInterval = setInterval(function(){getStats()}, 1000) diff --git a/static-data/www/shared/misc.js b/static-data/www/shared/misc.js index 19c24835..b3e6038b 100755 --- a/static-data/www/shared/misc.js +++ b/static-data/www/shared/misc.js @@ -65,18 +65,7 @@ function arrayContains(needle, arrhaystack) { return (arrhaystack.indexOf(needle) > -1); } -function httpGet(theUrl) { - var xmlHttp = new XMLHttpRequest() - xmlHttp.open( "GET", theUrl, false ) // false for synchronous request - xmlHttp.setRequestHeader('token', webpass) - xmlHttp.send( null ) - if (xmlHttp.status == 200){ - return xmlHttp.responseText - } - else{ - return "" - } -} + function overlay(overlayID) { el = document.getElementById(overlayID) el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible" diff --git a/static-data/www/shared/panel.js b/static-data/www/shared/panel.js index dc8fc016..4e80c0b8 100755 --- a/static-data/www/shared/panel.js +++ b/static-data/www/shared/panel.js @@ -23,8 +23,13 @@ restartBtn = document.getElementById('restartNode') shutdownBtn.onclick = function(){ if (! nowebpass){ if (confirm("Really shutdown Onionr?")){ - httpGet('/shutdownclean') + fetch('/shutdownclean', { + method: 'GET', + headers: { + "token": webpass + }}) overlay('shutdownNotice') + clearInterval(statsInterval) } } }