This commit is contained in:
parent
69d4c9682b
commit
b5284e7d92
39
game/game.js
39
game/game.js
|
@ -6041,7 +6041,7 @@
|
||||||
require('electron').remote.getCurrentWindow().toggleDevTools();
|
require('electron').remote.getCurrentWindow().toggleDevTools();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
game.download=function(url,folder,onsuccess,onerror,dev){
|
game.download=function(url,folder,onsuccess,onerror,dev,onprogress){
|
||||||
if(url.indexOf('http')!=0){
|
if(url.indexOf('http')!=0){
|
||||||
url=get.url(dev)+url;
|
url=get.url(dev)+url;
|
||||||
}
|
}
|
||||||
|
@ -6058,6 +6058,17 @@
|
||||||
var stream=response.pipe(file);
|
var stream=response.pipe(file);
|
||||||
stream.on('finish',onsuccess);
|
stream.on('finish',onsuccess);
|
||||||
stream.on('error',onerror);
|
stream.on('error',onerror);
|
||||||
|
if(onprogress){
|
||||||
|
var streamInterval=setInterval(function(){
|
||||||
|
if(stream.closed){
|
||||||
|
clearInterval(streamInterval);
|
||||||
|
onprogress(-1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
onprogress(stream.bytesWritten);
|
||||||
|
}
|
||||||
|
},200);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},true);
|
},true);
|
||||||
};
|
};
|
||||||
|
@ -20251,14 +20262,14 @@
|
||||||
}
|
}
|
||||||
download();
|
download();
|
||||||
},
|
},
|
||||||
fetch:function(url,onload,onerror){
|
fetch:function(url,onload,onerror,onprogress){
|
||||||
var tmpName=get.id();
|
var tmpName=get.id();
|
||||||
game.download(encodeURI(url),tmpName,function(){
|
game.download(encodeURI(url),tmpName,function(){
|
||||||
game.readFile(tmpName,function(data){
|
game.readFile(tmpName,function(data){
|
||||||
onload(data);
|
onload(data);
|
||||||
game.removeFile(tmpName);
|
game.removeFile(tmpName);
|
||||||
},onerror);
|
},onerror);
|
||||||
},onerror);
|
},onerror,null,onprogress);
|
||||||
},
|
},
|
||||||
playVideo:function(time,mode){
|
playVideo:function(time,mode){
|
||||||
if(!_status.replayvideo){
|
if(!_status.replayvideo){
|
||||||
|
@ -30526,16 +30537,29 @@
|
||||||
node.updated=true;
|
node.updated=true;
|
||||||
var that=this;
|
var that=this;
|
||||||
var list=[];
|
var list=[];
|
||||||
|
var size=parseFloat(this.info[4])||0;
|
||||||
|
if(size){
|
||||||
|
if(this.info[4].indexOf('MB')!=-1){
|
||||||
|
size*=1024*1024;
|
||||||
|
}
|
||||||
|
else if(this.info[4].indexOf('KB')!=-1){
|
||||||
|
size*=1024;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.innerHTML='正在下载';
|
this.innerHTML='<span>正在下载</span><div>正在下载</div>';
|
||||||
this.classList.add('nopointer');
|
this.classList.add('nopointer');
|
||||||
|
this.classList.add('button-downloading');
|
||||||
|
var progress=ui.create.div('.button-progress',this);
|
||||||
|
ui.create.div(progress);
|
||||||
var url=lib.extensionURL+this.info[0]+'.zip';
|
var url=lib.extensionURL+this.info[0]+'.zip';
|
||||||
game.fetch(url,function(data){
|
game.fetch(url,function(data){
|
||||||
if(game.importExtension(data,function(){
|
if(game.importExtension(data,function(){
|
||||||
reloadnode.style.display='';
|
reloadnode.style.display='';
|
||||||
})!==false){
|
})!==false){
|
||||||
game.saveConfig('extension_'+that.info[0]+'_version',that.info[3]);
|
game.saveConfig('extension_'+that.info[0]+'_version',that.info[3]);
|
||||||
that.innerHTML='安装成功';
|
that.childNodes[0].innerHTML='安装成功';
|
||||||
|
that.childNodes[1].innerHTML='安装成功';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
that.innerHTML='安装失败';
|
that.innerHTML='安装失败';
|
||||||
|
@ -30545,6 +30569,11 @@
|
||||||
},function(){
|
},function(){
|
||||||
that.innerHTML='下载失败';
|
that.innerHTML='下载失败';
|
||||||
that.classList.add('nopointer');
|
that.classList.add('nopointer');
|
||||||
|
},function(byte){
|
||||||
|
if(byte==-1){
|
||||||
|
byte=size;
|
||||||
|
}
|
||||||
|
progress.firstChild.style.width=Math.round(100*byte/size)+'%';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@ window.noname_update={
|
||||||
version:'1.9.16.1',
|
version:'1.9.16.1',
|
||||||
update:'1.9.15',
|
update:'1.9.15',
|
||||||
changeLog:[
|
changeLog:[
|
||||||
'状态栏选项(需更新ios/android客户端)',
|
'bug修复',
|
||||||
'ios优化'
|
'扩展下载进度'
|
||||||
],
|
],
|
||||||
files:[
|
files:[
|
||||||
'game/game.js',
|
'game/game.js',
|
||||||
|
@ -23,6 +23,7 @@ window.noname_update={
|
||||||
// 'mode/tafang.js',
|
// 'mode/tafang.js',
|
||||||
'mode/stone.js',
|
'mode/stone.js',
|
||||||
'theme/music/style.css',
|
'theme/music/style.css',
|
||||||
|
'theme/woodden/style.css',
|
||||||
'layout/default/layout.css',
|
'layout/default/layout.css',
|
||||||
'layout/default/phone.css',
|
'layout/default/phone.css',
|
||||||
'layout/default/menu.css',
|
'layout/default/menu.css',
|
||||||
|
|
|
@ -1220,10 +1220,19 @@ input.fileinput::-webkit-file-upload-button {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}
|
}
|
||||||
.button-downloading>.button-progress{
|
.button-downloading>.button-progress{
|
||||||
width: 0;
|
width: 100%;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: linear-gradient(rgb(29,206,68),rgb(1,148,46));
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.button-downloading>.button-progress>div{
|
||||||
|
width: 0;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
left: 0px;
|
||||||
|
top: 0px;
|
||||||
|
border-radius: 0px;
|
||||||
|
background: linear-gradient(rgb(29,206,68),rgb(1,148,46));
|
||||||
}
|
}
|
||||||
.button-downloading>div:not(.button-progress){
|
.button-downloading>div:not(.button-progress){
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
|
|
@ -20,7 +20,7 @@ html{
|
||||||
background-image: linear-gradient(rgba(47,101,150,1), rgba(43, 90, 132,1));
|
background-image: linear-gradient(rgba(47,101,150,1), rgba(43, 90, 132,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
.button-downloading>.button-progress{
|
.button-downloading>.button-progress>div{
|
||||||
background: rgba(77,224,100,0.45);
|
background: rgba(77,224,100,0.45);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue