nodebb-plugin-ezoic-infinite 1.4.72 → 1.4.74
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 +40 -25
- package/public/style.css +16 -7
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
usedPosts: new Set(),
|
|
24
24
|
usedCategories: new Set(),
|
|
25
25
|
|
|
26
|
+
liveTopics: [],
|
|
27
|
+
livePosts: [],
|
|
28
|
+
liveCategories: [],
|
|
29
|
+
|
|
26
30
|
lastShowById: new Map(),
|
|
27
31
|
pendingById: new Set(),
|
|
28
32
|
definedIds: new Set(),
|
|
@@ -243,6 +247,7 @@
|
|
|
243
247
|
wrap.className = `${WRAP_CLASS} ${kindClass}`;
|
|
244
248
|
wrap.setAttribute('data-ezoic-after', String(afterPos));
|
|
245
249
|
wrap.style.width = '100%';
|
|
250
|
+
wrap.style.display = 'none';
|
|
246
251
|
|
|
247
252
|
const ph = document.createElement('div');
|
|
248
253
|
ph.id = `${PLACEHOLDER_PREFIX}${id}`;
|
|
@@ -321,31 +326,28 @@
|
|
|
321
326
|
|
|
322
327
|
function forcePlaceholderAutoHeight(wrap, id) {
|
|
323
328
|
try {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
try {
|
|
336
|
-
ph.style.setProperty('height', 'auto', 'important');
|
|
337
|
-
ph.style.setProperty('min-height', '0px', 'important');
|
|
338
|
-
} catch (e) {}
|
|
339
|
-
});
|
|
329
|
+
if (!wrap) return;
|
|
330
|
+
const ph = id ? wrap.querySelector && wrap.querySelector(`#${PLACEHOLDER_PREFIX}${id}`) : (wrap.querySelector && wrap.querySelector(`[id^="${PLACEHOLDER_PREFIX}"]`));
|
|
331
|
+
if (!ph) return;
|
|
332
|
+
ph.style.setProperty('height', 'auto', 'important');
|
|
333
|
+
ph.style.setProperty('min-height', '0px', 'important');
|
|
334
|
+
requestAnimationFrame(() => {
|
|
335
|
+
try {
|
|
336
|
+
ph.style.setProperty('height', 'auto', 'important');
|
|
337
|
+
ph.style.setProperty('min-height', '0px', 'important');
|
|
338
|
+
} catch (e) {}
|
|
339
|
+
});
|
|
340
340
|
} catch (e) {}
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
function markFilled(wrap, id) {
|
|
343
|
+
function markFilled(wrap, id) {
|
|
344
344
|
try {
|
|
345
345
|
if (!wrap) return;
|
|
346
346
|
if (wrap.__ezoicFillObs) { wrap.__ezoicFillObs.disconnect(); wrap.__ezoicFillObs = null; }
|
|
347
347
|
wrap.setAttribute('data-ezoic-filled', '1');
|
|
348
|
-
|
|
348
|
+
// show wrapper only when filled (avoid blank gaps if consent/CMP blocks)
|
|
349
|
+
wrap.style.display = 'block';
|
|
350
|
+
forcePlaceholderAutoHeight(wrap, id);
|
|
349
351
|
} catch (e) {}
|
|
350
352
|
}
|
|
351
353
|
|
|
@@ -424,8 +426,7 @@ function markFilled(wrap, id) {
|
|
|
424
426
|
window.ezstandalone.cmd.push(function() {
|
|
425
427
|
if (typeof window.ezstandalone.showAds === 'function') {
|
|
426
428
|
// Appel batch: showAds(id1, id2, id3...)
|
|
427
|
-
|
|
428
|
-
if (okIds.length) { window.ezstandalone.showAds(...okIds); }
|
|
429
|
+
window.ezstandalone.showAds(...idsArray);
|
|
429
430
|
// Tracker tous les IDs
|
|
430
431
|
idsArray.forEach(id => {
|
|
431
432
|
state.lastShowById.set(id, Date.now());
|
|
@@ -453,6 +454,8 @@ function markFilled(wrap, id) {
|
|
|
453
454
|
window.ezstandalone = window.ezstandalone || {};
|
|
454
455
|
if (typeof window.ezstandalone.showAds === 'function') {
|
|
455
456
|
|
|
457
|
+
const elNow = document.getElementById(phId);
|
|
458
|
+
if (!elNow || !elNow.isConnected) return false;
|
|
456
459
|
state.lastShowById.set(id, Date.now());
|
|
457
460
|
window.ezstandalone.showAds(id);
|
|
458
461
|
sessionDefinedIds.add(id);
|
|
@@ -528,7 +531,7 @@ function markFilled(wrap, id) {
|
|
|
528
531
|
return Array.from(new Set(out)).sort((a, b) => a - b);
|
|
529
532
|
}
|
|
530
533
|
|
|
531
|
-
function injectBetween(kindClass, items, interval, showFirst, kindPool, usedSet) {
|
|
534
|
+
function injectBetween(kindClass, items, interval, showFirst, kindPool, usedSet, liveArr) {
|
|
532
535
|
if (!items.length) return 0;
|
|
533
536
|
const targets = computeTargets(items.length, interval, showFirst);
|
|
534
537
|
|
|
@@ -549,7 +552,7 @@ function markFilled(wrap, id) {
|
|
|
549
552
|
|
|
550
553
|
if (findWrap(kindClass, afterPos)) continue;
|
|
551
554
|
|
|
552
|
-
const pick = pickId(kindPool, []);
|
|
555
|
+
const pick = pickId(kindPool, liveArr || []);
|
|
553
556
|
const id = pick.id;
|
|
554
557
|
if (!id) break;
|
|
555
558
|
|
|
@@ -574,6 +577,18 @@ function markFilled(wrap, id) {
|
|
|
574
577
|
// Appel immédiat au lieu de 10ms delay
|
|
575
578
|
callShowAdsWhenReady(id);
|
|
576
579
|
}
|
|
580
|
+
|
|
581
|
+
if (liveArr) liveArr.push({ id, wrap });
|
|
582
|
+
if (wrap && (
|
|
583
|
+
(wrap.previousElementSibling && wrap.previousElementSibling.classList && wrap.previousElementSibling.classList.contains(WRAP_CLASS)) || (wrap.nextElementSibling && wrap.nextElementSibling.classList && wrap.nextElementSibling.classList.contains(WRAP_CLASS))
|
|
584
|
+
)) {
|
|
585
|
+
try { wrap.remove(); } catch (e) {}
|
|
586
|
+
if (!(pick.recycled && pick.recycled.wrap)) {
|
|
587
|
+
try { kindPool.unshift(id); } catch (e) {}
|
|
588
|
+
usedSet.delete(id);
|
|
589
|
+
}
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
577
592
|
inserted += 1;
|
|
578
593
|
}
|
|
579
594
|
return inserted;
|
|
@@ -663,7 +678,7 @@ function markFilled(wrap, id) {
|
|
|
663
678
|
Math.max(1, parseInt(cfg.messageIntervalPosts, 10) || 3),
|
|
664
679
|
normalizeBool(cfg.showFirstMessageAd),
|
|
665
680
|
state.poolPosts,
|
|
666
|
-
state.usedPosts);
|
|
681
|
+
state.usedPosts, state.livePosts);
|
|
667
682
|
}
|
|
668
683
|
} else if (kind === 'categoryTopics') {
|
|
669
684
|
if (normalizeBool(cfg.enableBetweenAds)) {
|
|
@@ -671,7 +686,7 @@ function markFilled(wrap, id) {
|
|
|
671
686
|
Math.max(1, parseInt(cfg.intervalPosts, 10) || 6),
|
|
672
687
|
normalizeBool(cfg.showFirstTopicAd),
|
|
673
688
|
state.poolTopics,
|
|
674
|
-
state.usedTopics);
|
|
689
|
+
state.usedTopics, state.liveTopics);
|
|
675
690
|
}
|
|
676
691
|
} else if (kind === 'categories') {
|
|
677
692
|
if (normalizeBool(cfg.enableCategoryAds)) {
|
|
@@ -679,7 +694,7 @@ function markFilled(wrap, id) {
|
|
|
679
694
|
Math.max(1, parseInt(cfg.intervalCategories, 10) || 4),
|
|
680
695
|
normalizeBool(cfg.showFirstCategoryAd),
|
|
681
696
|
state.poolCategories,
|
|
682
|
-
state.usedCategories);
|
|
697
|
+
state.usedCategories, state.liveCategories);
|
|
683
698
|
}
|
|
684
699
|
}
|
|
685
700
|
|
package/public/style.css
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
/*
|
|
3
|
-
.ezoic-ad{
|
|
1
|
+
/* Ezoic Infinite Ads (NodeBB) - production safe */
|
|
2
|
+
/* Hide wrappers until ad actually fills to avoid blank gaps (e.g., CMP/consent issues) */
|
|
3
|
+
.ezoic-ad{
|
|
4
4
|
display:none;
|
|
5
|
-
width:100%;
|
|
6
5
|
height:auto !important;
|
|
6
|
+
min-height:0 !important;
|
|
7
7
|
padding:0 !important;
|
|
8
8
|
margin:0 !important;
|
|
9
|
+
width:100%;
|
|
9
10
|
}
|
|
11
|
+
|
|
12
|
+
/* Marked filled => show */
|
|
10
13
|
.ezoic-ad[data-ezoic-filled="1"]{
|
|
11
14
|
display:block;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
/*
|
|
17
|
+
/* Placeholder must not reserve fixed height */
|
|
15
18
|
.ezoic-ad > [id^="ezoic-pub-ad-placeholder-"]{
|
|
16
19
|
height:auto !important;
|
|
17
20
|
min-height:0 !important;
|
|
@@ -19,13 +22,19 @@
|
|
|
19
22
|
padding:0 !important;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
|
-
/*
|
|
25
|
+
/* Prevent baseline gaps under iframes/ins */
|
|
23
26
|
.ezoic-ad iframe,
|
|
24
27
|
.ezoic-ad ins{
|
|
25
28
|
display:block !important;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
/*
|
|
31
|
+
/* Remove empty spacer divs if any */
|
|
29
32
|
.ezoic-ad > div:empty{
|
|
30
33
|
display:none !important;
|
|
31
34
|
}
|
|
35
|
+
|
|
36
|
+
/* Defensive: wipe margins/paddings inside wrapper */
|
|
37
|
+
.ezoic-ad *{
|
|
38
|
+
margin:0 !important;
|
|
39
|
+
padding:0 !important;
|
|
40
|
+
}
|