nodebb-plugin-ezoic-infinite 1.8.86 → 1.8.88

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 +17 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.86",
3
+ "version": "1.8.88",
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
@@ -143,10 +143,11 @@
143
143
  ...parseIds(cfg.categoryPlaceholderIds),
144
144
  ];
145
145
  if (!ids.length) return;
146
+ S.ezEnabled = true; // set synchronously to block concurrent calls before the callback runs
146
147
  window.ezstandalone = window.ezstandalone || {};
147
148
  const ez = window.ezstandalone;
148
149
  const doEnable = () => {
149
- try { ez.define(...ids); ez.enable(); S.ezEnabled = true; } catch (_) {}
150
+ try { ez.define(...ids); ez.enable(); } catch (_) {}
150
151
  };
151
152
  typeof ez.cmd?.push === 'function' ? ez.cmd.push(doEnable) : doEnable();
152
153
  }
@@ -562,6 +563,14 @@
562
563
  window.ezstandalone = window.ezstandalone || {};
563
564
  const ez = window.ezstandalone;
564
565
  const doShow = () => {
566
+ const status = ez.loadingStatus;
567
+ if (status && status !== 'complete') {
568
+ // Ezoic not ready yet — release slot and let next burst retry
569
+ clearTimeout(timer);
570
+ release();
571
+ setTimeout(() => { if (!isBlocked()) enqueueShow(id); }, 800);
572
+ return;
573
+ }
565
574
  try { ez.showAds(id); } catch (_) {}
566
575
  if (wrap) scheduleUncollapseChecks(wrap, id);
567
576
  scheduleEmptyCheck(id, t);
@@ -713,7 +722,8 @@
713
722
  S.wrapByKey.clear();
714
723
  S.wrapsByClass.clear();
715
724
  S.kind = null;
716
- S.ezEnabled = false;
725
+ // S.ezEnabled intentionally NOT reset: ez.define()+ez.enable() must be called
726
+ // only once per full page load, not on every SPA navigation.
717
727
  S.inflight = 0;
718
728
  S.pending.clear();
719
729
  S.burstActive = false;
@@ -889,7 +899,11 @@
889
899
  bindNodeBB();
890
900
  bindScroll();
891
901
  S.blockedUntil = 0;
892
- requestBurst();
902
+ if (document.readyState === 'complete') {
903
+ requestBurst();
904
+ } else {
905
+ window.addEventListener('load', requestBurst, { once: true });
906
+ }
893
907
 
894
908
  // Retry boot: sa.min.js async + Cloudflare Rocket Loader + NodeBB SPA
895
909
  // can cause client.js to boot before DOM/Ezoic are ready.