nodebb-plugin-ezoic-infinite 1.6.37 → 1.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.6.37",
3
+ "version": "1.6.38",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -498,6 +498,25 @@ 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
+ function refreshAds(ids) {
505
+ if (!ids || !ids.length) return;
506
+ clearTimeout(_refreshTimer);
507
+ _refreshTimer = setTimeout(() => {
508
+ try {
509
+ if (window.ezstandalone && typeof window.ezstandalone.showAds === 'function') {
510
+ window.ezstandalone.showAds(ids);
511
+ return;
512
+ }
513
+ if (window.ez && typeof window.ez.showAds === 'function') {
514
+ window.ez.showAds(ids);
515
+ }
516
+ } catch (e) {}
517
+ }, 50);
518
+ }
519
+
501
520
  function primePlaceholderPool(allIds) {
502
521
  try {
503
522
  if (!Array.isArray(allIds) || !allIds.length) return;
@@ -1627,15 +1646,21 @@ function buildOrdinalMap(items) {
1627
1646
  }
1628
1647
 
1629
1648
  if (after > topics.length) {
1630
- var lt2 = lastTopic(ulEl, topics);
1631
- if (lt2) moveAfter(host, lt2);
1649
+ // Defer placement until the anchor exists.
1650
+ // Keeping a placeholder in a collapsed/0px container can prevent ad fill on some stacks.
1632
1651
  host.classList && host.classList.add(PENDING_CLASS);
1652
+ try {
1653
+ getPoolEl().appendChild(host);
1654
+ } catch (e) {}
1633
1655
  return;
1634
1656
  }
1635
1657
 
1636
1658
  var anchor = topics[after - 1];
1637
1659
  if (anchor) moveAfter(host, anchor);
1638
- host.classList && host.classList.remove(PENDING_CLASS);
1660
+ if (host.classList && host.classList.contains(PENDING_CLASS)) {
1661
+ host.classList.remove(PENDING_CLASS);
1662
+ if (host.dataset && host.dataset.ezoicId) refreshAds([host.dataset.ezoicId]);
1663
+ }
1639
1664
  } catch (e) {}
1640
1665
  }
1641
1666
 
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
- max-height: 0 !important;
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