修复获取扩展的bug,增加更新日期字段,修复扩展名过长可能导致不能点击下载扩展按钮的bug

This commit is contained in:
shijian 2023-09-30 00:20:54 +08:00
parent 05e44cb1f6
commit c7988476b3
1 changed files with 6 additions and 5 deletions

View File

@ -46834,7 +46834,7 @@
}
var loading=ui.create.div('.loading.config.toggle','载入中...',page);
var loaded=function(list){
var loaded=function(){
var list=[];
var extension=window.extension;
for(var i in extension){
@ -46848,8 +46848,9 @@
var node=ui.create.div('.videonode.menubutton.extension.large',page,clickExtension);
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','更新日期:'+list[i].date,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(list[i].netdisk){
var linknode=ui.create.div('.text',node);
@ -46870,7 +46871,7 @@
},linknode).link=list[i].forum;
}
download.listen(downloadExtension);
if(lib.config.extensions.contains(list[i].name)){
if(lib.config.extensions.includes(list[i].name)){
download.classList.remove('active');
if(lib.extensionPack[list[i].name]&&lib.extensionPack[list[i].name].version==list[i].version){
download.classList.add('transparent2');
@ -46908,10 +46909,10 @@
window.extension={};
fetch(`${extensionURL}catalog.js`,{
referrerPolicy:'no-referrer'
}).then(value=>value.text()).then(eval).catch(reason=>{
}).then(value=>value.text()).then(eval).then(loaded).catch(reason=>{
console.log(reason);
delete window.extension;
loading.innerHTML='连接失败';
loading.innerHTML='连接失败:'+(reason instanceof Error?reason.message:String(reason));
});
};
if(_thisUpdate) node.update();