更新 'SrcJuSet.js'

Ju
src48597962 2 years ago
parent 81cc24d141
commit 09d60edd39
  1. 61
      SrcJuSet.js

@ -22,10 +22,10 @@ function SRCSet() {
col_type: "icon_2" col_type: "icon_2"
}); });
let runType = ["漫画", "阅读"]; let runTypes = ["漫画", "阅读"];
d.push({ d.push({
title: (Juconfig["runType"]||runType[0]) + "模式", title: (Juconfig["runType"]||runTypes[0]) + "模式",
url: $(runType,2,"切换运行模式").select((cfgfile,Juconfig) => { url: $(runTypes,2,"切换运行模式").select((cfgfile,Juconfig) => {
Juconfig["runType"] = input; Juconfig["runType"] = input;
writeFile(cfgfile, JSON.stringify(Juconfig)); writeFile(cfgfile, JSON.stringify(Juconfig));
refreshPage(false); refreshPage(false);
@ -57,10 +57,10 @@ 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(sourcefile); let sourcedata = fetch(sourcefile);
if (datafile != "") { if (sourcedata != "") {
try { try {
eval("var datalist=" + datafile + ";"); eval("var datalist=" + sourcedata + ";");
} catch (e) { } catch (e) {
var datalist = []; var datalist = [];
} }
@ -69,12 +69,12 @@ function SRCSet() {
} }
let num = 0; let num = 0;
for (let i = 0; i < datalist2.length; i++) { for (let i = 0; i < datalist2.length; i++) {
if (ImportType=="Coverage" && datalist.some(item => item.name == datalist2[i].name)) { if (ImportType=="Coverage" && datalist.some(item => item.name == datalist2[i].name && item.type==datalist2[i].type)) {
let index = datalist.indexOf(datalist.filter(d => d.name == datalist2[i].name)[0]); let index = datalist.indexOf(datalist.filter(d => d.name == datalist2[i].name && d.type==datalist2[i].type)[0]);
datalist.splice(index, 1); datalist.splice(index, 1);
datalist.push(datalist2[i]); datalist.push(datalist2[i]);
num = num + 1; num = num + 1;
}else if (!datalist.some(item => item.name == datalist2[i].name)) { }else if (!datalist.some(item => item.name == datalist2[i].name && item.type==datalist2[i].type)) {
datalist.push(datalist2[i]); datalist.push(datalist2[i]);
num = num + 1; num = num + 1;
} }
@ -151,34 +151,39 @@ function SRCSet() {
jiekouapi(sourcefile, data); jiekouapi(sourcefile, data);
}, sourcefile, data) }, sourcefile, data)
} else if (input == "删除") { } else if (input == "删除") {
let datafile = fetch(sourcefile); return $("确定删除:"+dataname).confirm((sourcefile,data)=>{
eval("var datalist=" + datafile + ";"); let sourcedata = fetch(sourcefile);
let index = datalist.indexOf(datalist.filter(d => d.name == data.name)[0]); eval("var datalist=" + sourcedata + ";");
datalist.splice(index, 1); let index = datalist.indexOf(datalist.filter(d => d.name == data.name && d.type==data.type)[0]);
writeFile(sourcefile, JSON.stringify(datalist)); datalist.splice(index, 1);
clearMyVar('searchMark'); writeFile(sourcefile, JSON.stringify(datalist));
refreshPage(false); clearMyVar('searchMark');
return 'toast://已删除'; refreshPage(false);
return 'toast://已删除';
},sourcefile,data)
} }
}, sourcefile, item), }, sourcefile, item),
desc: '', desc: '',
col_type: "text_1" col_type: "text_1"
}); });
}) })
setResult(d); setResult(d);
} }
function jiekouapi(sourcefile, data) { function jiekouapi(sourcefile, data) {
addListener("onClose", $.toString(() => { addListener("onClose", $.toString(() => {
clearMyVar('jiekoudata');
clearMyVar('jiekouname'); clearMyVar('jiekouname');
clearMyVar('jiekoutype');
clearMyVar('jiekouparse'); clearMyVar('jiekouparse');
clearMyVar('jiekouerparse'); clearMyVar('jiekouerparse');
clearMyVar('jiekouedit'); clearMyVar('jiekouedit');
})); }));
if (data) { if (data) {
storage0.putMyVar('jiekoudata', data);
putMyVar('jiekouedit', '1'); putMyVar('jiekouedit', '1');
putMyVar('jiekouname', data.name); putMyVar('jiekouname', data.name);
putMyVar('jiekoutype', data.type);
storage0.putMyVar('jiekouparse', data.parse); storage0.putMyVar('jiekouparse', data.parse);
storage0.putMyVar('jiekouerparse', data.erparse ? data.erparse : ""); storage0.putMyVar('jiekouerparse', data.erparse ? data.erparse : "");
} }
@ -195,6 +200,16 @@ function jiekouapi(sourcefile, data) {
}) })
} }
}); });
d.push({
title: '接口类型:'+ getMyVar('jiekoutype','漫画'),
col_type: 'text_1',
url: $(runTypes,2,"接口类型").select((cfgfile,Juconfig) => {
Juconfig["runType"] = input;
writeFile(cfgfile, JSON.stringify(Juconfig));
refreshPage(false);
return 'toast://接口类型已设置为:' + input;
}, cfgfile, Juconfig),
});
d.push({ d.push({
title: '主页数据源', title: '主页数据源',
col_type: 'input', col_type: 'input',
@ -204,7 +219,7 @@ function jiekouapi(sourcefile, data) {
titleVisible: false, titleVisible: false,
type: "textarea", type: "textarea",
highlight: true, highlight: true,
height: 5, height: 4,
onChange: $.toString(() => { onChange: $.toString(() => {
if (/{|}/.test(input)) { if (/{|}/.test(input)) {
storage0.putMyVar("jiekouparse", input) storage0.putMyVar("jiekouparse", input)
@ -221,7 +236,7 @@ function jiekouapi(sourcefile, data) {
titleVisible: false, titleVisible: false,
type: "textarea", type: "textarea",
highlight: true, highlight: true,
height: 5, height: 4,
onChange: $.toString(() => { onChange: $.toString(() => {
if (/{|}/.test(input)) { if (/{|}/.test(input)) {
storage0.putMyVar("jiekouerparse", input) storage0.putMyVar("jiekouerparse", input)
@ -290,10 +305,10 @@ function jiekouapi(sourcefile, data) {
} }
if (parse) { newapi['parse'] = parse; } if (parse) { newapi['parse'] = parse; }
if (erparse) { newapi['erparse'] = erparse; } if (erparse) { newapi['erparse'] = erparse; }
let datafile = fetch(sourcefile); let sourcedata = fetch(sourcefile);
if (datafile != "") { if (sourcedata != "") {
try { try {
eval("var datalist=" + datafile + ";"); eval("var datalist=" + sourcedata + ";");
} catch (e) { } catch (e) {
var datalist = []; var datalist = [];
} }

Loading…
Cancel
Save