This commit is contained in:
libccy 2017-11-18 04:10:45 +08:00
parent 737dfd60ee
commit 03bd08b874
2 changed files with 34 additions and 52 deletions

View File

@ -23271,7 +23271,6 @@
if(pkg){ if(pkg){
filelist.remove('extension.js'); filelist.remove('extension.js');
pkg.files=filelist; pkg.files=filelist;
window.xxx=zip.generate({type:"arraybuffer"})
pkg.size=zip.generate({type:"arraybuffer"}).byteLength; pkg.size=zip.generate({type:"arraybuffer"}).byteLength;
if(pkg.size<1000){ if(pkg.size<1000){
pkg.size=pkg.size+'B'; pkg.size=pkg.size+'B';
@ -23282,7 +23281,13 @@
else{ else{
pkg.size=Math.round(pkg.size/100000)/10+'MB'; pkg.size=Math.round(pkg.size/100000)/10+'MB';
} }
zip.file('package.js','window.noname_extension_package='+JSON.stringify(pkg)); var pkgstr='extension["'+exportext+'"]={\n';
for(var i in pkg){
pkgstr+='\t'+i+':'+JSON.stringify(pkg[i])+',\n'
}
pkgstr=pkgstr.slice(0,pkgstr.length-2);
pkgstr+='\n};';
zip.file('package.js',pkgstr);
} }
var blob = zip.generate({type:"blob"}); var blob = zip.generate({type:"blob"});
var fileNameToSaveAs = exportext; var fileNameToSaveAs = exportext;
@ -32346,7 +32351,7 @@
return infoExtLine; return infoExtLine;
}; };
var authorExtLine=createExtLine('扩展作者',lib.config.connect_nickname); var authorExtLine=createExtLine('扩展作者',lib.config.connect_nickname);
var introExtLine=createExtLine('扩展描述','暂无描述'); var introExtLine=createExtLine('扩展描述');
var versionExtLine=createExtLine('扩展版本','1.0'); var versionExtLine=createExtLine('扩展版本','1.0');
var diskExtLine=createExtLine('网盘地址'); var diskExtLine=createExtLine('网盘地址');
var forumExtLine=createExtLine('讨论地址'); var forumExtLine=createExtLine('讨论地址');
@ -32364,7 +32369,7 @@
} }
else{ else{
authorExtLine.querySelector('input').value=lib.config.connect_nickname||''; authorExtLine.querySelector('input').value=lib.config.connect_nickname||'';
introExtLine.querySelector('input').value='暂无描述'; introExtLine.querySelector('input').value='';
diskExtLine.querySelector('input').value=''; diskExtLine.querySelector('input').value='';
forumExtLine.querySelector('input').value=''; forumExtLine.querySelector('input').value='';
versionExtLine.querySelector('input').value='1.0'; versionExtLine.querySelector('input').value='1.0';
@ -32500,8 +32505,8 @@
game.importExtension(extension,null,page.currentExtension,{ game.importExtension(extension,null,page.currentExtension,{
intro:introExtLine.querySelector('input').value||'', intro:introExtLine.querySelector('input').value||'',
author:authorExtLine.querySelector('input').value||'', author:authorExtLine.querySelector('input').value||'',
diskURL:diskExtLine.querySelector('input').value||'', netdisk:diskExtLine.querySelector('input').value||'',
forumURL:forumExtLine.querySelector('input').value||'', forum:forumExtLine.querySelector('input').value||'',
version:versionExtLine.querySelector('input').value||'', version:versionExtLine.querySelector('input').value||'',
}); });
} }
@ -34565,8 +34570,14 @@
var loading=ui.create.div('.loading.config.toggle','载入中...',page); var loading=ui.create.div('.loading.config.toggle','载入中...',page);
var loaded=function(list){ var loaded=function(list){
var list=window.noname_extension_list; var list=[];
delete window.noname_extension_list; var extension=window.extension;
for(var i in extension){
extension[i].name=i;
list.push(extension[i]);
}
list.randomSort();
delete window.extension;
loading.style.display='none'; loading.style.display='none';
for(var i =0;i<list.length;i++){ for(var i =0;i<list.length;i++){
var node=ui.create.div('.videonode.menubutton.extension.large',page,clickExtension); var node=ui.create.div('.videonode.menubutton.extension.large',page,clickExtension);
@ -34590,7 +34601,12 @@
download.listen(downloadExtension); download.listen(downloadExtension);
if(lib.config.extensions.contains(list[i].name)){ if(lib.config.extensions.contains(list[i].name)){
download.classList.remove('active'); download.classList.remove('active');
if(lib.config['extension_'+list[i].name+'_version']!=list[i].version){ if(lib.extensionPack[list[i].name]&&lib.extensionPack[list[i].name].version==list[i].version){
download.classList.add('transparent2');
download.classList.remove('active');
download.innerHTML='已安装';
}
else if(lib.config['extension_'+list[i].name+'_version']!=list[i].version){
download.innerHTML='更新扩展'; download.innerHTML='更新扩展';
download.classList.add('highlight'); download.classList.add('highlight');
download.classList.add('update'); download.classList.add('update');
@ -34618,62 +34634,29 @@
} }
} }
}; };
window.extension={};
if(game.download){ if(game.download){
lib.init.req(extensionURL+'package.js',function(){ lib.init.req(extensionURL+'package.js',function(){
try{ try{
eval(this.responseText); eval(this.responseText);
if(!window.noname_extension_list){ // if(!window.noname_extension_list){
throw('err'); // throw('err');
} // }
} }
catch(e){ catch(e){
delete window.extension;
loading.innerHTML='连接失败'; loading.innerHTML='连接失败';
return; return;
} }
var list=window.noname_extension_list; loaded();
if(Array.isArray(list)){
list[i]={
name:list[i],
files:[]
};
var num=0;
for(var i=0;i<list.length;i++){
if(typeof list[i]=='string'){
num++;
lib.init.req(extensionURL+list[i]+'/package.js',(function(obj){
return function(){
num--;
if(window.noname_extension_package){
for(var i in window.noname_extension_package){
obj[i]=window.noname_extension_package[i];
}
obj.netdisk=obj.netdisk||obj.diskURL;
obj.forum=obj.forum||obj.forumURL;
delete window.noname_extension_package;
}
if(num==0){
loaded();
}
};
}(list[i])),function(){
num--;
if(num==0){
loaded();
}
});
}
}
loaded();
}
else{
loading.innerHTML='连接失败';
}
},function(){ },function(){
delete window.extension;
loading.innerHTML='连接失败'; loading.innerHTML='连接失败';
}); });
} }
else{ else{
lib.init.js(extensionURL.replace(/raw\.githubusercontent\.com/,'rawgit.com')+'package.js',null,loaded,function(){ lib.init.js(extensionURL.replace(/raw\.githubusercontent\.com/,'rawgit.com')+'package.js',null,loaded,function(){
delete window.extension;
loading.innerHTML='连接失败'; loading.innerHTML='连接失败';
}); });
} }

View File

@ -2,8 +2,7 @@ window.noname_update={
version:'1.9.44', version:'1.9.44',
update:'1.9.43', update:'1.9.43',
changeLog:[ changeLog:[
'扩展可添加作者等信息', '扩展可添加作者等信息'
'升级后扩展目录中的所有扩展将显示为未更新的状态,无视或选择更新均可'
], ],
files:[ files:[
'game/game.js', 'game/game.js',