nodebb-plugin-ezoic-infinite 1.8.69 → 1.8.71

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 +17 -21
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -135,15 +135,18 @@ const HEAD_PRECONNECTS = [
135
135
  '<link rel="dns-prefetch" href="https://securepubads.g.doubleclick.net">',
136
136
  ].join('\n');
137
137
 
138
- const EZOIC_SCRIPTS = [
139
- '<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>',
140
- '<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
141
- '<script>',
142
- 'window.ezstandalone = window.ezstandalone || {};',
143
- 'ezstandalone.cmd = ezstandalone.cmd || [];',
144
- '</script>',
145
- '<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
146
- ].join('\n');
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>`;
147
150
 
148
151
  // ── Hooks ────────────────────────────────────────────────────────────────────
149
152
 
@@ -168,22 +171,15 @@ plugin.injectEzoicHead = async (data) => {
168
171
  const excluded = await isUserExcluded(uid, settings.excludedGroups);
169
172
 
170
173
  if (excluded) {
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>'
175
- + 'window.ezstandalone=window.ezstandalone||{};'
176
- + 'window.ezstandalone.cmd=window.ezstandalone.cmd||[];'
177
- + '</script>';
178
- data.templateData.customHTML =
179
- stub + '\n' +
180
- serializeInlineConfig(cfg) +
181
- (data.templateData.customHTML || '');
174
+ // v50: did nothing for excluded users. Keep it simple.
182
175
  } else {
183
176
  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).
184
180
  data.templateData.customHTML =
181
+ EZOIC_SCRIPTS +
185
182
  HEAD_PRECONNECTS + '\n' +
186
- EZOIC_SCRIPTS + '\n' +
187
183
  serializeInlineConfig(cfg) +
188
184
  (data.templateData.customHTML || '');
189
185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.69",
3
+ "version": "1.8.71",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",