This commit is contained in:
libccy 2016-05-17 14:29:26 +08:00
parent 447dd1403b
commit 2af255644f
2 changed files with 21 additions and 8 deletions

View File

@ -20762,7 +20762,7 @@
this.classList.add('active'); this.classList.add('active');
} }
}; };
var importExtensionf=function(extname,onsuccess,onerror){ var importExtensionf=function(extname,extversion,onsuccess,onerror){
try{ try{
if(lib.config.all.plays.contains(extname)){ if(lib.config.all.plays.contains(extname)){
throw('err'); throw('err');
@ -20783,6 +20783,9 @@
lib.config.extensions.add(extname); lib.config.extensions.add(extname);
game.saveConfig('extensions',lib.config.extensions); game.saveConfig('extensions',lib.config.extensions);
game.saveConfig('extension_'+extname+'_enable',true); game.saveConfig('extension_'+extname+'_enable',true);
if(extversion){
game.saveConfig('extension_'+extname+'_version',extversion);
}
for(var i in game.importedPack.config){ for(var i in game.importedPack.config){
if(game.importedPack.config[i]&&game.importedPack.config[i].hasOwnProperty('init')){ if(game.importedPack.config[i]&&game.importedPack.config[i].hasOwnProperty('init')){
game.saveConfig('extension_'+extname+'_'+i,game.importedPack.config[i].init); game.saveConfig('extension_'+extname+'_'+i,game.importedPack.config[i].init);
@ -20802,7 +20805,7 @@
} }
}; };
var downloadExtension=function(e){ var downloadExtension=function(e){
if(this.innerHTML!='下载扩展'||!window.JSZip) return; if((this.innerHTML!='下载扩展'&&this.innerHTML!='更新扩展')||!window.JSZip) return;
if(e){ if(e){
e.stopPropagation(); e.stopPropagation();
} }
@ -20820,7 +20823,7 @@
that.innerHTML='下载失败'; that.innerHTML='下载失败';
},function(){ },function(){
if(that.innerHTML=='下载失败') return; if(that.innerHTML=='下载失败') return;
importExtensionf(that.name,function(){ importExtensionf(that.name,that.version,function(){
that.innerHTML='安装成功'; that.innerHTML='安装成功';
that.classList.remove('active'); that.classList.remove('active');
that.classList.add('highlight'); that.classList.add('highlight');
@ -20860,13 +20863,24 @@
ui.create.div('.text',list[i].description,node); ui.create.div('.text',list[i].description,node);
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.remove('active'); download.classList.remove('active');
download.innerHTML='已安装'; console.log(lib.config['extension_'+list[i].name+'_version'],list[i].version);
if(lib.config['extension_'+list[i].name+'_version']!=list[i].version){
download.innerHTML='更新扩展';
download.classList.add('highlight');
}
else{
download.classList.add('transparent2');
download.classList.remove('active');
download.innerHTML='已安装';
}
} }
download.link=i; download.link=i;
download.name=list[i].name; download.name=list[i].name;
download.files=list[i].files||[]; download.files=list[i].files||[];
if(list[i].version){
download.version=list[i].version;
}
} }
},function(){ },function(){
loading.innerHTML='连接失败'; loading.innerHTML='连接失败';

View File

@ -1,8 +1,7 @@
window.noname_update={ window.noname_update={
version:'1.8.10.2', version:'1.8.10.3',
changeLog:[ changeLog:[
'扩展改进', '扩展更新',
'装备显示选项',
], ],
files:{ files:{
global:['game/game.js'], global:['game/game.js'],