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.
- package/library.js +22 -17
- 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
|
-
//
|
|
139
|
-
//
|
|
140
|
-
// before sa.min.js
|
|
141
|
-
//
|
|
142
|
-
const EZOIC_SCRIPTS =
|
|
143
|
-
<script data-cfasync="false" src="https://
|
|
144
|
-
<script
|
|
145
|
-
<script src="//
|
|
146
|
-
|
|
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
|
-
|
|
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
|
}
|