This commit is contained in:
libccy 2016-05-15 02:26:25 +08:00
parent 1eea54de7d
commit b02aca9fc9
1 changed files with 13 additions and 11 deletions

View File

@ -20607,6 +20607,7 @@
var createModeConfig=function(mode,position){ var createModeConfig=function(mode,position){
var page=ui.create.div(''); var page=ui.create.div('');
page.style.paddingBottom='10px';
var node; var node;
if(mode.indexOf('extension_')==0){ if(mode.indexOf('extension_')==0){
node=ui.create.div('.menubutton.large',mode.slice(10),position,clickMode); node=ui.create.div('.menubutton.large',mode.slice(10),position,clickMode);
@ -20718,7 +20719,7 @@
} }
var clickExtension=function(){ var clickExtension=function(){
var active=this.parentNode.querySelector('.active'); var active=this.parentNode.querySelector('.videonode.active');
if(active){ if(active){
active.classList.remove('active'); active.classList.remove('active');
} }
@ -20726,7 +20727,7 @@
this.classList.add('active'); this.classList.add('active');
} }
}; };
var importExtension=function(extname,onsuccess,onerror){ var importExtensionf=function(extname,onsuccess,onerror){
try{ try{
if(lib.config.all.plays.contains(extname)){ if(lib.config.all.plays.contains(extname)){
throw('err'); throw('err');
@ -20765,8 +20766,12 @@
onerror(); onerror();
} }
}; };
var downloadExtension=function(){ var downloadExtension=function(e){
if(this.innerHTML!='下载扩展'||!window.JSZip) return; if(this.innerHTML!='下载扩展'||!window.JSZip) return;
if(e){
e.stopPropagation();
}
node.updated=true;
this.innerHTML='正在下载'; this.innerHTML='正在下载';
if(lib.updateURL[lib.updateURL.length-1]!='/'){ if(lib.updateURL[lib.updateURL.length-1]!='/'){
lib.updateURL+='/'; lib.updateURL+='/';
@ -20780,8 +20785,10 @@
that.innerHTML='下载失败'; that.innerHTML='下载失败';
},function(){ },function(){
if(that.innerHTML=='下载失败') return; if(that.innerHTML=='下载失败') return;
importExtension(that.name,function(){ importExtensionf(that.name,function(){
that.innerHTML='安装成功'; that.innerHTML='安装成功';
that.classList.remove('active');
that.classList.add('highlight');
reloadnode.style.display=''; reloadnode.style.display='';
},function(){ },function(){
that.innerHTML='安装失败'; that.innerHTML='安装失败';
@ -20792,13 +20799,7 @@
}; };
node.update=function(){ node.update=function(){
if(!game.download) return; if(!game.download||this.updated) return;
var buttons=page.querySelectorAll('.menubutton.text.active');
for(var i=0;i<buttons.length;i++){
if(buttons[i].innerHTML=='正在下载'){
return;
}
}
if(!window.JSZip){ if(!window.JSZip){
lib.init.js(lib.assetURL+'game','jszip'); lib.init.js(lib.assetURL+'game','jszip');
} }
@ -20825,6 +20826,7 @@
var download=ui.create.div('.menubutton.text.active','下载扩展',node.firstChild,downloadExtension); var download=ui.create.div('.menubutton.text.active','下载扩展',node.firstChild,downloadExtension);
if(lib.config.extensions.contains(list[i].name)){ if(lib.config.extensions.contains(list[i].name)){
download.classList.add('transparent2'); download.classList.add('transparent2');
download.classList.remove('active');
download.innerHTML='已安装'; download.innerHTML='已安装';
} }
download.link=i; download.link=i;