nodebb-plugin-ezoic-infinite 1.7.6 → 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 +8 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.6",
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.2
2
+ * NodeBB Ezoic Infinite Ads — client.js v21.4
3
3
  *
4
4
  * Historique des corrections majeures
5
5
  * ────────────────────────────────────
@@ -252,12 +252,11 @@
252
252
 
253
253
  function dropWrap(w) {
254
254
  try {
255
- // Unobserve seulement si le placeholder est encore dans le DOM.
256
- // unobserve() sur un nœud détaché corrompt l'IO interne de pubads
257
- // "Failed to execute 'observe': parameter 1 is not of type 'Element'"
258
- // sur tous les observe() suivants.
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).
259
258
  const ph = w.querySelector(`[id^="${PH_PREFIX}"]`);
260
- if (ph instanceof Element && ph.isConnected) S.io?.unobserve(ph);
259
+ if (ph instanceof Element) S.io?.unobserve(ph);
261
260
  const id = parseInt(w.getAttribute(A_WRAPID), 10);
262
261
  if (Number.isFinite(id)) S.mountedIds.delete(id);
263
262
  const key = w.getAttribute(A_ANCHOR);
@@ -389,7 +388,7 @@
389
388
 
390
389
  function observePh(id) {
391
390
  const ph = document.getElementById(`${PH_PREFIX}${id}`);
392
- if (ph instanceof Element && ph.isConnected) try { getIO()?.observe(ph); } catch (_) {}
391
+ if (ph?.isConnected) try { getIO()?.observe(ph); } catch (_) {}
393
392
  }
394
393
 
395
394
  function enqueueShow(id) {
@@ -569,14 +568,6 @@
569
568
  function cleanup() {
570
569
  blockedUntil = ts() + 1500;
571
570
  poolsReady = false;
572
-
573
- // Déconnecter l'IO AVANT les dropWrap pour éviter tout unobserve parasite.
574
- // disconnect() vide la liste interne des cibles observées — les références
575
- // aux placeholders de la page courante sont effacées proprement.
576
- // L'IO sera recréé à ajaxify.end via getIO().
577
- try { S.io?.disconnect(); } catch (_) {}
578
- S.io = null;
579
-
580
571
  mutate(() => document.querySelectorAll(`.${WRAP_CLASS}`).forEach(dropWrap));
581
572
  wrapByKey.clear();
582
573
  S.cfg = null;
@@ -597,6 +588,8 @@
597
588
  if (S.domObs) return;
598
589
  const allSel = [SEL.post, SEL.topic, SEL.category];
599
590
  S.domObs = new MutationObserver(muts => {
591
+ // Ne rien faire pendant la navigation (cleanup posé blockedUntil)
592
+ // ou si c'est nous qui mutons le DOM.
600
593
  if (S.mutGuard > 0 || isBlocked()) return;
601
594
  for (const m of muts) {
602
595
  for (const n of m.addedNodes) {