更新 'SrcJuSet.js'

Ju
src48597962 2 years ago
parent bd97863d31
commit 1d21924f36
  1. 61
      SrcJuSet.js

@ -1,29 +1,8 @@
////本代码仅用于个人学习,请勿用于其他作用,下载后请24小时内删除,代码虽然是公开学习的,但请尊重作者,应留下说明 ////本代码仅用于个人学习,请勿用于其他作用,下载后请24小时内删除,代码虽然是公开学习的,但请尊重作者,应留下说明
function SRCSet() { function SRCSet() {
setPageTitle('♥管理'); setPageTitle('♥管理');
require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJuPublic.js');
let cfgfile = "hiker://files/rules/Src/Ju/config.json";
let Jucfg=fetch(cfgfile);
if(Jucfg != ""){
eval("var Juconfig=" + Jucfg+ ";");
}else{
var Juconfig= {};
}
let yijisource = Juconfig['yijisource'] || "";
let filepath = "hiker://files/rules/Src/Ju/jiekou.json";
let sourcedata = fetch(filepath);
if(sourcedata != ""){
try{
eval("var datalist=" + sourcedata+ ";");
}catch(e){
var datalist = [];
}
}else{
var datalist = [];
}
let yidatalist = datalist.filter(it=>{
return it.parse;
});
let sourcenames = yidatalist.map(it=>{ let sourcenames = yidatalist.map(it=>{
return it.name; return it.name;
}) })
@ -60,17 +39,17 @@ function SRCSet() {
}) })
d.push({ d.push({
title: '增加', title: '增加',
url: $('hiker://empty#noRecordHistory##noHistory#').rule((filepath) => { url: $('hiker://empty#noRecordHistory##noHistory#').rule((sourcefile) => {
setPageTitle('增加 | 聚漫接口'); setPageTitle('增加 | 聚漫接口');
require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJuSet.js'); require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJuSet.js');
jiekouapi(filepath); jiekouapi(sourcefile);
}, filepath), }, sourcefile),
img: "https://lanmeiguojiang.com/tubiao/more/25.png", img: "https://lanmeiguojiang.com/tubiao/more/25.png",
col_type: "icon_small_3" col_type: "icon_small_3"
}); });
d.push({ d.push({
title: '导入', title: '导入',
url: $("", "聚漫分享口令的云剪贴板").input((filepath,ImportType) => { url: $("", "聚漫分享口令的云剪贴板").input((sourcefile,ImportType) => {
try { try {
let inputname = input.split('¥')[0]; let inputname = input.split('¥')[0];
if (inputname == "聚漫接口") { if (inputname == "聚漫接口") {
@ -78,7 +57,7 @@ function SRCSet() {
let parseurl = aesDecode('SrcJu', input.split('¥')[1]); let parseurl = aesDecode('SrcJu', input.split('¥')[1]);
let content = parsePaste(parseurl); let content = parsePaste(parseurl);
let datalist2 = JSON.parse(aesDecode('SrcJu', content)); let datalist2 = JSON.parse(aesDecode('SrcJu', content));
let datafile = fetch(filepath); let datafile = fetch(sourcefile);
if (datafile != "") { if (datafile != "") {
try { try {
eval("var datalist=" + datafile + ";"); eval("var datalist=" + datafile + ";");
@ -100,7 +79,7 @@ function SRCSet() {
num = num + 1; num = num + 1;
} }
} }
writeFile(filepath, JSON.stringify(datalist)); writeFile(sourcefile, JSON.stringify(datalist));
clearMyVar('searchMark'); clearMyVar('searchMark');
hideLoading(); hideLoading();
refreshPage(false); refreshPage(false);
@ -112,7 +91,7 @@ function SRCSet() {
log(e.message); log(e.message);
return "toast://聚漫√:口令有误"; return "toast://聚漫√:口令有误";
} }
}, filepath, Juconfig['ImportType']), }, sourcefile, Juconfig['ImportType']),
img: "https://lanmeiguojiang.com/tubiao/more/43.png", img: "https://lanmeiguojiang.com/tubiao/more/43.png",
col_type: "icon_small_3", col_type: "icon_small_3",
extra: { extra: {
@ -151,7 +130,7 @@ function SRCSet() {
datalist.forEach(item => { datalist.forEach(item => {
d.push({ d.push({
title: "🎃 " + item.name + (item.parse ? "(主页源)" : "") + (item.erparse ? "(搜索源)" : ""), title: "🎃 " + item.name + (item.parse ? "(主页源)" : "") + (item.erparse ? "(搜索源)" : ""),
url: $(["分享", "编辑", "删除"], 1).select((filepath, data) => { url: $(["分享", "编辑", "删除"], 1).select((sourcefile, data) => {
if (input == "分享") { if (input == "分享") {
showLoading('分享上传中,请稍后...'); showLoading('分享上传中,请稍后...');
let oneshare = [] let oneshare = []
@ -166,22 +145,22 @@ function SRCSet() {
return "toast://分享失败,剪粘板或网络异常"; return "toast://分享失败,剪粘板或网络异常";
} }
} else if (input == "编辑") { } else if (input == "编辑") {
return $('hiker://empty#noRecordHistory##noHistory#').rule((filepath, data) => { return $('hiker://empty#noRecordHistory##noHistory#').rule((sourcefile, data) => {
setPageTitle('编辑 | 聚漫接口'); setPageTitle('编辑 | 聚漫接口');
require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJuSet.js'); require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJuSet.js');
jiekouapi(filepath, data); jiekouapi(sourcefile, data);
}, filepath, data) }, sourcefile, data)
} else if (input == "删除") { } else if (input == "删除") {
let datafile = fetch(filepath); let datafile = fetch(sourcefile);
eval("var datalist=" + datafile + ";"); eval("var datalist=" + datafile + ";");
let index = datalist.indexOf(datalist.filter(d => d.name == data.name)[0]); let index = datalist.indexOf(datalist.filter(d => d.name == data.name)[0]);
datalist.splice(index, 1); datalist.splice(index, 1);
writeFile(filepath, JSON.stringify(datalist)); writeFile(sourcefile, JSON.stringify(datalist));
clearMyVar('searchMark'); clearMyVar('searchMark');
refreshPage(false); refreshPage(false);
return 'toast://已删除'; return 'toast://已删除';
} }
}, filepath, item), }, sourcefile, item),
desc: '', desc: '',
col_type: "text_1" col_type: "text_1"
}); });
@ -190,7 +169,7 @@ function SRCSet() {
setResult(d); setResult(d);
} }
function jiekouapi(filepath, data) { function jiekouapi(sourcefile, data) {
addListener("onClose", $.toString(() => { addListener("onClose", $.toString(() => {
clearMyVar('jiekouname'); clearMyVar('jiekouname');
clearMyVar('jiekouparse'); clearMyVar('jiekouparse');
@ -295,7 +274,7 @@ function jiekouapi(filepath, data) {
d.push({ d.push({
title: '保存接口', title: '保存接口',
col_type: 'text_2', col_type: 'text_2',
url: $().lazyRule((filepath) => { url: $().lazyRule((sourcefile) => {
if (!getMyVar('jiekouname')) { if (!getMyVar('jiekouname')) {
return "toast://名称不能为空"; return "toast://名称不能为空";
} }
@ -311,7 +290,7 @@ function jiekouapi(filepath, data) {
} }
if (parse) { newapi['parse'] = parse; } if (parse) { newapi['parse'] = parse; }
if (erparse) { newapi['erparse'] = erparse; } if (erparse) { newapi['erparse'] = erparse; }
let datafile = fetch(filepath); let datafile = fetch(sourcefile);
if (datafile != "") { if (datafile != "") {
try { try {
eval("var datalist=" + datafile + ";"); eval("var datalist=" + datafile + ";");
@ -329,7 +308,7 @@ function jiekouapi(filepath, data) {
datalist.splice(index, 1); datalist.splice(index, 1);
} }
datalist.push(newapi); datalist.push(newapi);
writeFile(filepath, JSON.stringify(datalist)); writeFile(sourcefile, JSON.stringify(datalist));
clearMyVar('searchMark'); clearMyVar('searchMark');
back(true); back(true);
return "toast://已保存"; return "toast://已保存";
@ -337,7 +316,7 @@ function jiekouapi(filepath, data) {
} catch (e) { } catch (e) {
return "toast://接口数据异常,请确认对象格式"; return "toast://接口数据异常,请确认对象格式";
} }
}, filepath) }, sourcefile)
}); });
setResult(d); setResult(d);
} }
Loading…
Cancel
Save