nodebb-plugin-ezoic-infinite 1.7.56 → 1.7.58

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 +10 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.56",
3
+ "version": "1.7.58",
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 v61
2
+ * NodeBB Ezoic Infinite Ads — client.js v62
3
3
  *
4
4
  * Historique
5
5
  * ──────────
@@ -18,6 +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
+ * v62 is-empty réintroduit : collapse 60s après insertion du wrap (pas après
22
+ * showAds) si isFilled est toujours false. Évite les trous permanents.
21
23
  * v61 recycleAndMove : ne pas recycler un wrap rempli depuis moins de 30s.
22
24
  * Empêche qu'une pub qui vient de charger soit déplacée immédiatement.
23
25
  * v59 CSS : min-height 90px sur ezoic-ad-between (anti-CLS AMP ads).
@@ -39,7 +41,6 @@
39
41
  const A_WRAPID = 'data-ezoic-wrapid'; // id Ezoic
40
42
 
41
43
  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)
43
44
  const MAX_INSERTS_RUN = 6; // insertions max par appel runCore
44
45
  const MAX_INFLIGHT = 4; // showAds() simultanés max
45
46
  const SHOW_THROTTLE_MS = 900; // anti-spam showAds() par id
@@ -256,7 +257,7 @@
256
257
  typeof ez?.define !== 'function' ||
257
258
  typeof ez?.displayMore !== 'function') return null;
258
259
 
259
- const threshold = -(window.innerHeight || 800);
260
+ const threshold = -3 * (window.innerHeight || 800);
260
261
  let bestEmpty = null, bestEmptyBottom = Infinity;
261
262
  let bestFilled = null, bestFilledBottom = Infinity;
262
263
 
@@ -277,11 +278,6 @@
277
278
  const id = parseInt(best.getAttribute(A_WRAPID), 10);
278
279
  if (!Number.isFinite(id)) return null;
279
280
  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
- }
285
281
  S.recycling.add(id);
286
282
 
287
283
  const oldKey = best.getAttribute(A_ANCHOR);
@@ -331,6 +327,7 @@
331
327
  mutate(() => el.insertAdjacentElement('afterend', w));
332
328
  S.mountedIds.add(id);
333
329
  S.wrapByKey.set(key, w);
330
+ scheduleEmptyCheck(id);
334
331
  return w;
335
332
  }
336
333
 
@@ -422,15 +419,14 @@
422
419
  startShow(id);
423
420
  }
424
421
 
425
- function scheduleEmptyCheck(id, showTs) {
422
+ function scheduleEmptyCheck(id) {
426
423
  setTimeout(() => {
427
424
  try {
428
425
  const ph = document.getElementById(`${PH_PREFIX}${id}`);
429
426
  const wrap = ph?.closest?.(`.${WRAP_CLASS}`);
430
427
  if (!wrap || !ph?.isConnected) return;
431
- // Ne pas écraser un showAds plus récent
432
- if ((S.lastShow.get(id) ?? 0) > showTs) return;
433
- wrap.classList.toggle('is-empty', !isFilled(ph));
428
+ // Collapse uniquement si vraiment vide après 60s
429
+ if (!isFilled(wrap)) wrap.classList.add('is-empty');
434
430
  } catch (_) {}
435
431
  }, EMPTY_CHECK_MS);
436
432
  }
@@ -464,12 +460,12 @@
464
460
  if (t - (S.lastShow.get(id) ?? 0) < SHOW_THROTTLE_MS) { clearTimeout(timer); return release(); }
465
461
  S.lastShow.set(id, t);
466
462
  // 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 (_) {}
463
+ // Si la pub charge après is-empty, retirer le collapse
464
+ try { document.getElementById(`${PH_PREFIX}${id}`)?.closest?.(`.${WRAP_CLASS}`)?.classList.remove('is-empty'); } catch (_) {}
468
465
  window.ezstandalone = window.ezstandalone || {};
469
466
  const ez = window.ezstandalone;
470
467
  const doShow = () => {
471
468
  try { ez.showAds(id); } catch (_) {}
472
- scheduleEmptyCheck(id, t);
473
469
  setTimeout(() => { clearTimeout(timer); release(); }, 700);
474
470
  };
475
471
  Array.isArray(ez.cmd) ? ez.cmd.push(doShow) : doShow();