From ce4f7298b86b8b6f7a1a76cc67012a537206d4f3 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Sat, 15 Oct 2022 21:55:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcLive.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcLive.js | 63 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/SrcLive.js b/SrcLive.js index 1d257f3a..fb852c4b 100644 --- a/SrcLive.js +++ b/SrcLive.js @@ -7,21 +7,62 @@ function Live() { let livefile = "hiker://files/rules/Src/Juying/live.txt"; let JYlive=fetch(livefile); if(JYlive){ - var datalist = JYlive.split('\n'); + var JYlives = JYlive.split('\n'); }else{ - var datalist = []; + var JYlives = []; } - if(datalist.length>0){ - + if(JYlives.length>0){ + let datalist = []; + let datalist2 = []; + let group = ""; + for(let i=0;i-1){ + group = JYlives[i]; + }else if(JYlives[i].trim()!=""&&JYlives[i].indexOf(',')>-1&&!datalist.some(item => item.name==datalist[i].split(',')[0])){ + datalist.push({group: group, name: datalist[i].split(',')[0]}); + } + } + let grouplist = datalist.map((list)=>{ + return list.group; + }) + //去重复 + function uniq(array){ + var temp = []; //一个新的临时数组 + for(var i = 0; i < array.length; i++){ + if(temp.indexOf(array[i]) == -1){ + temp.push(array[i]); + } + } + return temp; + } + grouplist = uniq(grouplist); + for(var i in grouplist){ + var lists = datalist.filter(item => { + return item.group==grouplist[i]; + }) + d.push({ + title: grouplist[i], + url: $('#noLoading#').lazyRule(()=>{ + + return'hiker://empty'; + }), + col_type: "scroll_button", + extra: { + id: grouplist[i] + } + }); + if(i==0){ + datalist2 = lists; + } + } + datalist = datalist2; //writeFile(livefile, ""); for (let i=0;i',