From 0937e94707292814bc8fc20796d0cce43e8b823d Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 6 Jan 2025 18:18:36 +0800 Subject: [PATCH] :art: Improve clipping articles of WeChat media platform https://github.com/siyuan-note/siyuan/issues/13733 --- lib/Readability.js | 18 ++++++++++-------- manifest.json | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/Readability.js b/lib/Readability.js index f854805..4124607 100644 --- a/lib/Readability.js +++ b/lib/Readability.js @@ -2125,19 +2125,22 @@ Readability.prototype = { }, _cleanWeixinMp: function (e) { + // 改进微信公众号文章剪藏 Improve clipping articles of WeChat media platform https://github.com/siyuan-note/siyuan/issues/13733 if (0 > this._doc.baseURI.indexOf("mp.weixin.qq.com")) { return; } - var mp_profile_iframe_wrp = e.querySelector(".mp_profile_iframe_wrp"); - if (!mp_profile_iframe_wrp) { - return; - } - var unlinks = []; - for (var n = mp_profile_iframe_wrp; n; n = n.nextSibling) { - unlinks.push(n); + var mp_profile_iframe_wrp = e.querySelector(".mp_profile_iframe_wrp"); + if (mp_profile_iframe_wrp) { + unlinks.push(mp_profile_iframe_wrp); + if (mp_profile_iframe_wrp.previousElementSibling) { + for (var n = mp_profile_iframe_wrp; n; n = n.nextSibling) { + unlinks.push(n); + } + } } + var content_bottom_area = e.querySelector("#content_bottom_area"); if (content_bottom_area) { for (var n = content_bottom_area; n; n = n.nextSibling) { @@ -2145,7 +2148,6 @@ Readability.prototype = { } } - for (var i = 0; i < unlinks.length; i++) { unlinks[i].remove(); } diff --git a/manifest.json b/manifest.json index 8177579..d101418 100644 --- a/manifest.json +++ b/manifest.json @@ -38,5 +38,5 @@ "name": "__MSG_extension_name__", "options_page": "options.html", "description": "__MSG_extension_description__", - "version": "1.8.2" + "version": "1.8.3" }