nodebb-plugin-ezoic-infinite 1.8.88 → 1.8.90

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 +4 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.88",
3
+ "version": "1.8.90",
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
@@ -81,7 +81,6 @@
81
81
  kind: null,
82
82
  cfg: null,
83
83
  poolsReady: false,
84
- ezEnabled: false,
85
84
  pools: { topics: [], posts: [], categories: [] },
86
85
  cursors: { topics: 0, posts: 0, categories: 0 },
87
86
  mountedIds: new Set(),
@@ -135,23 +134,6 @@
135
134
  S.poolsReady = true;
136
135
  }
137
136
 
138
- function enableEzoic(cfg) {
139
- if (S.ezEnabled) return;
140
- const ids = [
141
- ...parseIds(cfg.placeholderIds),
142
- ...parseIds(cfg.messagePlaceholderIds),
143
- ...parseIds(cfg.categoryPlaceholderIds),
144
- ];
145
- if (!ids.length) return;
146
- S.ezEnabled = true; // set synchronously to block concurrent calls before the callback runs
147
- window.ezstandalone = window.ezstandalone || {};
148
- const ez = window.ezstandalone;
149
- const doEnable = () => {
150
- try { ez.define(...ids); ez.enable(); } catch (_) {}
151
- };
152
- typeof ez.cmd?.push === 'function' ? ez.cmd.push(doEnable) : doEnable();
153
- }
154
-
155
137
  // ── Page identity ──────────────────────────────────────────────────────────
156
138
 
157
139
  function pageKey() {
@@ -642,7 +624,6 @@
642
624
  const cfg = await fetchConfig();
643
625
  if (!cfg || cfg.excluded) return 0;
644
626
  initPools(cfg);
645
- enableEzoic(cfg);
646
627
 
647
628
  const kind = getKind();
648
629
  if (kind === 'other') return 0;
@@ -722,8 +703,6 @@
722
703
  S.wrapByKey.clear();
723
704
  S.wrapsByClass.clear();
724
705
  S.kind = null;
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.
727
706
  S.inflight = 0;
728
707
  S.pending.clear();
729
708
  S.burstActive = false;
@@ -916,12 +895,14 @@
916
895
  _retries++;
917
896
  patchShowAds();
918
897
 
919
- // Reload sa.min.js only if Ezoic never initialized at all (no loadingStatus).
898
+ // Reload sa.min.js only if Ezoic never initialized at all (no loadingStatus)
899
+ // AND sa.min.js is not already present in the DOM (to avoid duplicates on first load
900
+ // when the script is injected server-side but loadingStatus hasn't been set yet).
920
901
  // Do NOT reload when loadingStatus === 'complete' (post-defineScript-failure):
921
902
  // that would trigger a second defineScript failed error.
922
903
  if (!_scriptReloaded && _retries <= 3) {
923
904
  const ez = window.ezstandalone;
924
- if (!ez?.loadingStatus) {
905
+ if (!ez?.loadingStatus && !document.querySelector('script[src*="sa.min.js"]')) {
925
906
  _scriptReloaded = true;
926
907
  try {
927
908
  const s = document.createElement('script');