nodebb-plugin-ezoic-infinite 1.8.71 → 1.8.72

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/library.js +22 -17
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -135,18 +135,15 @@ const HEAD_PRECONNECTS = [
135
135
  '<link rel="dns-prefetch" href="https://securepubads.g.doubleclick.net">',
136
136
  ].join('\n');
137
137
 
138
- // Exact v50 script block DO NOT change order or attributes.
139
- // The inline stub AFTER sa.min.js is required: client.js uses ezstandalone.cmd
140
- // before sa.min.js may have initialized it. _ezaq is NOT stubbed — sa.min.js
141
- // defines it itself and pre-defining it can change Ezoic's init path.
142
- const EZOIC_SCRIPTS = `<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>
143
- <script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>
144
- <script async src="//www.ezojs.com/ezoic/sa.min.js"></script>
145
- <script src="//ezoicanalytics.com/analytics.js"></script>
146
- <script>
147
- window.ezstandalone = window.ezstandalone || {};
148
- ezstandalone.cmd = ezstandalone.cmd || [];
149
- </script>`;
138
+ // Match v50 exactly: CMP sa.min.js, no stubs.
139
+ // sa.min.js defines _ezaq and ezstandalone itself.
140
+ // Placing stubs before or alongside sa.min.js changes Ezoic's init path
141
+ // and causes "Timed out waiting for loadingStatus" errors.
142
+ const EZOIC_SCRIPTS = [
143
+ '<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>',
144
+ '<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
145
+ '<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
146
+ ].join('\n');
150
147
 
151
148
  // ── Hooks ────────────────────────────────────────────────────────────────────
152
149
 
@@ -171,15 +168,23 @@ plugin.injectEzoicHead = async (data) => {
171
168
  const excluded = await isUserExcluded(uid, settings.excludedGroups);
172
169
 
173
170
  if (excluded) {
174
- // v50: did nothing for excluded users. Keep it simple.
171
+ const cfg = buildClientConfig(settings, true);
172
+ // Minimal stub for excluded users — prevents ReferenceError if other
173
+ // scripts reference _ezaq or ezstandalone
174
+ const stub = '<script data-cfasync="false">'
175
+ + 'window._ezaq=window._ezaq||{};'
176
+ + 'window.ezstandalone=window.ezstandalone||{};'
177
+ + 'window.ezstandalone.cmd=window.ezstandalone.cmd||[];'
178
+ + '</script>';
179
+ data.templateData.customHTML =
180
+ stub + '\n' +
181
+ serializeInlineConfig(cfg) +
182
+ (data.templateData.customHTML || '');
175
183
  } else {
176
184
  const cfg = buildClientConfig(settings, false);
177
- // v50 order: EZOIC_SCRIPTS first, then existing customHTML.
178
- // Preconnects added after scripts (link tags don't block parsing).
179
- // Inline config after everything (optimization: avoids API fetch).
180
185
  data.templateData.customHTML =
181
- EZOIC_SCRIPTS +
182
186
  HEAD_PRECONNECTS + '\n' +
187
+ EZOIC_SCRIPTS + '\n' +
183
188
  serializeInlineConfig(cfg) +
184
189
  (data.templateData.customHTML || '');
185
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.71",
3
+ "version": "1.8.72",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",