From f7de7e44078d01f0006a5b62da25ad45bf0fe832 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Fri, 7 Apr 2023 22:53:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJuSet.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJuSet.js | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/SrcJuSet.js b/SrcJuSet.js index 1ca9911d..235a7e54 100644 --- a/SrcJuSet.js +++ b/SrcJuSet.js @@ -212,9 +212,9 @@ function jiekouapi(sourcefile, data) { }), }); d.push({ - title: '主页数据源', + title: '一级主页数据源', col_type: 'input', - desc: "主页数据源, 可以留空", + desc: "一级主页数据源, 可以留空", extra: { defaultValue: storage0.getMyVar('jiekouparse') || "", titleVisible: false, @@ -222,16 +222,16 @@ function jiekouapi(sourcefile, data) { highlight: true, height: 4, onChange: $.toString(() => { - if (/{|}/.test(input)) { + if (/{|}/.test(input) || !input) { storage0.putMyVar("jiekouparse", input) } }) } }); d.push({ - title: '搜索数据源', + title: '二级搜索数据源', col_type: 'input', - desc: "搜索数据源, 可以留空", + desc: "二级搜索数据源, 可以留空", extra: { defaultValue: storage0.getMyVar('jiekouerparse') || "", titleVisible: false, @@ -239,7 +239,7 @@ function jiekouapi(sourcefile, data) { highlight: true, height: 4, onChange: $.toString(() => { - if (/{|}/.test(input)) { + if (/{|}/.test(input) || !input) { storage0.putMyVar("jiekouerparse", input) } }) @@ -308,8 +308,24 @@ function jiekouapi(sourcefile, data) { name: name, type: type } - if (parse) { newapi['parse'] = parse; } - if (erparse) { newapi['erparse'] = erparse; } + if (parse) { + 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); if (sourcedata != "") { try { @@ -320,9 +336,7 @@ function jiekouapi(sourcefile, data) { } else { var datalist = []; } - log(newapi); let index = datalist.indexOf(datalist.filter(d => d.name==name && (d.type==type||!d.type))[0]); - log(index); if (index > -1 && getMyVar('jiekouedit') != "1") { return "toast://已存在-" + name; } else {