nodebb-plugin-ezoic-infinite 1.8.25 → 1.8.27
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 +42 -12
- package/public/style.css +6 -4
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
const MAX_INFLIGHT = 4; // max showAds() simultanés
|
|
84
84
|
const SHOW_THROTTLE_MS = 900; // anti-spam showAds() par id
|
|
85
85
|
const BURST_COOLDOWN_MS = 200; // délai min entre deux déclenchements de burst
|
|
86
|
-
const MIN_PLACEHOLDER_HEIGHT =
|
|
86
|
+
const MIN_PLACEHOLDER_HEIGHT = 1; // placeholder minimal (test stabilité scroll)
|
|
87
87
|
|
|
88
88
|
// Marges IO larges et fixes — observer créé une seule fois au boot
|
|
89
89
|
const IO_MARGIN_DESKTOP = '2500px 0px 2500px 0px';
|
|
@@ -370,17 +370,30 @@
|
|
|
370
370
|
best.setAttribute(A_CREATED, String(ts()));
|
|
371
371
|
best.setAttribute(A_SHOWN, '0');
|
|
372
372
|
best.classList.remove('is-empty');
|
|
373
|
-
const
|
|
374
|
-
if (
|
|
373
|
+
const oldPh = best.querySelector(`#${PH_PREFIX}${id}`);
|
|
374
|
+
if (oldPh) {
|
|
375
|
+
const fresh = document.createElement('div');
|
|
376
|
+
fresh.id = `${PH_PREFIX}${id}`;
|
|
377
|
+
fresh.setAttribute('data-ezoic-id', String(id));
|
|
378
|
+
fresh.style.minHeight = `${MIN_PLACEHOLDER_HEIGHT}px`;
|
|
379
|
+
oldPh.replaceWith(fresh);
|
|
380
|
+
}
|
|
375
381
|
targetEl.insertAdjacentElement('afterend', best);
|
|
376
382
|
});
|
|
377
383
|
if (oldKey && S.wrapByKey.get(oldKey) === best) S.wrapByKey.delete(oldKey);
|
|
378
384
|
S.wrapByKey.set(newKey, best);
|
|
379
385
|
|
|
380
|
-
//
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
|
|
386
|
+
// Recyclage Ezoic : détruire l'ancien placeholder avant de réutiliser le même ID.
|
|
387
|
+
// Puis ré-observer + re-show (batché via patchShowAds) sur le placeholder recréé.
|
|
388
|
+
const doDestroy = () => {
|
|
389
|
+
try { ez.destroyPlaceholders(id); } catch (_) {
|
|
390
|
+
try { ez.destroyPlaceholders([id]); } catch (_) {}
|
|
391
|
+
}
|
|
392
|
+
setTimeout(() => {
|
|
393
|
+
try { observePh(id); } catch (_) {}
|
|
394
|
+
try { enqueueShow(id); } catch (_) {}
|
|
395
|
+
}, 450);
|
|
396
|
+
};
|
|
384
397
|
try { (typeof ez.cmd?.push === 'function') ? ez.cmd.push(doDestroy) : doDestroy(); } catch (_) {}
|
|
385
398
|
|
|
386
399
|
return { id, wrap: best };
|
|
@@ -620,17 +633,34 @@
|
|
|
620
633
|
if (window.__nbbEzPatched || typeof ez.showAds !== 'function') return;
|
|
621
634
|
window.__nbbEzPatched = true;
|
|
622
635
|
const orig = ez.showAds.bind(ez);
|
|
636
|
+
const q = new Set();
|
|
637
|
+
let flushTimer = null;
|
|
638
|
+
const BATCH_SIZE = 3;
|
|
639
|
+
const FLUSH_MS = 80;
|
|
640
|
+
const flush = () => {
|
|
641
|
+
flushTimer = null;
|
|
642
|
+
if (isBlocked() || !q.size) return;
|
|
643
|
+
const ids = Array.from(q).sort((a, b) => a - b);
|
|
644
|
+
q.clear();
|
|
645
|
+
const valid = ids.filter(id => document.getElementById(`${PH_PREFIX}${id}`)?.isConnected);
|
|
646
|
+
for (let i = 0; i < valid.length; i += BATCH_SIZE) {
|
|
647
|
+
const chunk = valid.slice(i, i + BATCH_SIZE);
|
|
648
|
+
try { orig(...chunk); } catch (_) {
|
|
649
|
+
for (const id of chunk) { try { orig(id); } catch (_) {} }
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
};
|
|
623
653
|
ez.showAds = function (...args) {
|
|
624
654
|
if (isBlocked()) return;
|
|
625
|
-
const ids
|
|
626
|
-
const seen = new Set();
|
|
655
|
+
const ids = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
|
|
627
656
|
for (const v of ids) {
|
|
628
657
|
const id = parseInt(v, 10);
|
|
629
|
-
if (!Number.isFinite(id) || id <= 0
|
|
658
|
+
if (!Number.isFinite(id) || id <= 0) continue;
|
|
630
659
|
if (!document.getElementById(`${PH_PREFIX}${id}`)?.isConnected) continue;
|
|
631
|
-
|
|
632
|
-
try { orig(id); } catch (_) {}
|
|
660
|
+
q.add(id);
|
|
633
661
|
}
|
|
662
|
+
if (!q.size) return;
|
|
663
|
+
if (!flushTimer) flushTimer = setTimeout(flush, FLUSH_MS);
|
|
634
664
|
};
|
|
635
665
|
} catch (_) {}
|
|
636
666
|
};
|
package/public/style.css
CHANGED
|
@@ -22,11 +22,10 @@
|
|
|
22
22
|
|
|
23
23
|
/* ── Ciblage précis des nœuds Ezoic dans nos wraps ───────────────────────── */
|
|
24
24
|
|
|
25
|
-
/* Supprime le gap "baseline" sous les iframes */
|
|
25
|
+
/* Supprime le gap "baseline" sous les iframes (via block + line-height/font-size) */
|
|
26
26
|
.nodebb-ezoic-wrap iframe,
|
|
27
27
|
.nodebb-ezoic-wrap div[id$="__container__"] iframe {
|
|
28
28
|
display: block !important;
|
|
29
|
-
vertical-align: top !important;
|
|
30
29
|
line-height: 0 !important;
|
|
31
30
|
font-size: 0 !important;
|
|
32
31
|
}
|
|
@@ -34,15 +33,18 @@
|
|
|
34
33
|
.nodebb-ezoic-wrap div[id$="__container__"] {
|
|
35
34
|
display: block !important;
|
|
36
35
|
line-height: 0 !important;
|
|
36
|
+
font-size: 0 !important;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/*
|
|
39
|
+
/* Ne pas écraser la hauteur réelle calculée par Ezoic */
|
|
40
40
|
.nodebb-ezoic-wrap .ezoic-ad,
|
|
41
41
|
.nodebb-ezoic-wrap span.ezoic-ad {
|
|
42
42
|
margin: 0 !important;
|
|
43
43
|
padding: 0 !important;
|
|
44
|
-
|
|
44
|
+
display: block !important;
|
|
45
45
|
height: auto !important;
|
|
46
|
+
min-height: unset !important;
|
|
47
|
+
max-height: none !important;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
/* Reportline en absolu pour ne pas impacter le layout */
|