nodebb-plugin-ezoic-infinite 1.7.62 → 1.7.64

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 +20 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.62",
3
+ "version": "1.7.64",
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
@@ -138,6 +138,14 @@
138
138
  S.pools.posts = parseIds(cfg.messagePlaceholderIds);
139
139
  S.pools.categories = parseIds(cfg.categoryPlaceholderIds);
140
140
  S.poolsReady = true;
141
+ // Déclarer tous les ids du pool une seule fois — Ezoic les enregistre en interne
142
+ const allIds = [...S.pools.topics, ...S.pools.posts, ...S.pools.categories];
143
+ if (allIds.length) {
144
+ window.ezstandalone = window.ezstandalone || {};
145
+ const ez = window.ezstandalone;
146
+ const doDef = () => { try { ez.define(allIds); } catch (_) {} };
147
+ typeof ez.cmd?.push === 'function' ? ez.cmd.push(doDef) : doDef();
148
+ }
141
149
  }
142
150
 
143
151
  // ── Page identity ──────────────────────────────────────────────────────────
@@ -403,15 +411,8 @@
403
411
  window.ezstandalone = window.ezstandalone || {};
404
412
  const ez = window.ezstandalone;
405
413
  const doShow = () => {
406
- // define + displayMore remettent le slot en état actif si Ezoic l'a oublié
407
- try { ez.define([id]); } catch (_) {}
408
- setTimeout(() => {
409
- try { ez.displayMore([id]); } catch (_) {}
410
- setTimeout(() => {
411
- try { ez.showAds(id); } catch (_) {}
412
- setTimeout(() => { clearTimeout(timer); release(); }, 700);
413
- }, 200);
414
- }, 200);
414
+ try { ez.showAds(id); } catch (_) {}
415
+ setTimeout(() => { clearTimeout(timer); release(); }, 700);
415
416
  };
416
417
  Array.isArray(ez.cmd) ? ez.cmd.push(doShow) : doShow();
417
418
  } catch (_) { clearTimeout(timer); release(); }
@@ -627,6 +628,8 @@
627
628
  S.pageKey = pageKey();
628
629
  blockedUntil = 0;
629
630
  muteConsole(); ensureTcfLocator();
631
+ // Signaler à Ezoic le changement de page SPA
632
+ try { const ez = window.ezstandalone; if (ez?.newPage) { const f = () => { try { ez.newPage(); } catch(_){} }; typeof ez.cmd?.push==='function' ? ez.cmd.push(f) : f(); } } catch(_){}
630
633
  patchShowAds(); getIO(); ensureDomObserver(); requestBurst();
631
634
  });
632
635
  const burstEvts = [
@@ -665,6 +668,14 @@
665
668
  muteConsole();
666
669
  ensureTcfLocator();
667
670
  warmNetwork();
671
+ // Signaler à Ezoic qu'on est une SPA — sans ça il gère les slots comme
672
+ // une page statique et vide les pubs lors de son cycle interne.
673
+ try {
674
+ window.ezstandalone = window.ezstandalone || {};
675
+ const ez = window.ezstandalone;
676
+ const doSpa = () => { try { ez.setIsSinglePageApplication?.(true); } catch (_) {} };
677
+ typeof ez.cmd?.push === 'function' ? ez.cmd.push(doSpa) : doSpa();
678
+ } catch (_) {}
668
679
  patchShowAds();
669
680
  getIO();
670
681
  ensureDomObserver();