mirror of https://github.com/zlatinb/muwire
only fetch the latest revision number on initialization. This fixes the flicker on first refreshStatus()
parent
4020df0a77
commit
a2ed308cd0
|
@ -105,7 +105,7 @@ function fetch(infoHash) {
|
||||||
xmlhttp.send()
|
xmlhttp.send()
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshStatus() {
|
function refreshStatus(noRefresh) {
|
||||||
var xmlhttp = new XMLHttpRequest();
|
var xmlhttp = new XMLHttpRequest();
|
||||||
xmlhttp.onreadystatechange = function() {
|
xmlhttp.onreadystatechange = function() {
|
||||||
if (this.readyState == 4 && this.status == 200) {
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
@ -125,6 +125,10 @@ function refreshStatus() {
|
||||||
var newRevision = parseInt(xmlDoc.getElementsByTagName("Revision")[0].childNodes[0].nodeValue)
|
var newRevision = parseInt(xmlDoc.getElementsByTagName("Revision")[0].childNodes[0].nodeValue)
|
||||||
if (newRevision > treeRevision) {
|
if (newRevision > treeRevision) {
|
||||||
treeRevision = newRevision
|
treeRevision = newRevision
|
||||||
|
|
||||||
|
if (noRefresh)
|
||||||
|
return
|
||||||
|
|
||||||
var collapsed = new Map()
|
var collapsed = new Map()
|
||||||
root.collectCollapsed(collapsed)
|
root.collectCollapsed(collapsed)
|
||||||
collapse("root")
|
collapse("root")
|
||||||
|
@ -146,11 +150,11 @@ var nodesById = new Map()
|
||||||
function initFiles() {
|
function initFiles() {
|
||||||
root = new Node("root",null,false, null, _t("Shared Files"), -1, null, false, false, -1)
|
root = new Node("root",null,false, null, _t("Shared Files"), -1, null, false, false, -1)
|
||||||
setInterval(refreshStatus, 3000)
|
setInterval(refreshStatus, 3000)
|
||||||
// setTimeout(refreshStatus, 1)
|
|
||||||
|
|
||||||
nodesById.set("root",root)
|
nodesById.set("root",root)
|
||||||
root.updateDiv()
|
root.updateDiv()
|
||||||
expand(root.nodeId)
|
expand(root.nodeId)
|
||||||
|
refreshStatus(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
function encodedPathToRoot(node) {
|
function encodedPathToRoot(node) {
|
||||||
|
|
Loading…
Reference in New Issue