From 9fcf9e26daeb2034d195c986e697f82ffdc2856b Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Sat, 15 Oct 2022 22:10:01 +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 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/SrcLive.js b/SrcLive.js index a2e80d27..6f66cdd9 100644 --- a/SrcLive.js +++ b/SrcLive.js @@ -22,11 +22,9 @@ function Live() { datalist.push({group: group, name: JYlives[i].split(',')[0], url: JYlives[i].split(',')[1]}); } } - log(1) let grouplist = datalist.map((list)=>{ return list.group; }) - log(2) //去重复 function uniq(array){ var temp = []; //一个新的临时数组 @@ -38,11 +36,15 @@ function Live() { return temp; } grouplist = uniq(grouplist); - log(3) for(var i in grouplist){ - var lists = datalist.filter(item => { + let lists = datalist.filter(item => { return item.group==grouplist[i]; }) + let obj = {}; + lists = lists.reduce((newArr, next) => { + obj[next.name] ? "" : (obj[next.name] = true && newArr.push(next)); + return newArr; + }, []); d.push({ title: grouplist[i], url: $('#noLoading#').lazyRule(()=>{ @@ -58,7 +60,7 @@ function Live() { datalist2 = lists; } } - log(4) + datalist = datalist2; //writeFile(livefile, ""); for (let i=0;i