nodebb-plugin-ezoic-infinite 1.8.55 → 1.8.57
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 +25 -23
- package/package.json +1 -1
- package/public.zip +0 -0
package/library.js
CHANGED
|
@@ -137,28 +137,22 @@ const HEAD_PRECONNECTS = [
|
|
|
137
137
|
|
|
138
138
|
const EZOIC_SCRIPTS = [
|
|
139
139
|
HEAD_PRECONNECTS,
|
|
140
|
+
|
|
141
|
+
// CMP en premier
|
|
142
|
+
'<script data-cfasync="false" src="https://the.gatekeeperconsent.com/cmp.min.js"></script>',
|
|
143
|
+
|
|
144
|
+
// Standalone Ezoic
|
|
145
|
+
'<script async src="https://www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
146
|
+
|
|
147
|
+
// cmd queue (OK en inline)
|
|
140
148
|
'<script>',
|
|
141
|
-
'
|
|
142
|
-
'
|
|
143
|
-
' window.__nbbEzoicHeadLoaded = true;',
|
|
144
|
-
'',
|
|
145
|
-
' window.ezstandalone = window.ezstandalone || {};',
|
|
146
|
-
' ezstandalone.cmd = ezstandalone.cmd || [];',
|
|
147
|
-
'',
|
|
148
|
-
' function addScript(src, attrs){',
|
|
149
|
-
' if (document.querySelector(\'script[src="\' + src + \'"]\')) return;',
|
|
150
|
-
' var s = document.createElement("script");',
|
|
151
|
-
' s.src = src;',
|
|
152
|
-
' if (attrs) { Object.keys(attrs).forEach(function(k){ s.setAttribute(k, attrs[k]); }); }',
|
|
153
|
-
' document.head.appendChild(s);',
|
|
154
|
-
' }',
|
|
155
|
-
'',
|
|
156
|
-
' addScript("https://the.gatekeeperconsent.com/cmp.min.js", {"data-cfasync":"false"});',
|
|
157
|
-
' addScript("https://www.ezojs.com/ezoic/sa.min.js", {"async":""});',
|
|
158
|
-
' addScript("https://ezoicanalytics.com/analytics.js");',
|
|
159
|
-
'})();',
|
|
149
|
+
'window.ezstandalone = window.ezstandalone || {};',
|
|
150
|
+
'ezstandalone.cmd = ezstandalone.cmd || [];',
|
|
160
151
|
'</script>',
|
|
161
|
-
|
|
152
|
+
|
|
153
|
+
// Analytics
|
|
154
|
+
'<script src="https://ezoicanalytics.com/analytics.js"></script>',
|
|
155
|
+
].join('\n');
|
|
162
156
|
|
|
163
157
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
|
164
158
|
|
|
@@ -180,8 +174,10 @@ plugin.injectEzoicHead = async (data) => {
|
|
|
180
174
|
try {
|
|
181
175
|
const req = data.req;
|
|
182
176
|
|
|
183
|
-
//
|
|
184
|
-
const isXHR =
|
|
177
|
+
// ✅ NodeBB = SPA (ajaxify). Ne pas ré-injecter les scripts Ezoic sur les requêtes XHR.
|
|
178
|
+
const isXHR =
|
|
179
|
+
!!(req && (req.xhr || String(req.headers?.['x-requested-with']).toLowerCase() === 'xmlhttprequest'));
|
|
180
|
+
|
|
185
181
|
if (isXHR) return data;
|
|
186
182
|
|
|
187
183
|
const settings = await getSettings();
|
|
@@ -189,9 +185,15 @@ plugin.injectEzoicHead = async (data) => {
|
|
|
189
185
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
|
190
186
|
|
|
191
187
|
if (!excluded) {
|
|
192
|
-
|
|
188
|
+
const existing = data.templateData.customHTML || '';
|
|
189
|
+
|
|
190
|
+
// ✅ Anti-doublon côté rendu (si un thème/plugin ajoute déjà sa.min.js)
|
|
191
|
+
if (!existing.includes('www.ezojs.com/ezoic/sa.min.js')) {
|
|
192
|
+
data.templateData.customHTML = EZOIC_SCRIPTS + existing;
|
|
193
|
+
}
|
|
193
194
|
}
|
|
194
195
|
} catch (_) {}
|
|
196
|
+
|
|
195
197
|
return data;
|
|
196
198
|
};
|
|
197
199
|
|
package/package.json
CHANGED
package/public.zip
DELETED
|
Binary file
|