nodebb-plugin-ezoic-infinite 1.8.54 → 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 -9
- package/package.json +1 -1
- package/public.zip +0 -0
package/library.js
CHANGED
|
@@ -136,15 +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
|
-
'
|
|
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
|
+
'})();',
|
|
144
160
|
'</script>',
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
].join('\n');
|
|
161
|
+
].join('\\n');
|
|
148
162
|
|
|
149
163
|
// ── Hooks ────────────────────────────────────────────────────────────────────
|
|
150
164
|
|
|
@@ -164,11 +178,17 @@ plugin.addAdminNavigation = async (header) => {
|
|
|
164
178
|
|
|
165
179
|
plugin.injectEzoicHead = async (data) => {
|
|
166
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
|
+
|
|
167
187
|
const settings = await getSettings();
|
|
168
|
-
const uid =
|
|
188
|
+
const uid = req?.uid ?? 0;
|
|
169
189
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
|
190
|
+
|
|
170
191
|
if (!excluded) {
|
|
171
|
-
// Préfixer : nos scripts d'abord, puis le customHTML existant de l'admin
|
|
172
192
|
data.templateData.customHTML = EZOIC_SCRIPTS + (data.templateData.customHTML || '');
|
|
173
193
|
}
|
|
174
194
|
} catch (_) {}
|
package/package.json
CHANGED
package/public.zip
ADDED
|
Binary file
|