备份现场结果补录、图片修复与跳过文章功能
This commit is contained in:
1 parent
1e6504b4a2
commit
d157c179c8
20 files changed
+597
-47
No files matched your search
@@ -179,12 +179,12 @@ window.DWW11Formatter = Object.freeze({
|
||||
const footer = existingSource(body);
|
||||
const expected = `来源:${expectedSource},如有侵权,请联系删除。`;
|
||||
if (!footer || footer.text !== expected) throw new Error('文末来源与文章包不一致,请人工检查');
|
||||
const images = [...body.querySelectorAll('img')].map(x => x.id + ':' + x.getAttribute('src'));
|
||||
const images = [...body.querySelectorAll('img')].map(x => [x.id, x.getAttribute('aid'), x.getAttribute('src')].join(':'));
|
||||
const backup = body.innerHTML;
|
||||
try {
|
||||
footer.remove();
|
||||
formatBody(body, expectedSource, expected);
|
||||
const after = [...body.querySelectorAll('img')].map(x => x.id + ':' + x.getAttribute('src'));
|
||||
const after = [...body.querySelectorAll('img')].map(x => [x.id, x.getAttribute('aid'), x.getAttribute('src')].join(':'));
|
||||
if (JSON.stringify(images) !== JSON.stringify(after)) throw new Error('排版后图片标识或顺序改变');
|
||||
if (body.querySelectorAll('[data-dww11-wx-source="1"]').length !== 1) throw new Error('来源尾注数量异常');
|
||||
body.dispatchEvent(new Event('input', {bubbles:true}));
|
||||
|
||||
Reference in new issue
Block a user