function Live() { addListener("onClose", $.toString(() => { //clearMyVar('guanlicz'); })); var d = []; let livefile = "hiker://files/rules/Src/Juying/live.txt"; let JYlive=fetch(livefile); if(JYlive){ var JYlives = JYlive.split('\n'); }else{ var JYlives = []; } if(JYlives.length>0){ d.push({ title: '聚影√     ⚙直播设置⚙', img: "https://img.vinua.cn/images/QqyC.png", url: $('hiker://empty#noRecordHistory##noHistory#').rule(() => { require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcLive.js'); LiveSet(); }), col_type: 'avatar' }); let datalist = []; let datalist2 = []; let group = ""; for(let i=0;i-1){ group = JYlives[i].split(',')[0]; }else if(JYlives[i].indexOf(',http')>-1){ datalist.push({group: group, name: JYlives[i].split(',')[0].trim()}); } }catch(e){} } let obj = {}; datalist = datalist.reduce((newArr, next) => { obj[next.name] ? "" : (obj[next.name] = true && newArr.push(next)); return newArr; }, []); d.push({ title: "🔍", url: $.toString((guanlidata,datalist) => { if(datalist.length>0){ deleteItemByCls('livelist'); var lists = datalist.filter(item => { return item.name.includes(input); }) let gldatalist = guanlidata(lists); addItemAfter('liveloading', gldatalist); } return "hiker://empty"; },guanlidata,datalist), desc: "搜你想要的...", col_type: "input", extra: { titleVisible: true } }); d.push({ col_type: 'line' }); 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); let index = 0; for(var i in grouplist){ let lists = datalist.filter(item => { return item.group==grouplist[i]; }) if(lists.length>0){ if(index==0){ datalist2 = lists; index = 1; } d.push({ title: grouplist[i], url: $('#noLoading#').lazyRule((guanlidata,datalist) => { if(datalist.length>0){ deleteItemByCls('livelist'); var lists = datalist.filter(item => { return item.name.includes(input); }) let gldatalist = guanlidata(lists); addItemAfter('liveloading', gldatalist); } return "hiker://empty"; },guanlidata,lists), col_type: "scroll_button", extra: { id: grouplist[i] } }); } } d.push({ col_type: 'line', extra: { id: 'liveloading' } }); datalist = datalist2; d = d.concat(guanlidata(datalist)); d.push({ title: '
', col_type: 'rich_text' }); }else{ d.push({ title: '没有直播数据源', col_type: 'rich_text' }); } setHomeResult(d); } function guanlidata(datalist) { /* function compare (attr,rev) { if(rev == undefined){ rev = 1; }else{ rev = (rev) ? 1 : -1; } return (a,b) => { a = a[attr]; b = b[attr]; if(a.replace(/[^\d]/g, "")&&b.replace(/[^\d]/g, "")){ if(parseInt(a.replace(/[^\d]/g, "")) < parseInt(b.replace(/[^\d]/g, ""))){ return rev * -1; } if(parseInt(a.replace(/[^\d]/g, "")) > parseInt(b.replace(/[^\d]/g, ""))){ return rev * 1; } return 0; }else{ if(a < b){ return rev * -1; } if(a > b){ return rev * 1; } return 0; } } } datalist = datalist.sort(compare('name',true)); */ let list = []; for (let i=0;i { let urls = []; let JYlive=fetch("hiker://files/rules/Src/Juying/live.txt"); let JYlives = JYlive.split('\n'); for(var i = 0; i < JYlives.length; i++){ try{ if(JYlives[i].indexOf(',')>-1&&JYlives[i].split(',')[0].trim()==name){ urls.push(JYlives[i].split(',')[1] + '#isVideo=true#'); } }catch(e){} } return JSON.stringify({ urls: urls }); },datalist[i].name), extra: { cls: 'livelist' } }); } return list; } function LiveSet() { addListener("onClose", $.toString(() => { //clearMyVar('guanlicz'); refreshPage(false); })); var d = []; d.push({ title: '直播源检测', img: 'https://lanmeiguojiang.com/tubiao/messy/22.svg', col_type: 'icon_2_round', url: $('#noLoading#').lazyRule(() => { let Julivefile = "hiker://files/rules/live/config.json"; let Julive = fetch(Julive); if(Julive != ""){ try{ eval("var Judata=" + Julive+ ";"); let Judatalist = Judata['data']||[]; let JYlivefile = "hiker://files/rules/Src/Juying/live.txt"; if(!Judatalist.some(item => item.url==JYlivefile)){ Judatalist.push({"name":"聚影√", "url":JYlivefile}) Judata['data'] = Judatalist; writeFile(Julivefile, JSON.stringify(Judata)); return "toast://导入聚直播订阅成功"; }else{ return "toast://已存在聚直播订阅"; } }catch(e){ log("导入聚直播订阅失败>"+e.message); return "toast://导入聚直播订阅失败"; } }else{ return "toast://仓库先导入聚直播小程序"; } }) }); d.push({ title: '导入聚直播', img: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fis4.mzstatic.com%2Fimage%2Fthumb%2FPurple3%2Fv4%2Fdf%2Ff6%2Fda%2Fdff6da83-47d7-9cb6-2398-1919c13837b4%2Fmzl.kgmnwodo.png%2F0x0ss-85.jpg&refer=http%3A%2F%2Fis4.mzstatic.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1638629349&t=2f6d967185fe2b9c54e8b230eb83e66c', col_type: 'icon_2_round', url: $('#noLoading#').lazyRule(() => { let Julivefile = "hiker://files/rules/live/config.json"; let Julive = fetch(Julive); if(Julive != ""){ try{ eval("var Judata=" + Julive+ ";"); let Judatalist = Judata['data']||[]; let JYlivefile = "hiker://files/rules/Src/Juying/live.txt"; if(!Judatalist.some(item => item.url==JYlivefile)){ Judatalist.push({"name":"聚影√", "url":JYlivefile}) Judata['data'] = Judatalist; writeFile(Julivefile, JSON.stringify(Judata)); return "toast://导入聚直播订阅成功"; }else{ return "toast://已存在聚直播订阅"; } }catch(e){ log("导入聚直播订阅失败>"+e.message); return "toast://导入聚直播订阅失败"; } }else{ return "toast://仓库先导入聚直播小程序"; } }) }); d.push({ title: '清空直播源', img: 'https://lanmeiguojiang.com/tubiao/more/216.png', col_type: 'icon_2_round', url: $('#noLoading#').lazyRule(() => { writeFile("hiker://files/rules/Src/Juying/live.txt", ""); return "hiker://empty"; }) }); setHomeResult(d); }