nodebb-plugin-ezoic-infinite 1.7.7 → 1.7.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/client.js +7 -29
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.7",
3
+ "version": "1.7.8",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * NodeBB Ezoic Infinite Ads — client.js v21.3
2
+ * NodeBB Ezoic Infinite Ads — client.js v21.4
3
3
  *
4
4
  * Historique des corrections majeures
5
5
  * ────────────────────────────────────
@@ -252,10 +252,11 @@
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
+ // Unobserve AVANT w.remove() le placeholder est encore dans le DOM
256
+ // à ce stade, ce qui est requis par l'IO. Guard instanceof uniquement
257
+ // (même logique que v20.3 qui fonctionnait).
257
258
  const ph = w.querySelector(`[id^="${PH_PREFIX}"]`);
258
- if (ph instanceof Element && ph.isConnected) S.io?.unobserve(ph);
259
+ if (ph instanceof Element) S.io?.unobserve(ph);
259
260
  const id = parseInt(w.getAttribute(A_WRAPID), 10);
260
261
  if (Number.isFinite(id)) S.mountedIds.delete(id);
261
262
  const key = w.getAttribute(A_ANCHOR);
@@ -387,7 +388,7 @@
387
388
 
388
389
  function observePh(id) {
389
390
  const ph = document.getElementById(`${PH_PREFIX}${id}`);
390
- if (ph instanceof Element && ph.isConnected) try { getIO()?.observe(ph); } catch (_) {}
391
+ if (ph?.isConnected) try { getIO()?.observe(ph); } catch (_) {}
391
392
  }
392
393
 
393
394
  function enqueueShow(id) {
@@ -567,30 +568,7 @@
567
568
  function cleanup() {
568
569
  blockedUntil = ts() + 1500;
569
570
  poolsReady = false;
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
-
571
+ mutate(() => document.querySelectorAll(`.${WRAP_CLASS}`).forEach(dropWrap));
594
572
  wrapByKey.clear();
595
573
  S.cfg = null;
596
574
  S.pools = { topics: [], posts: [], categories: [] };