nodebb-plugin-ezoic-infinite 1.6.37 → 1.6.39
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 +51 -3
- package/public/style.css +1 -6
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -498,6 +498,48 @@ function globalGapFixInit() {
|
|
|
498
498
|
return el;
|
|
499
499
|
}
|
|
500
500
|
|
|
501
|
+
// Best-effort refresh for Ezoic standalone when we defer placement.
|
|
502
|
+
// Some stacks won't fill ads if a placeholder is rendered while collapsed/0px.
|
|
503
|
+
let _refreshTimer = null;
|
|
504
|
+
|
|
505
|
+
function collectEzoicIds(root) {
|
|
506
|
+
const ids = new Set();
|
|
507
|
+
if (!root || !root.querySelectorAll) return [];
|
|
508
|
+
// Common Ezoic placeholder ids
|
|
509
|
+
root.querySelectorAll('[id^="ezoic-pub-ad-placeholder-"]').forEach(el => ids.add(el.id));
|
|
510
|
+
// Some integrations keep ids on wrappers
|
|
511
|
+
root.querySelectorAll('[data-ezoic-id]').forEach(el => {
|
|
512
|
+
if (el.id) ids.add(el.id);
|
|
513
|
+
});
|
|
514
|
+
return Array.from(ids);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function refreshAds(ids) {
|
|
518
|
+
clearTimeout(_refreshTimer);
|
|
519
|
+
_refreshTimer = setTimeout(() => {
|
|
520
|
+
try {
|
|
521
|
+
if (window.ezstandalone && typeof window.ezstandalone.showAds === 'function') {
|
|
522
|
+
// Prefer a full rescan; fall back to ids if supported.
|
|
523
|
+
try {
|
|
524
|
+
window.ezstandalone.showAds();
|
|
525
|
+
} catch (e) {
|
|
526
|
+
if (ids && ids.length) window.ezstandalone.showAds(ids);
|
|
527
|
+
}
|
|
528
|
+
if (window.__EZ_DEBUG) console.debug('[ezoic-infinite] refreshAds (ezstandalone)', { ids });
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (window.ez && typeof window.ez.showAds === 'function') {
|
|
532
|
+
try {
|
|
533
|
+
window.ez.showAds();
|
|
534
|
+
} catch (e) {
|
|
535
|
+
if (ids && ids.length) window.ez.showAds(ids);
|
|
536
|
+
}
|
|
537
|
+
if (window.__EZ_DEBUG) console.debug('[ezoic-infinite] refreshAds (ez)', { ids });
|
|
538
|
+
}
|
|
539
|
+
} catch (e) {}
|
|
540
|
+
}, 75);
|
|
541
|
+
}
|
|
542
|
+
|
|
501
543
|
function primePlaceholderPool(allIds) {
|
|
502
544
|
try {
|
|
503
545
|
if (!Array.isArray(allIds) || !allIds.length) return;
|
|
@@ -1627,15 +1669,21 @@ function buildOrdinalMap(items) {
|
|
|
1627
1669
|
}
|
|
1628
1670
|
|
|
1629
1671
|
if (after > topics.length) {
|
|
1630
|
-
|
|
1631
|
-
|
|
1672
|
+
// Defer placement until the anchor exists.
|
|
1673
|
+
// Keeping a placeholder in a collapsed/0px container can prevent ad fill on some stacks.
|
|
1632
1674
|
host.classList && host.classList.add(PENDING_CLASS);
|
|
1675
|
+
try {
|
|
1676
|
+
getPoolEl().appendChild(host);
|
|
1677
|
+
} catch (e) {}
|
|
1633
1678
|
return;
|
|
1634
1679
|
}
|
|
1635
1680
|
|
|
1636
1681
|
var anchor = topics[after - 1];
|
|
1637
1682
|
if (anchor) moveAfter(host, anchor);
|
|
1638
|
-
host.classList && host.classList.
|
|
1683
|
+
if (host.classList && host.classList.contains(PENDING_CLASS)) {
|
|
1684
|
+
host.classList.remove(PENDING_CLASS);
|
|
1685
|
+
if (host.dataset && host.dataset.ezoicId) refreshAds([host.dataset.ezoicId]);
|
|
1686
|
+
}
|
|
1639
1687
|
} catch (e) {}
|
|
1640
1688
|
}
|
|
1641
1689
|
|
package/public/style.css
CHANGED
|
@@ -94,12 +94,7 @@ li.nodebb-ezoic-host > .nodebb-ezoic-wrap.ezoic-ad-between { width:100%; display
|
|
|
94
94
|
|
|
95
95
|
/* slots whose anchor topic isn't loaded yet */
|
|
96
96
|
li.nodebb-ezoic-host.nodebb-ezoic-pending{
|
|
97
|
-
|
|
98
|
-
margin: 0 !important;
|
|
99
|
-
padding: 0 !important;
|
|
100
|
-
overflow: hidden !important;
|
|
101
|
-
opacity: 0 !important;
|
|
102
|
-
pointer-events: none !important;
|
|
97
|
+
display: none !important;
|
|
103
98
|
}
|
|
104
99
|
/* ===== /V17.8 ===== */
|
|
105
100
|
|