nodebb-plugin-ezoic-infinite 1.8.52 → 1.8.54

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 +9 -31
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -135,21 +135,15 @@ const HEAD_PRECONNECTS = [
135
135
  '<link rel="dns-prefetch" href="https://securepubads.g.doubleclick.net">',
136
136
  ].join('\n');
137
137
 
138
- // CRITICAL: The global stubs MUST be the very first <script> block, before
139
- // any Ezoic script (CMP, sa.min.js). sa.min.js is async and can execute as
140
- // soon as it downloads — if it runs before the stub, _ezaq is undefined.
141
- const EZOIC_GLOBALS = [
138
+ const EZOIC_SCRIPTS = [
139
+ '<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
140
+ '<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
142
141
  '<script>',
143
- 'window._ezaq = window._ezaq || {};',
144
142
  'window.ezstandalone = window.ezstandalone || {};',
145
- 'window.ezstandalone.cmd = window.ezstandalone.cmd || [];',
143
+ 'ezstandalone.cmd = ezstandalone.cmd || [];',
146
144
  '</script>',
147
- ].join('\n');
145
+ '<script src="//ezoicanalytics.com/analytics.js"></script>',
148
146
 
149
- const EZOIC_SCRIPTS = [
150
- '<script data-cfasync="false" src="https://cmp.gatekeeperconsent.com/min.js"></script>',
151
- '<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
152
- '<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
153
147
  ].join('\n');
154
148
 
155
149
  // ── Hooks ────────────────────────────────────────────────────────────────────
@@ -173,27 +167,11 @@ plugin.injectEzoicHead = async (data) => {
173
167
  const settings = await getSettings();
174
168
  const uid = data.req?.uid ?? 0;
175
169
  const excluded = await isUserExcluded(uid, settings.excludedGroups);
176
-
177
- if (excluded) {
178
- const cfg = buildClientConfig(settings, true);
179
- // Minimal stub only — no Ezoic scripts loaded for excluded users
180
- data.templateData.customHTML =
181
- EZOIC_GLOBALS + '\n' +
182
- serializeInlineConfig(cfg) +
183
- (data.templateData.customHTML || '');
184
- } else {
185
- const cfg = buildClientConfig(settings, false);
186
- // Order: preconnects → global stubs → CMP scripts → sa.min.js → inline config
187
- data.templateData.customHTML =
188
- HEAD_PRECONNECTS + '\n' +
189
- EZOIC_GLOBALS + '\n' +
190
- EZOIC_SCRIPTS + '\n' +
191
- serializeInlineConfig(cfg) +
192
- (data.templateData.customHTML || '');
170
+ if (!excluded) {
171
+ // Préfixer : nos scripts d'abord, puis le customHTML existant de l'admin
172
+ data.templateData.customHTML = EZOIC_SCRIPTS + (data.templateData.customHTML || '');
193
173
  }
194
- } catch (err) {
195
- console.error('[ezoic-infinite] injectEzoicHead error:', err.message);
196
- }
174
+ } catch (_) {}
197
175
  return data;
198
176
  };
199
177
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.52",
3
+ "version": "1.8.54",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",