nodebb-plugin-ezoic-infinite 1.8.76 → 1.8.78

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 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.76",
3
+ "version": "1.8.78",
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
@@ -26,13 +26,13 @@
26
26
  EMPTY_CHECK_MS_1: 30_000,
27
27
  EMPTY_CHECK_MS_2: 60_000,
28
28
  MIN_PRUNE_AGE_MS: 8_000,
29
- RECYCLE_MIN_AGE_MS: 12_000,
30
- SHOW_THROTTLE_MS: 900,
29
+ RECYCLE_MIN_AGE_MS: 8_000,
30
+ SHOW_THROTTLE_MS: 500,
31
31
  BURST_COOLDOWN_MS: 200,
32
32
  BLOCK_DURATION_MS: 1_500,
33
33
  SHOW_TIMEOUT_MS: 7_000,
34
34
  SHOW_RELEASE_MS: 700,
35
- RECYCLE_DELAY_MS: 450,
35
+ RECYCLE_DELAY_MS: 300,
36
36
  UNCOLLAPSE_CHECK_MS: [500, 3_000, 10_000],
37
37
  };
38
38
 
@@ -904,11 +904,28 @@
904
904
  // Retry boot: sa.min.js async + Cloudflare Rocket Loader + NodeBB SPA
905
905
  // can cause client.js to boot before DOM/Ezoic are ready.
906
906
  // Retries stop once ads are mounted or after ~10s.
907
+ // If Ezoic defineScript failed (CMP race on first load), reload sa.min.js once.
907
908
  let _retries = 0;
909
+ let _scriptReloaded = false;
908
910
  function retryBoot() {
909
911
  if (_retries >= 12 || S.mountedIds.size > 0) return;
910
912
  _retries++;
911
913
  patchShowAds();
914
+
915
+ // Detect Ezoic failed state and reload sa.min.js once to recover
916
+ if (!_scriptReloaded && _retries <= 3) {
917
+ const ez = window.ezstandalone;
918
+ const status = ez?.loadingStatus;
919
+ if (status && status !== 'LOADED' && status !== 'LOADING') {
920
+ _scriptReloaded = true;
921
+ try {
922
+ const s = document.createElement('script');
923
+ s.src = '//www.ezojs.com/ezoic/sa.min.js';
924
+ document.head.appendChild(s);
925
+ } catch (_) {}
926
+ }
927
+ }
928
+
912
929
  if (!isBlocked() && !S.burstActive) {
913
930
  S.lastBurstTs = now() - TIMING.BURST_COOLDOWN_MS;
914
931
  requestBurst();