更新 'SrcLive.js'

pull/1/head
src48597962 2 years ago
parent 7778b7a5b3
commit c75f78e2d6
  1. 49
      SrcLive.js

@ -5,8 +5,8 @@ function Live() {
clearMyVar('JYlivenum'); clearMyVar('JYlivenum');
})); }));
var d = []; var d = [];
let livefile = "hiker://files/rules/Src/Juying/live.txt"; let JYlivefile = "hiker://files/rules/Src/Juying/live.txt";
let JYlive=fetch(livefile); let JYlive=fetch(JYlivefile);
let livecfgfile = "hiker://files/rules/Src/Juying/liveconfig.json"; let livecfgfile = "hiker://files/rules/Src/Juying/liveconfig.json";
let livecfg = fetch(livecfgfile); let livecfg = fetch(livecfgfile);
@ -24,7 +24,7 @@ function Live() {
if(!fileExist('live'+md5(livedata[0])+'.txt')){ if(!fileExist('live'+md5(livedata[0])+'.txt')){
saveFile('live'+md5(livedata[0])+'.txt',YChtml); saveFile('live'+md5(livedata[0])+'.txt',YChtml);
} }
writeFile(livefile, YChtml); writeFile(JYlivefile, YChtml);
JYlive = YChtml; JYlive = YChtml;
} }
hideLoading(); hideLoading();
@ -103,7 +103,7 @@ function Live() {
if(lists.length>0){ if(lists.length>0){
d.push({ d.push({
title: index==0?'‘‘’’<b><span style="color:#3399cc">'+grouplist[i]:grouplist[i], title: index==0?'‘‘’’<b><span style="color:#3399cc">'+grouplist[i]:grouplist[i],
url: $('#noLoading#').lazyRule((grouplist,groupname,guanlidata,datalist,livefile) => { url: $('#noLoading#').lazyRule((grouplist,groupname,guanlidata,datalist,JYlivefile) => {
for(let i in grouplist){ for(let i in grouplist){
if(grouplist[i]==groupname){ if(grouplist[i]==groupname){
updateItem(groupname,{title:'‘‘’’<b><span style="color:#3399cc">'+groupname}) updateItem(groupname,{title:'‘‘’’<b><span style="color:#3399cc">'+groupname})
@ -120,7 +120,7 @@ function Live() {
addItemAfter('liveloading', gldatalist); addItemAfter('liveloading', gldatalist);
return "hiker://empty"; return "hiker://empty";
}else if(getMyVar('editmode','0')=="groupdelete"){ }else if(getMyVar('editmode','0')=="groupdelete"){
let JYlive=fetch(livefile); let JYlive=fetch(JYlivefile);
let JYlives = JYlive.split('\n'); let JYlives = JYlive.split('\n');
for(let i=0;i<JYlives.length;i++){ for(let i=0;i<JYlives.length;i++){
try{ try{
@ -133,13 +133,13 @@ function Live() {
} }
}catch(e){} }catch(e){}
} }
writeFile(livefile, JYlives.join('\n')); writeFile(JYlivefile, JYlives.join('\n'));
refreshPage(false); refreshPage(false);
return "toast://已删除分组 <"+groupname+"> 所有地址"; return "toast://已删除分组 <"+groupname+"> 所有地址";
}else if(getMyVar('editmode','0')=="grouprename"){ }else if(getMyVar('editmode','0')=="grouprename"){
return $("","输入新的分组名").input((groupname,livefile)=>{ return $("","输入新的分组名").input((groupname,JYlivefile)=>{
if(input){ if(input){
let JYlive=fetch(livefile); let JYlive=fetch(JYlivefile);
let JYlives = JYlive.split('\n'); let JYlives = JYlive.split('\n');
for(let i=0;i<JYlives.length;i++){ for(let i=0;i<JYlives.length;i++){
try{ try{
@ -148,15 +148,15 @@ function Live() {
} }
}catch(e){} }catch(e){}
} }
writeFile(livefile, JYlives.join('\n')); writeFile(JYlivefile, JYlives.join('\n'));
refreshPage(false); refreshPage(false);
return "toast:// <"+groupname+"> 分组改名为 <"+input+">"; return "toast:// <"+groupname+"> 分组改名为 <"+input+">";
}else{ }else{
return "toast://输入不能为空" return "toast://输入不能为空"
} }
},groupname,livefile) },groupname,JYlivefile)
} }
},grouplist,grouplist[i],guanlidata,lists,livefile), },grouplist,grouplist[i],guanlidata,lists,JYlivefile),
col_type: "scroll_button", col_type: "scroll_button",
extra: { extra: {
id: grouplist[i] id: grouplist[i]
@ -228,8 +228,8 @@ function guanlidata(datalist) {
img: 'https://lanmeiguojiang.com/tubiao/ke/156.png',//https://lanmeiguojiang.com/tubiao/more/228.png img: 'https://lanmeiguojiang.com/tubiao/ke/156.png',//https://lanmeiguojiang.com/tubiao/more/228.png
col_type: 'icon_2_round', col_type: 'icon_2_round',
url: $('#noLoading#').lazyRule((name) => { url: $('#noLoading#').lazyRule((name) => {
let livefile=fetch("hiker://files/rules/Src/Juying/live.txt"); let JYlivefile=fetch("hiker://files/rules/Src/Juying/live.txt");
let JYlives = livefile.split('\n'); let JYlives = JYlivefile.split('\n');
if(getMyVar('editmode','0')=="0"){ if(getMyVar('editmode','0')=="0"){
let urls = []; let urls = [];
for(let i = 0;i<JYlives.length;i++){ for(let i = 0;i<JYlives.length;i++){
@ -251,13 +251,13 @@ function guanlidata(datalist) {
} }
}catch(e){} }catch(e){}
} }
writeFile(livefile, JYlives.join('\n')); writeFile(JYlivefile, JYlives.join('\n'));
refreshPage(false); deleteItemByCls(name);
return "toast://已删除地址 <"+name+">"; return "toast://已删除地址 <"+name+">";
}else if(getMyVar('editmode','0')=="urlrename"){ }else if(getMyVar('editmode','0')=="urlrename"){
return $("","输入新的地址名").input((name,livefile)=>{ return $("","输入新的地址名").input((name,JYlivefile)=>{
if(input){ if(input){
let JYlive=fetch(livefile); let JYlive=fetch(JYlivefile);
let JYlives = JYlive.split('\n'); let JYlives = JYlive.split('\n');
for(let i=0;i<JYlives.length;i++){ for(let i=0;i<JYlives.length;i++){
try{ try{
@ -266,16 +266,19 @@ function guanlidata(datalist) {
} }
}catch(e){} }catch(e){}
} }
writeFile(livefile, JYlives.join('\n')); writeFile(JYlivefile, JYlives.join('\n'));
refreshPage(false); updateItem(name, {
title: input
});
return "toast:// <"+name+"> 改名为 <"+input+">"; return "toast:// <"+name+"> 改名为 <"+input+">";
}else{ }else{
return "toast://输入不能为空" return "toast://输入不能为空"
} }
},name,livefile) },name,JYlivefile)
} }
},datalist[i].name), },datalist[i].name),
extra: { extra: {
id: datalist[i].name,
cls: 'livelist' cls: 'livelist'
} }
}); });
@ -426,8 +429,8 @@ function LiveSet() {
} }
if(YClives.length>0){ if(YClives.length>0){
let importnum = 0; let importnum = 0;
let livefile = "hiker://files/rules/Src/Juying/live.txt"; let JYlivefile = "hiker://files/rules/Src/Juying/live.txt";
let JYlive=fetch(livefile); let JYlive=fetch(JYlivefile);
if(JYlive){ if(JYlive){
var JYlives = JYlive.split('\n'); var JYlives = JYlive.split('\n');
let id = 0; let id = 0;
@ -454,7 +457,7 @@ function LiveSet() {
var JYlives = YClives; var JYlives = YClives;
importnum = JYlives.length; importnum = JYlives.length;
} }
writeFile(livefile, JYlives.join('\n')); writeFile(JYlivefile, JYlives.join('\n'));
hideLoading(); hideLoading();
if(importnum>0){ if(importnum>0){
putMyVar('isEdit','1'); putMyVar('isEdit','1');

Loading…
Cancel
Save