更新 'SrcJuSet.js'

Ju
src48597962 2 years ago
parent 738741ca3b
commit f7de7e4407
  1. 34
      SrcJuSet.js

@ -212,9 +212,9 @@ function jiekouapi(sourcefile, data) {
}), }),
}); });
d.push({ d.push({
title: '主页数据源', title: '一级主页数据源',
col_type: 'input', col_type: 'input',
desc: "主页数据源, 可以留空", desc: "一级主页数据源, 可以留空",
extra: { extra: {
defaultValue: storage0.getMyVar('jiekouparse') || "", defaultValue: storage0.getMyVar('jiekouparse') || "",
titleVisible: false, titleVisible: false,
@ -222,16 +222,16 @@ function jiekouapi(sourcefile, data) {
highlight: true, highlight: true,
height: 4, height: 4,
onChange: $.toString(() => { onChange: $.toString(() => {
if (/{|}/.test(input)) { if (/{|}/.test(input) || !input) {
storage0.putMyVar("jiekouparse", input) storage0.putMyVar("jiekouparse", input)
} }
}) })
} }
}); });
d.push({ d.push({
title: '搜索数据源', title: '二级搜索数据源',
col_type: 'input', col_type: 'input',
desc: "搜索数据源, 可以留空", desc: "二级搜索数据源, 可以留空",
extra: { extra: {
defaultValue: storage0.getMyVar('jiekouerparse') || "", defaultValue: storage0.getMyVar('jiekouerparse') || "",
titleVisible: false, titleVisible: false,
@ -239,7 +239,7 @@ function jiekouapi(sourcefile, data) {
highlight: true, highlight: true,
height: 4, height: 4,
onChange: $.toString(() => { onChange: $.toString(() => {
if (/{|}/.test(input)) { if (/{|}/.test(input) || !input) {
storage0.putMyVar("jiekouerparse", input) storage0.putMyVar("jiekouerparse", input)
} }
}) })
@ -308,8 +308,24 @@ function jiekouapi(sourcefile, data) {
name: name, name: name,
type: type type: type
} }
if (parse) { newapi['parse'] = parse; } if (parse) {
if (erparse) { newapi['erparse'] = erparse; } try{
eval("let yparse = " + parse);
}catch(e){
log(e.message);
return "toast://一级主页源有错误,看日志"
}
newapi['parse'] = parse;
}
if (erparse) {
try{
eval("let eparse = " + erparse);
}catch(e){
log(e.message);
return "toast://二级搜索源有错误,看日志"
}
newapi['erparse'] = erparse;
}
let sourcedata = fetch(sourcefile); let sourcedata = fetch(sourcefile);
if (sourcedata != "") { if (sourcedata != "") {
try { try {
@ -320,9 +336,7 @@ function jiekouapi(sourcefile, data) {
} else { } else {
var datalist = []; var datalist = [];
} }
log(newapi);
let index = datalist.indexOf(datalist.filter(d => d.name==name && (d.type==type||!d.type))[0]); let index = datalist.indexOf(datalist.filter(d => d.name==name && (d.type==type||!d.type))[0]);
log(index);
if (index > -1 && getMyVar('jiekouedit') != "1") { if (index > -1 && getMyVar('jiekouedit') != "1") {
return "toast://已存在-" + name; return "toast://已存在-" + name;
} else { } else {

Loading…
Cancel
Save