From 50738bb829e4aee0f0b4fabba2434b4ec7a74d07 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Sat, 20 Jul 2024 23:22:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJyPublic.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJyPublic.js | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/SrcJyPublic.js b/SrcJyPublic.js index c8862a99..b43091c0 100644 --- a/SrcJyPublic.js +++ b/SrcJyPublic.js @@ -413,15 +413,22 @@ function selectSource() { let tmpList = sourceList; hikerPop.setUseStartActivity(false); - let index = 0; - let names = sourceList.map((v,i) => { - let vname = v.name; - if(v.url == sourceUrl && v.name==sourceName){ - index = i; - vname = `‘‘’’`+v.name+``; - } - return vname; - }); + + function getnames(list) { + let index = 0; + let names = list.map((v,i) => { + let vname = v.name; + if(v.url == sourceUrl && v.name==sourceName){ + index = i; + vname = `‘‘’’`+v.name+``; + } + return vname; + }); + return {names:names,index:index}; + } + let index_names = getnames(sourceList); + let index = index_names.index; + let names = index_names.names; let spen = 3; let inputBox; let pop = hikerPop.selectBottomRes({ @@ -454,20 +461,22 @@ function selectSource() { columns: 3, title: "切换源分组", //position: groupnames.indexOf(sourceName), - click(a) { - if(a.startsWith('[')){ + click(s) { + if(s.startsWith('[')){ inputBox.setTitle('全部'); - inputBox.setDefaultValue(a); + inputBox.setDefaultValue(s); sourceList = getGroupLists(sourceAllList, '全部'); + tmpList = sourceList.filter(x => x.name.toLowerCase().includes(s.toLowerCase())); + names = getnames(tmpList).names; + names = names.filter(x => x.toLowerCase().includes(s.toLowerCase())); }else{ - inputBox.setTitle(a); + inputBox.setTitle(s); inputBox.setDefaultValue(""); - sourceList = getGroupLists(sourceAllList, a); + sourceList = getGroupLists(sourceAllList, s); + tmpList = sourceList; + names = getnames(tmpList).names; } - tmpList = sourceList; - names = sourceList.map((v,i) => { - return v.name; - }); + manage.list.length = 0; names.forEach(x => { manage.list.push(x);