From 868f69f5403bf549bca53a862531c46c63b23ebf Mon Sep 17 00:00:00 2001 From: xing Date: Sun, 29 Mar 2020 18:05:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8Cfi?= =?UTF-8?q?x=20a=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tieba page.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tieba page.js b/tieba page.js index 5da38a4..b620390 100644 --- a/tieba page.js +++ b/tieba page.js @@ -422,6 +422,15 @@ }; observer.observe(targetNode, observerOptions); + (new MutationObserver(m => { + if (m[0].addedNodes.length > 0) { + let n = m[0].addedNodes[0]; + n.parentNode.removeChild(n); + } + + })).observe(document.querySelector('#po_list'), { + childList: true, + }); } @@ -455,6 +464,7 @@ let MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; let observer = new MutationObserver((mutations) => { if (mutations.length > 0) { + console.log(mutations) t(); } }); @@ -479,18 +489,6 @@ ev.preventDefault(); } } - if (ev.target.classList.contains('j_postor_blue_kit_btn_return') || ev.target.classList.contains('j_submit_btn') || ev.target.classList.contains('close-btn')) { - let pages = document.querySelectorAll('#list_pager'); - if (pages.length > 1) { - let count = pages.length; - pages.forEach(el => { - if (count !== 1) { - --count; - el.parentNode.removeChild(el); - } - }) - } - } if (ev.target.tagName === 'svg') { ev.stopPropagation(); @@ -516,8 +514,7 @@ if (ev.target.classList.contains('j_new_header_reply')) { F.use('spb/widget/normal_post_list', function (threadList) { - let x = new threadList(window.conxx); - x.floorReply(ev); + window.xxLL.floorReply(ev); }); } @@ -619,14 +616,17 @@ let conf = (new Function("return " + con))(); window.conxx = conf; + window.xxLL = null; document.querySelectorAll('.j_nreply_btn').forEach(value => { value.addEventListener('click', evt => { evt.preventDefault(); evt.stopPropagation(); F.use('spb/widget/normal_post_list', function (threadList) { - let x = new threadList(conf); - x.floorReply(evt); + if (!window.xxLL) { + window.xxLL = new threadList(conf) + } + window.xxLL.floorReply(evt); }); })