Merge pull request #845 from Celeter/master

隐藏更新时间栏,转化书源时自动生成
pull/849/head
kunfei 4 years ago committed by GitHub
commit 24305de59d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/src/main/assets/web/index.html
  2. 27
      app/src/main/assets/web/index.js

@ -290,10 +290,10 @@
<textarea rows="1" id="customOrder" class="base" title="customOrder" <textarea rows="1" id="customOrder" class="base" title="customOrder"
placeholder="整数: 0~N (可选,默认0) | 数字越小越靠前"></textarea> placeholder="整数: 0~N (可选,默认0) | 数字越小越靠前"></textarea>
</div> </div>
<div> <div style="display:none;">
<div>更新时间:</div> <div>更新时间:</div>
<textarea rows="1" id="lastUpdateTime" class="base" title="lastUpdateTime" <textarea rows="1" id="lastUpdateTime" class="base" title="lastUpdateTime"
placeholder="整数: 0~N (可选,默认0) | 暂未使用"></textarea> placeholder="毫秒级时间戳 (自动生成) | 请勿手动填写"></textarea>
</div> </div>
</div> </div>
</div> </div>

@ -36,27 +36,22 @@ function Container() {
// 搜索规则 // 搜索规则
$$('.rules .ruleSearch').forEach(item => searchJson[item.title] = ''); $$('.rules .ruleSearch').forEach(item => searchJson[item.title] = '');
//ruleJson.ruleSearch = JSON.stringify(searchJson);
ruleJson.ruleSearch = searchJson; ruleJson.ruleSearch = searchJson;
// 发现规则 // 发现规则
$$('.rules .ruleExplore').forEach(item => exploreJson[item.title] = ''); $$('.rules .ruleExplore').forEach(item => exploreJson[item.title] = '');
//ruleJson.ruleExplore = JSON.stringify(exploreJson);
ruleJson.ruleExplore = exploreJson; ruleJson.ruleExplore = exploreJson;
// 详情页规则 // 详情页规则
$$('.rules .ruleBookInfo').forEach(item => bookInfoJson[item.title] = ''); $$('.rules .ruleBookInfo').forEach(item => bookInfoJson[item.title] = '');
//ruleJson.ruleBookInfo = JSON.stringify(bookInfoJson);
ruleJson.ruleBookInfo = bookInfoJson; ruleJson.ruleBookInfo = bookInfoJson;
// 目录规则 // 目录规则
$$('.rules .ruleToc').forEach(item => tocJson[item.title] = ''); $$('.rules .ruleToc').forEach(item => tocJson[item.title] = '');
//ruleJson.ruleToc = JSON.stringify(tocJson);
ruleJson.ruleToc = tocJson; ruleJson.ruleToc = tocJson;
// 正文规则 // 正文规则
$$('.rules .ruleContent').forEach(item => contentJson[item.title] = ''); $$('.rules .ruleContent').forEach(item => contentJson[item.title] = '');
//ruleJson.ruleContent = JSON.stringify(contentJson);
ruleJson.ruleContent = contentJson; ruleJson.ruleContent = contentJson;
return ruleJson; return ruleJson;
@ -116,55 +111,45 @@ function rule2json() {
// 转换搜索规则 // 转换搜索规则
let searchJson = {}; let searchJson = {};
//Object.keys(JSON.parse(RuleJSON.ruleSearch)).forEach(key => {
Object.keys(RuleJSON.ruleSearch).forEach(key => { Object.keys(RuleJSON.ruleSearch).forEach(key => {
if ($('#' + 'ruleSearch_' + key).value) if ($('#' + 'ruleSearch_' + key).value)
searchJson[key] = $('#' + 'ruleSearch_' + key).value; searchJson[key] = $('#' + 'ruleSearch_' + key).value;
}); });
//RuleJSON.ruleSearch = JSON.stringify(searchJson);
RuleJSON.ruleSearch = searchJson; RuleJSON.ruleSearch = searchJson;
// 转换发现规则 // 转换发现规则
let exploreJson = {}; let exploreJson = {};
//Object.keys(JSON.parse(RuleJSON.ruleExplore)).forEach(key => {
Object.keys(RuleJSON.ruleExplore).forEach(key => { Object.keys(RuleJSON.ruleExplore).forEach(key => {
if ($('#' + 'ruleExplore_' + key).value) if ($('#' + 'ruleExplore_' + key).value)
exploreJson[key] = $('#' + 'ruleExplore_' + key).value; exploreJson[key] = $('#' + 'ruleExplore_' + key).value;
}); });
//RuleJSON.ruleExplore = JSON.stringify(exploreJson);
RuleJSON.ruleExplore = exploreJson; RuleJSON.ruleExplore = exploreJson;
// 转换详情页规则 // 转换详情页规则
let bookInfoJson = {}; let bookInfoJson = {};
//Object.keys(JSON.parse(RuleJSON.ruleBookInfo)).forEach(key => {
Object.keys(RuleJSON.ruleBookInfo).forEach(key => { Object.keys(RuleJSON.ruleBookInfo).forEach(key => {
if ($('#' + 'ruleBookInfo_' + key).value) if ($('#' + 'ruleBookInfo_' + key).value)
bookInfoJson[key] = $('#' + 'ruleBookInfo_' + key).value; bookInfoJson[key] = $('#' + 'ruleBookInfo_' + key).value;
}); });
//RuleJSON.ruleBookInfo = JSON.stringify(bookInfoJson);
RuleJSON.ruleBookInfo = bookInfoJson; RuleJSON.ruleBookInfo = bookInfoJson;
// 转换目录规则 // 转换目录规则
let tocJson = {}; let tocJson = {};
//Object.keys(JSON.parse(RuleJSON.ruleToc)).forEach(key => {
Object.keys(RuleJSON.ruleToc).forEach(key => { Object.keys(RuleJSON.ruleToc).forEach(key => {
if ($('#' + 'ruleToc_' + key).value) if ($('#' + 'ruleToc_' + key).value)
tocJson[key] = $('#' + 'ruleToc_' + key).value; tocJson[key] = $('#' + 'ruleToc_' + key).value;
}); });
//RuleJSON.ruleToc = JSON.stringify(tocJson);
RuleJSON.ruleToc = tocJson; RuleJSON.ruleToc = tocJson;
// 转换正文规则 // 转换正文规则
let contentJson = {}; let contentJson = {};
//Object.keys(JSON.parse(RuleJSON.ruleContent)).forEach(key => {
Object.keys(RuleJSON.ruleContent).forEach(key => { Object.keys(RuleJSON.ruleContent).forEach(key => {
if ($('#' + 'ruleContent_' + key).value) if ($('#' + 'ruleContent_' + key).value)
contentJson[key] = $('#' + 'ruleContent_' + key).value; contentJson[key] = $('#' + 'ruleContent_' + key).value;
}); });
//RuleJSON.ruleContent = JSON.stringify(contentJson);
RuleJSON.ruleContent = contentJson; RuleJSON.ruleContent = contentJson;
RuleJSON.lastUpdateTime = new Date().getTime();//RuleJSON.lastUpdateTime == '' ? 0 : parseInt(RuleJSON.lastUpdateTime); RuleJSON.lastUpdateTime = new Date().getTime();
RuleJSON.customOrder = RuleJSON.customOrder == '' ? 0 : parseInt(RuleJSON.customOrder); RuleJSON.customOrder = RuleJSON.customOrder == '' ? 0 : parseInt(RuleJSON.customOrder);
RuleJSON.weight = RuleJSON.weight == '' ? 0 : parseInt(RuleJSON.weight); RuleJSON.weight = RuleJSON.weight == '' ? 0 : parseInt(RuleJSON.weight);
RuleJSON.bookSourceType == RuleJSON.bookSourceType == '' ? 0 : parseInt(RuleJSON.weight); RuleJSON.bookSourceType == RuleJSON.bookSourceType == '' ? 0 : parseInt(RuleJSON.weight);
@ -193,9 +178,7 @@ function json2rule(RuleEditor) {
// 转换搜索规则 // 转换搜索规则
if (RuleEditor.ruleSearch) { if (RuleEditor.ruleSearch) {
//let searchJson = JSON.parse(RuleEditor.ruleSearch);
let searchJson = RuleEditor.ruleSearch; let searchJson = RuleEditor.ruleSearch;
//Object.keys(JSON.parse(RuleJSON.ruleSearch)).forEach(key => {
Object.keys(RuleJSON.ruleSearch).forEach(key => { Object.keys(RuleJSON.ruleSearch).forEach(key => {
$('#' + 'ruleSearch_' + key).value = searchJson[key] ? searchJson[key] : ''; $('#' + 'ruleSearch_' + key).value = searchJson[key] ? searchJson[key] : '';
}); });
@ -203,8 +186,6 @@ function json2rule(RuleEditor) {
// 转换发现规则 // 转换发现规则
if (RuleEditor.ruleExplore) { if (RuleEditor.ruleExplore) {
//let exploreJson = JSON.parse(RuleEditor.ruleExplore);
//Object.keys(JSON.parse(RuleJSON.ruleExplore)).forEach(key => {
let exploreJson = RuleEditor.ruleExplore; let exploreJson = RuleEditor.ruleExplore;
Object.keys(RuleJSON.ruleExplore).forEach(key => { Object.keys(RuleJSON.ruleExplore).forEach(key => {
$('#' + 'ruleExplore_' + key).value = exploreJson[key] ? exploreJson[key] : ''; $('#' + 'ruleExplore_' + key).value = exploreJson[key] ? exploreJson[key] : '';
@ -213,8 +194,6 @@ function json2rule(RuleEditor) {
// 转换详情页规则 // 转换详情页规则
if (RuleEditor.ruleBookInfo) { if (RuleEditor.ruleBookInfo) {
//let bookInfoJson = JSON.parse(RuleEditor.ruleBookInfo);
//Object.keys(JSON.parse(RuleJSON.ruleBookInfo)).forEach(key => {
let bookInfoJson = RuleEditor.ruleBookInfo; let bookInfoJson = RuleEditor.ruleBookInfo;
Object.keys(RuleJSON.ruleBookInfo).forEach(key => { Object.keys(RuleJSON.ruleBookInfo).forEach(key => {
$('#' + 'ruleBookInfo_' + key).value = bookInfoJson[key] ? bookInfoJson[key] : ''; $('#' + 'ruleBookInfo_' + key).value = bookInfoJson[key] ? bookInfoJson[key] : '';
@ -223,8 +202,6 @@ function json2rule(RuleEditor) {
// 转换目录规则 // 转换目录规则
if (RuleEditor.ruleToc) { if (RuleEditor.ruleToc) {
//let tocJson = JSON.parse(RuleEditor.ruleToc);
//Object.keys(JSON.parse(RuleJSON.ruleToc)).forEach(key => {
let tocJson = RuleEditor.ruleToc; let tocJson = RuleEditor.ruleToc;
Object.keys(RuleJSON.ruleToc).forEach(key => { Object.keys(RuleJSON.ruleToc).forEach(key => {
$('#' + 'ruleToc_' + key).value = tocJson[key] ? tocJson[key] : ''; $('#' + 'ruleToc_' + key).value = tocJson[key] ? tocJson[key] : '';
@ -233,8 +210,6 @@ function json2rule(RuleEditor) {
// 转换正文规则 // 转换正文规则
if (RuleEditor.ruleContent) { if (RuleEditor.ruleContent) {
//let contentJson = JSON.parse(RuleEditor.ruleContent);
//Object.keys(JSON.parse(RuleJSON.ruleContent)).forEach(key => {
let contentJson = RuleEditor.ruleContent; let contentJson = RuleEditor.ruleContent;
Object.keys(RuleJSON.ruleContent).forEach(key => { Object.keys(RuleJSON.ruleContent).forEach(key => {
$('#' + 'ruleContent_' + key).value = contentJson[key] ? contentJson[key] : ''; $('#' + 'ruleContent_' + key).value = contentJson[key] ? contentJson[key] : '';

Loading…
Cancel
Save