From 82967113ee677d5ff294d3a803d3922110cd5dd7 Mon Sep 17 00:00:00 2001 From: libccy Date: Sun, 26 Mar 2017 23:41:56 +0800 Subject: [PATCH] 1 --- game/game.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/game/game.js b/game/game.js index 348ddbdcc..aeb00609b 100644 --- a/game/game.js +++ b/game/game.js @@ -6062,7 +6062,6 @@ var streamInterval=setInterval(function(){ if(stream.closed){ clearInterval(streamInterval); - onprogress(-1); } else{ onprogress(stream.bytesWritten); @@ -30560,7 +30559,17 @@ var progress=ui.create.div('.button-progress',this); ui.create.div(progress); var url=lib.extensionURL+this.info[0]+'.zip'; + var onprogress=function(byte,total){ + if(total){ + size=total; + } + if(byte==-1){ + byte=size; + } + progress.firstChild.style.width=Math.round(100*byte/size)+'%'; + }; game.fetch(url,function(data){ + onprogress(-1); if(game.importExtension(data,function(){ reloadnode.style.display=''; })!==false){ @@ -30576,15 +30585,7 @@ },function(){ that.innerHTML='下载失败'; that.classList.add('nopointer'); - },function(byte,total){ - if(total){ - size=total; - } - if(byte==-1){ - byte=size; - } - progress.firstChild.style.width=Math.round(100*byte/size)+'%'; - }); + },onprogress); }; node.update=function(){