nodebb-plugin-ezoic-infinite 1.7.55 → 1.7.56

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 +12 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.55",
3
+ "version": "1.7.56",
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 v60
2
+ * NodeBB Ezoic Infinite Ads — client.js v61
3
3
  *
4
4
  * Historique
5
5
  * ──────────
@@ -18,7 +18,8 @@
18
18
  * v53 S.recycling garde double-recyclage. pickId early-exit. cleanup complet.
19
19
  * v54 ensureTcfLocator rappelé à chaque ajaxify.end.
20
20
  * v56 scheduleEmptyCheck / is-empty supprimés (collapse prématuré).
21
- * v60 is-empty réintroduit avec délai 60s et collapse à 0px (ligne visible).
21
+ * v61 recycleAndMove : ne pas recycler un wrap rempli depuis moins de 30s.
22
+ * Empêche qu'une pub qui vient de charger soit déplacée immédiatement.
22
23
  * v59 CSS : min-height 90px sur ezoic-ad-between (anti-CLS AMP ads).
23
24
  * v58 tcfObs survit aux navigations : ne plus déconnecter dans cleanup().
24
25
  * L'iframe __tcfapiLocator doit exister en permanence pour le CMP —
@@ -37,7 +38,8 @@
37
38
  const A_ANCHOR = 'data-ezoic-anchor'; // "kindClass:stableId"
38
39
  const A_WRAPID = 'data-ezoic-wrapid'; // id Ezoic
39
40
 
40
- const EMPTY_CHECK_MS = 60_000; // délai avant collapse wrap vide (60s — laisser le temps au CMP/enchères)
41
+ const EMPTY_CHECK_MS = 60_000;
42
+ const RECYCLE_MIN_AGE_MS = 30_000; // délai minimal avant recyclage d'un wrap rempli // délai avant collapse wrap vide (60s — laisser le temps au CMP/enchères)
41
43
  const MAX_INSERTS_RUN = 6; // insertions max par appel runCore
42
44
  const MAX_INFLIGHT = 4; // showAds() simultanés max
43
45
  const SHOW_THROTTLE_MS = 900; // anti-spam showAds() par id
@@ -275,6 +277,11 @@
275
277
  const id = parseInt(best.getAttribute(A_WRAPID), 10);
276
278
  if (!Number.isFinite(id)) return null;
277
279
  if (S.recycling.has(id)) return null;
280
+ // Ne pas recycler un wrap rempli depuis moins de RECYCLE_MIN_AGE_MS
281
+ if (best === bestFilled) {
282
+ const filledAt = parseInt(best.getAttribute('data-ezoic-filled') || '0', 10);
283
+ if (ts() - filledAt < RECYCLE_MIN_AGE_MS) return null;
284
+ }
278
285
  S.recycling.add(id);
279
286
 
280
287
  const oldKey = best.getAttribute(A_ANCHOR);
@@ -456,6 +463,8 @@
456
463
  const t = ts();
457
464
  if (t - (S.lastShow.get(id) ?? 0) < SHOW_THROTTLE_MS) { clearTimeout(timer); return release(); }
458
465
  S.lastShow.set(id, t);
466
+ // Marquer le wrap avec le timestamp de fill pour bloquer le recyclage
467
+ try { const w = document.getElementById(`${PH_PREFIX}${id}`)?.closest?.(`.${WRAP_CLASS}`); if (w) w.setAttribute('data-ezoic-filled', String(t)); } catch (_) {}
459
468
  window.ezstandalone = window.ezstandalone || {};
460
469
  const ez = window.ezstandalone;
461
470
  const doShow = () => {