nodebb-plugin-ezoic-infinite 1.5.1 → 1.5.2

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 +9 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
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
@@ -9,13 +9,11 @@
9
9
 
10
10
  (function () {
11
11
 
12
- // --- Safety stubs: prevent crashes if Ezoic scripts execute when ads are disabled/excluded ---
12
+ // --- Safety stubs: prevent `_ezaq` crashes even when ads are disabled/excluded ---
13
+ // IMPORTANT: do NOT create a fake `showAds` function, it can confuse Ezoic's loader.
13
14
  window._ezaq = window._ezaq || [];
14
15
  window.ezstandalone = window.ezstandalone || {};
15
16
  window.ezstandalone.cmd = window.ezstandalone.cmd || [];
16
- if (typeof window.ezstandalone.showAds !== 'function') {
17
- window.ezstandalone.showAds = function () {};
18
- }
19
17
 
20
18
  const CFG_URL = '/api/plugins/ezoic-infinite/config';
21
19
 
@@ -99,18 +97,13 @@ if (typeof window.ezstandalone.showAds !== 'function') {
99
97
  Pool.ensurePlaceholder(id);
100
98
 
101
99
  const el = document.getElementById(id);
102
- if (!el || !document.body.contains(el)) continue;
103
-
104
- // If the placeholder is still in the hidden pool, DO NOT render into it (would be invisible).
105
- // We only render when the placeholder has been moved into a visible wrapper.
106
- const pool = Pool.ensurePool();
107
- if (pool && pool.contains(el)) continue;
108
-
109
- try {
110
- // Call one-by-one to avoid batch logging on missing nodes
111
- original.call(window.ezstandalone, id);
112
- } catch (e) {
113
- // swallow: Ezoic can throw if called during transitions
100
+ if (el && document.body.contains(el)) {
101
+ try {
102
+ // Call one-by-one to avoid batch logging on missing nodes
103
+ original.call(window.ezstandalone, id);
104
+ } catch (e) {
105
+ // swallow: Ezoic can throw if called during transitions
106
+ }
114
107
  }
115
108
  }
116
109
  };