nodebb-plugin-ezoic-infinite 1.8.53 → 1.8.55
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 +29 -10
- package/package.json +1 -1
- package/public.zip +0 -0
package/library.js
CHANGED
|
@@ -136,16 +136,29 @@ const HEAD_PRECONNECTS = [
|
|
|
136
136
|
].join('\n');
|
|
137
137
|
|
|
138
138
|
const EZOIC_SCRIPTS = [
|
|
139
|
-
|
|
140
|
-
'<script async src="//www.ezojs.com/ezoic/sa.min.js"></script>',
|
|
139
|
+
HEAD_PRECONNECTS,
|
|
141
140
|
'<script>',
|
|
142
|
-
'
|
|
143
|
-
'
|
|
144
|
-
'
|
|
141
|
+
'(function(){',
|
|
142
|
+
' if (window.__nbbEzoicHeadLoaded) return;',
|
|
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
|
+
'})();',
|
|
145
160
|
'</script>',
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
].join('\n');
|
|
161
|
+
].join('\\n');
|
|
149
162
|
|
|
150
163
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
|
151
164
|
|
|
@@ -165,11 +178,17 @@ plugin.addAdminNavigation = async (header) => {
|
|
|
165
178
|
|
|
166
179
|
plugin.injectEzoicHead = async (data) => {
|
|
167
180
|
try {
|
|
181
|
+
const req = data.req;
|
|
182
|
+
|
|
183
|
+
// Très important : ne pas ré-injecter sur navigation AJAX (ajaxify)
|
|
184
|
+
const isXHR = !!(req && (req.xhr || req.headers?.['x-requested-with'] === 'XMLHttpRequest'));
|
|
185
|
+
if (isXHR) return data;
|
|
186
|
+
|
|
168
187
|
const settings = await getSettings();
|
|
169
|
-
const uid =
|
|
188
|
+
const uid = req?.uid ?? 0;
|
|
170
189
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
|
190
|
+
|
|
171
191
|
if (!excluded) {
|
|
172
|
-
// Préfixer : nos scripts d'abord, puis le customHTML existant de l'admin
|
|
173
192
|
data.templateData.customHTML = EZOIC_SCRIPTS + (data.templateData.customHTML || '');
|
|
174
193
|
}
|
|
175
194
|
} catch (_) {}
|
package/package.json
CHANGED
package/public.zip
ADDED
|
Binary file
|