nodebb-plugin-ezoic-infinite 1.7.5 → 1.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/client.js +31 -4
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* NodeBB Ezoic Infinite Ads — client.js v21.
|
|
2
|
+
* NodeBB Ezoic Infinite Ads — client.js v21.3
|
|
3
3
|
*
|
|
4
4
|
* Historique des corrections majeures
|
|
5
5
|
* ────────────────────────────────────
|
|
@@ -252,8 +252,10 @@
|
|
|
252
252
|
|
|
253
253
|
function dropWrap(w) {
|
|
254
254
|
try {
|
|
255
|
+
// Unobserve uniquement si le ph est encore connecté — un nœud détaché
|
|
256
|
+
// passé à unobserve() corrompt l'IO interne de pubads.
|
|
255
257
|
const ph = w.querySelector(`[id^="${PH_PREFIX}"]`);
|
|
256
|
-
if (ph instanceof Element) S.io?.unobserve(ph);
|
|
258
|
+
if (ph instanceof Element && ph.isConnected) S.io?.unobserve(ph);
|
|
257
259
|
const id = parseInt(w.getAttribute(A_WRAPID), 10);
|
|
258
260
|
if (Number.isFinite(id)) S.mountedIds.delete(id);
|
|
259
261
|
const key = w.getAttribute(A_ANCHOR);
|
|
@@ -385,7 +387,7 @@
|
|
|
385
387
|
|
|
386
388
|
function observePh(id) {
|
|
387
389
|
const ph = document.getElementById(`${PH_PREFIX}${id}`);
|
|
388
|
-
if (ph
|
|
390
|
+
if (ph instanceof Element && ph.isConnected) try { getIO()?.observe(ph); } catch (_) {}
|
|
389
391
|
}
|
|
390
392
|
|
|
391
393
|
function enqueueShow(id) {
|
|
@@ -565,7 +567,30 @@
|
|
|
565
567
|
function cleanup() {
|
|
566
568
|
blockedUntil = ts() + 1500;
|
|
567
569
|
poolsReady = false;
|
|
568
|
-
|
|
570
|
+
|
|
571
|
+
// Unobserve ciblé sur NOS placeholders avant de les retirer du DOM.
|
|
572
|
+
// On ne fait JAMAIS disconnect() — c'est un IO global partagé avec pubads ;
|
|
573
|
+
// disconnect() corrompt son état interne et provoque des erreurs sur tous
|
|
574
|
+
// les observe() suivants de Google ("parameter 1 is not of type 'Element'").
|
|
575
|
+
if (S.io) {
|
|
576
|
+
for (const id of S.mountedIds) {
|
|
577
|
+
try {
|
|
578
|
+
const ph = document.getElementById(`${PH_PREFIX}${id}`);
|
|
579
|
+
if (ph instanceof Element && ph.isConnected) S.io.unobserve(ph);
|
|
580
|
+
} catch (_) {}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
mutate(() => document.querySelectorAll(`.${WRAP_CLASS}`).forEach(w => {
|
|
585
|
+
try {
|
|
586
|
+
const id = parseInt(w.getAttribute(A_WRAPID), 10);
|
|
587
|
+
if (Number.isFinite(id)) S.mountedIds.delete(id);
|
|
588
|
+
const key = w.getAttribute(A_ANCHOR);
|
|
589
|
+
if (key) wrapByKey.delete(key);
|
|
590
|
+
w.remove();
|
|
591
|
+
} catch (_) {}
|
|
592
|
+
}));
|
|
593
|
+
|
|
569
594
|
wrapByKey.clear();
|
|
570
595
|
S.cfg = null;
|
|
571
596
|
S.pools = { topics: [], posts: [], categories: [] };
|
|
@@ -585,6 +610,8 @@
|
|
|
585
610
|
if (S.domObs) return;
|
|
586
611
|
const allSel = [SEL.post, SEL.topic, SEL.category];
|
|
587
612
|
S.domObs = new MutationObserver(muts => {
|
|
613
|
+
// Ne rien faire pendant la navigation (cleanup posé blockedUntil)
|
|
614
|
+
// ou si c'est nous qui mutons le DOM.
|
|
588
615
|
if (S.mutGuard > 0 || isBlocked()) return;
|
|
589
616
|
for (const m of muts) {
|
|
590
617
|
for (const n of m.addedNodes) {
|