nodebb-plugin-ezoic-infinite 1.4.36 → 1.4.38
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/package.json +1 -1
- package/public/client.js +19 -0
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -325,6 +325,10 @@
|
|
|
325
325
|
|
|
326
326
|
function callShowAdsWhenReady(id) {
|
|
327
327
|
if (!id) return;
|
|
328
|
+
|
|
329
|
+
if (window.location.pathname !== '/') {
|
|
330
|
+
console.log('[TIMING] callShowAdsWhenReady ID:', id);
|
|
331
|
+
}
|
|
328
332
|
|
|
329
333
|
const now = Date.now(), last = state.lastShowById.get(id) || 0;
|
|
330
334
|
if (now - last < 3500) return;
|
|
@@ -348,9 +352,22 @@
|
|
|
348
352
|
if (state.pageKey !== startPageKey) return;
|
|
349
353
|
// Abort if another concurrent call is already handling this id
|
|
350
354
|
if (state.pendingById.has(id)) return;
|
|
355
|
+
|
|
351
356
|
attempts += 1;
|
|
352
357
|
const el = document.getElementById(phId);
|
|
353
358
|
if (el && el.isConnected) {
|
|
359
|
+
if (window.location.pathname !== '/') {
|
|
360
|
+
console.log('[TIMING] Placeholder', id, 'trouvé dans DOM, appel showAds');
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// Double-check pageKey juste avant doCall (au cas où cleanup appelé entre-temps)
|
|
364
|
+
if (state.pageKey !== startPageKey) {
|
|
365
|
+
if (window.location.pathname !== '/') {
|
|
366
|
+
console.log('[TIMING] ABORT ID', id, '- navigation détectée avant showAds');
|
|
367
|
+
}
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
|
|
354
371
|
// Si doCall() réussit, Ezoic est chargé et showAds a été appelé → sortir
|
|
355
372
|
if (doCall()) {
|
|
356
373
|
state.pendingById.delete(id); // nettoyage au cas où
|
|
@@ -530,6 +547,8 @@
|
|
|
530
547
|
state.liveCategory = [];
|
|
531
548
|
|
|
532
549
|
state.lastShowById.clear();
|
|
550
|
+
// CRITIQUE: Vider pendingById pour annuler tous les showAds en cours
|
|
551
|
+
// Sinon Ezoic essaie d'accéder aux placeholders pendant que NodeBB vide le DOM
|
|
533
552
|
state.pendingById.clear();
|
|
534
553
|
state.definedIds.clear();
|
|
535
554
|
|