nodebb-plugin-ezoic-infinite 1.8.71 → 1.8.73
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.
- package/library.js +23 -17
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -135,18 +135,16 @@ const HEAD_PRECONNECTS = [
|
|
|
135
135
|
'<link rel="dns-prefetch" href="https://securepubads.g.doubleclick.net">',
|
|
136
136
|
].join('\n');
|
|
137
137
|
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
// before sa.min.js
|
|
141
|
-
//
|
|
142
|
-
const EZOIC_SCRIPTS =
|
|
143
|
-
<script data-cfasync="false" src="https://
|
|
144
|
-
<script
|
|
145
|
-
<script src="//
|
|
146
|
-
<script>
|
|
147
|
-
|
|
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 src="//www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
146
|
+
'<script src="//ezoicanalytics.com/analytics.js"></script>',
|
|
147
|
+
].join('\n');
|
|
150
148
|
|
|
151
149
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
|
152
150
|
|
|
@@ -171,15 +169,23 @@ plugin.injectEzoicHead = async (data) => {
|
|
|
171
169
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
|
172
170
|
|
|
173
171
|
if (excluded) {
|
|
174
|
-
|
|
172
|
+
const cfg = buildClientConfig(settings, true);
|
|
173
|
+
// Minimal stub for excluded users — prevents ReferenceError if other
|
|
174
|
+
// scripts reference _ezaq or ezstandalone
|
|
175
|
+
const stub = '<script data-cfasync="false">'
|
|
176
|
+
+ 'window._ezaq=window._ezaq||{};'
|
|
177
|
+
+ 'window.ezstandalone=window.ezstandalone||{};'
|
|
178
|
+
+ 'window.ezstandalone.cmd=window.ezstandalone.cmd||[];'
|
|
179
|
+
+ '</script>';
|
|
180
|
+
data.templateData.customHTML =
|
|
181
|
+
stub + '\n' +
|
|
182
|
+
serializeInlineConfig(cfg) +
|
|
183
|
+
(data.templateData.customHTML || '');
|
|
175
184
|
} else {
|
|
176
185
|
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
186
|
data.templateData.customHTML =
|
|
181
|
-
EZOIC_SCRIPTS +
|
|
182
187
|
HEAD_PRECONNECTS + '\n' +
|
|
188
|
+
EZOIC_SCRIPTS + '\n' +
|
|
183
189
|
serializeInlineConfig(cfg) +
|
|
184
190
|
(data.templateData.customHTML || '');
|
|
185
191
|
}
|