fix(route): flyert duplicate images & add shanghai bank (#12377)

* fix(route): flyert duplicate images & add shanghai bank

* fix(route): flyert duplicate images & add shanghai bank. optimize code according to the revivew suggestion.

* docs: add Bank of Shanghai slug for creditcard route
This commit is contained in:
mudone 2023-04-24 17:12:47 +08:00 committed by GitHub
parent 44c63006aa
commit c7de199be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 8 deletions

View File

@ -81,6 +81,7 @@ IATA 国际航空运输协会机场代码,参见[维基百科 国际航空运
| 民生银行 | mingsheng |
| 兴业银行 | xingye |
| 花旗银行 | huaqi |
| 上海银行 | shanghai |
| 无卡支付 | wuka |
| 投资理财 | 137 |
| 网站权益汇 | 145 |

View File

@ -54,6 +54,9 @@ module.exports = async (ctx) => {
case 'huaqi':
bankname = '花旗银行';
break;
case 'shanghai':
bankname = '上海银行';
break;
case 'wuka':
bankname = '无卡支付';
break;

View File

@ -16,19 +16,25 @@ async function load(link) {
$('script, style').remove();
$('#loginDialog').remove();
// 获取第一个帖子对象
const firstpost = $('.firstpost');
// 修改图片中的链接
$('ignore_js_op img').each(function () {
const new_src = $('ignore_js_op img').attr('file');
$(this).attr('src', new_src);
firstpost.find('ignore_js_op img').each(function () {
$(this).attr('src', $(this).attr('file'));
// remove useless atrributes
for (const attr of ['id', 'aid', 'zoomfile', 'file', 'zoomfile', 'class', 'onclick', 'title', 'inpost', 'alt', 'onmouseover']) {
$(this).removeAttr(attr);
}
});
// 去除全文中图片的多余标签
const images = $('ignore_js_op img');
$('ignore_js_op').remove();
$("[class*='post_message']").append(images);
const images = firstpost.find('ignore_js_op img');
firstpost.find('ignore_js_op').remove();
firstpost.append(images);
// 提取内容
const description = $("[class*='post_message']").html();
// // 提取内容
const description = firstpost.html();
return { description };
}