pull/1395/head
gedoor 3 years ago
parent 401d14bb65
commit 287fcf0481
  1. 62
      app/src/main/assets/web/rssSource/index.js

@ -91,59 +91,17 @@ function json2rule(RuleEditor) {
let RuleJSON = Container(); let RuleJSON = Container();
// 转换base // 转换base
Object.keys(RuleJSON).forEach(key => { Object.keys(RuleJSON).forEach(key => {
if (!key.startsWith("rule")) { let val = RuleEditor[key];
let val = RuleEditor[key]; if (typeof val == "number") {
if (typeof val == "number") { $("#" + key).value = val ? String(val) : '0';
$("#" + key).value = val ? String(val) : '0'; }
} else if (typeof val == "boolean") {
else if (typeof val == "boolean") { $("#" + key).value = val ? String(val) : 'false';
$("#" + key).value = val ? String(val) : 'false'; }
} else {
else { $("#" + key).value = val ? String(val) : '';
$("#" + key).value = val ? String(val) : ''; }
}
}
}); });
// 转换搜索规则
if (RuleEditor.ruleSearch) {
let searchJson = RuleEditor.ruleSearch;
Object.keys(RuleJSON.ruleSearch).forEach(key => {
$('#' + 'ruleSearch_' + key).value = searchJson[key] ? searchJson[key] : '';
});
}
// 转换发现规则
if (RuleEditor.ruleExplore) {
let exploreJson = RuleEditor.ruleExplore;
Object.keys(RuleJSON.ruleExplore).forEach(key => {
$('#' + 'ruleExplore_' + key).value = exploreJson[key] ? exploreJson[key] : '';
});
}
// 转换详情页规则
if (RuleEditor.ruleBookInfo) {
let bookInfoJson = RuleEditor.ruleBookInfo;
Object.keys(RuleJSON.ruleBookInfo).forEach(key => {
$('#' + 'ruleBookInfo_' + key).value = bookInfoJson[key] ? bookInfoJson[key] : '';
});
}
// 转换目录规则
if (RuleEditor.ruleToc) {
let tocJson = RuleEditor.ruleToc;
Object.keys(RuleJSON.ruleToc).forEach(key => {
$('#' + 'ruleToc_' + key).value = tocJson[key] ? tocJson[key] : '';
});
}
// 转换正文规则
if (RuleEditor.ruleContent) {
let contentJson = RuleEditor.ruleContent;
Object.keys(RuleJSON.ruleContent).forEach(key => {
$('#' + 'ruleContent_' + key).value = contentJson[key] ? contentJson[key] : '';
});
}
} }
// 记录操作过程 // 记录操作过程
var course = { "old": [], "now": {}, "new": [] }; var course = { "old": [], "now": {}, "new": [] };

Loading…
Cancel
Save