Merge pull request #425 from nonameShijian/PR-Branch

修复获取扩展的bug,增加更新日期字段,修复扩展名过长可能导致不能点击下载扩展按钮的bug
This commit is contained in:
Spmario233 2023-09-30 01:00:47 +08:00 committed by GitHub
commit 001558ba17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -46832,7 +46832,7 @@
} }
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(){
var list=[]; var list=[];
var extension=window.extension; var extension=window.extension;
for(var i in extension){ for(var i in extension){
@ -46846,8 +46846,9 @@
var node=ui.create.div('.videonode.menubutton.extension.large',page,clickExtension); var node=ui.create.div('.videonode.menubutton.extension.large',page,clickExtension);
ui.create.div('.caption',list[i].name,node); ui.create.div('.caption',list[i].name,node);
ui.create.div('.text.author','作者:'+list[i].author+'<span>('+list[i].size+')</span>',node); ui.create.div('.text.author','作者:'+list[i].author+'<span>('+list[i].size+')</span>',node);
ui.create.div('.text','更新日期:'+list[i].date,node);
ui.create.div('.text',list[i].intro,node); ui.create.div('.text',list[i].intro,node);
var download=ui.create.div('.menubutton.text.active','下载扩展',node.firstChild); var download=ui.create.div('.menubutton.text.active','下载扩展',node.firstChild,{'zIndex':'5'});
if(game.download){ if(game.download){
if(list[i].netdisk){ if(list[i].netdisk){
var linknode=ui.create.div('.text',node); var linknode=ui.create.div('.text',node);
@ -46868,7 +46869,7 @@
},linknode).link=list[i].forum; },linknode).link=list[i].forum;
} }
download.listen(downloadExtension); download.listen(downloadExtension);
if(lib.config.extensions.contains(list[i].name)){ if(lib.config.extensions.includes(list[i].name)){
download.classList.remove('active'); download.classList.remove('active');
if(lib.extensionPack[list[i].name]&&lib.extensionPack[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.add('transparent2');
@ -46906,10 +46907,10 @@
window.extension={}; window.extension={};
fetch(`${extensionURL}catalog.js`,{ fetch(`${extensionURL}catalog.js`,{
referrerPolicy:'no-referrer' referrerPolicy:'no-referrer'
}).then(value=>value.text()).then(eval).catch(reason=>{ }).then(value=>value.text()).then(eval).then(loaded).catch(reason=>{
console.log(reason); console.log(reason);
delete window.extension; delete window.extension;
loading.innerHTML='连接失败'; loading.innerHTML='连接失败:'+(reason instanceof Error?reason.message:String(reason));
}); });
}; };
if(_thisUpdate) node.update(); if(_thisUpdate) node.update();