only fetch the latest revision number on initialization. This fixes the flicker on first refreshStatus()

pull/53/head
Zlatin Balevsky 2020-03-24 13:28:56 +00:00
parent 4020df0a77
commit a2ed308cd0
1 changed files with 8 additions and 4 deletions

View File

@ -105,7 +105,7 @@ function fetch(infoHash) {
xmlhttp.send()
}
function refreshStatus() {
function refreshStatus(noRefresh) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
@ -125,6 +125,10 @@ function refreshStatus() {
var newRevision = parseInt(xmlDoc.getElementsByTagName("Revision")[0].childNodes[0].nodeValue)
if (newRevision > treeRevision) {
treeRevision = newRevision
if (noRefresh)
return
var collapsed = new Map()
root.collectCollapsed(collapsed)
collapse("root")
@ -146,11 +150,11 @@ var nodesById = new Map()
function initFiles() {
root = new Node("root",null,false, null, _t("Shared Files"), -1, null, false, false, -1)
setInterval(refreshStatus, 3000)
// setTimeout(refreshStatus, 1)
nodesById.set("root",root)
root.updateDiv()
expand(root.nodeId)
root.updateDiv()
expand(root.nodeId)
refreshStatus(true)
}
function encodedPathToRoot(node) {