From 7791c43fdb9a85949c7875cd7b7c6cd24ea643ff Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Fri, 25 Aug 2023 10:24:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJuMethod.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJuMethod.js | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/SrcJuMethod.js b/SrcJuMethod.js index 64f99a50..df385222 100644 --- a/SrcJuMethod.js +++ b/SrcJuMethod.js @@ -33,21 +33,29 @@ function cacheData(jkdata){ } } //接口管理多选方法 -function duoselect(data){ - let id = data.type+"_"+data.name; +function duoselect(datas){ + let datalist = []; + if($.type(datas)=="array"){ + datalist = datas; + }else if($.type(datas)=="object"){ + datalist.push(datas); + } let duoselect = storage0.getMyVar('SrcJu_duoselect')?storage0.getMyVar('SrcJu_duoselect'):[]; - if(!duoselect.some(item => item.name == data.name && item.type==data.type)){ - duoselect.push(data); - updateItem(id, {title:''+data.name + (data.parse ? " [主页源]" : "") + (data.erparse ? " [搜索源]" : "")}) - }else{ - for(var i = 0; i < duoselect.length; i++) { - if(duoselect[i].type+"_"+duoselect[i].name == id) { - duoselect.splice(i, 1); - break; + datalist.forEach(data=>{ + let id = data.type+"_"+data.name; + if(!duoselect.some(item => item.name == data.name && item.type==data.type)){ + duoselect.push(data); + updateItem(id, {title:''+data.name + (data.parse ? " [主页源]" : "") + (data.erparse ? " [搜索源]" : "")}); + }else{ + for(var i = 0; i < duoselect.length; i++) { + if(duoselect[i].type+"_"+duoselect[i].name == id) { + duoselect.splice(i, 1); + break; + } } + updateItem(id, {title:(data.stop?``:"") + data.name + (data.parse ? " [主页源]" : "") + (data.erparse ? " [搜索源]" : "") + (data.stop?``:"")}); } - updateItem(id, {title:(data.stop?``:"") + data.name + (data.parse ? " [主页源]" : "") + (data.erparse ? " [搜索源]" : "") + (data.stop?``:"")}) - } + }) storage0.putMyVar('SrcJu_duoselect',duoselect); } //来自阿尔法大佬的主页幻灯片