nodebb-plugin-ezoic-infinite 1.7.34 → 1.7.36

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 +16 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.34",
3
+ "version": "1.7.36",
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
@@ -32,6 +32,15 @@
32
32
  *
33
33
  * v34 moveDistantWrap — voir v38.
34
34
  *
35
+ * v43 Seuil de recyclage abaissé à -vh (hors viewport visible).
36
+ * recycleAndMove appelle unobserve(ph) avant de déplacer le wrap,
37
+ * ce qui neutralise l'IO sur ce nœud — plus de risque de showAds
38
+ * parasite après recyclage. Plus de wraps éligibles = moins de pool sec.
39
+ *
40
+ * v42 Seuil -(IO_MARGIN + vh) (trop strict, peu de wraps éligibles).
41
+ *
42
+ * v41 Seuil -1vh (trop permissif sur mobile, ignorait IO_MARGIN).
43
+ *
35
44
  * v40 Recyclage slots via destroyPlaceholders+define+displayMore avec délais.
36
45
  * Séquence : destroy → 300ms → define → 300ms → displayMore.
37
46
  * Testé manuellement : fonctionne. displayMore = API Ezoic infinite scroll.
@@ -303,8 +312,10 @@
303
312
  typeof ez?.define !== 'function' ||
304
313
  typeof ez?.displayMore !== 'function') return null;
305
314
 
306
- const vh = window.innerHeight || 800;
307
- const threshold = -vh * 4;
315
+ const vh = window.innerHeight || 800;
316
+ // Seuil : -1vh (hors viewport visible). On appelle unobserve(ph) juste
317
+ // après pour neutraliser l'IO — plus de showAds parasite possible.
318
+ const threshold = -vh;
308
319
  let bestEmpty = null, bestEmptyBottom = Infinity;
309
320
  let bestFilled = null, bestFilledBottom = Infinity;
310
321
 
@@ -326,6 +337,9 @@
326
337
  if (!Number.isFinite(id)) return null;
327
338
 
328
339
  const oldKey = best.getAttribute(A_ANCHOR);
340
+ // Neutraliser l'IO sur ce wrap avant déplacement — évite un showAds
341
+ // parasite si le nœud était encore dans la zone IO_MARGIN.
342
+ try { const ph = best.querySelector(`#${PH_PREFIX}${id}`); if (ph) S.io?.unobserve(ph); } catch (_) {}
329
343
  mutate(() => {
330
344
  best.setAttribute(A_ANCHOR, newKey);
331
345
  best.setAttribute(A_CREATED, String(ts()));