nodebb-plugin-ezoic-infinite 1.6.43 → 1.6.45

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/client.js +18 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.6.43",
3
+ "version": "1.6.45",
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
@@ -1515,7 +1515,11 @@ function buildOrdinalMap(items) {
1515
1515
  (function () {
1516
1516
  // Goal: keep ad injection intact. Only repair when we detect "pile-up" of between wraps.
1517
1517
  var TOPIC_LI_SEL = 'li[component="category/topic"]';
1518
- var BETWEEN_WRAP_SEL = 'div.nodebb-ezoic-wrap.ezoic-ad-between';
1518
+ // Between-ad wrapper selector.
1519
+ // Note: Ezoic can inject <span class="ezoic-ad ...">; we normalize those into our wraps.
1520
+ var BETWEEN_WRAP_SEL = 'div.nodebb-ezoic-wrap.ezoic-ad-between, span.nodebb-ezoic-wrap.ezoic-ad-between, div.ezoic-ad-between, span.ezoic-ad-between';
1521
+ var BETWEEN_WRAP_CHILD_SEL = ':scope > div.nodebb-ezoic-wrap.ezoic-ad-between, :scope > span.nodebb-ezoic-wrap.ezoic-ad-between, :scope > div.ezoic-ad-between, :scope > span.ezoic-ad-between';
1522
+ var ORPHAN_EZOIC_CHILD_SEL = ':scope > span.ezoic-ad:not(.nodebb-ezoic-wrap), :scope > div.ezoic-ad:not(.nodebb-ezoic-wrap)';
1519
1523
  var HOST_CLASS = 'nodebb-ezoic-host';
1520
1524
 
1521
1525
  var scheduled = false;
@@ -1607,7 +1611,19 @@ function buildOrdinalMap(items) {
1607
1611
  if (!ul) return;
1608
1612
 
1609
1613
  // Step 1: wrap any direct child between DIVs into LI hosts (makes list stable)
1610
- ul.querySelectorAll(':scope > ' + BETWEEN_WRAP_SEL).forEach(function(w){ ensureHostForWrap(w, ul); });
1614
+ // First: any explicit between wrappers
1615
+ ul.querySelectorAll(BETWEEN_WRAP_CHILD_SEL).forEach(function(w){ ensureHostForWrap(w, ul); });
1616
+
1617
+ // Second: native injected Ezoic containers directly under the list.
1618
+ // They don't have our marker classes, so we convert them.
1619
+ ul.querySelectorAll(ORPHAN_EZOIC_CHILD_SEL).forEach(function(w){
1620
+ try { w.classList.add('nodebb-ezoic-wrap'); } catch(e) {}
1621
+ try { w.classList.add('ezoic-ad-between'); } catch(e) {}
1622
+ if (!w.getAttribute('data-ezoic-after')) {
1623
+ w.setAttribute('data-ezoic-after', '1');
1624
+ }
1625
+ ensureHostForWrap(w, ul);
1626
+ });
1611
1627
 
1612
1628
  // Step 2: only act if we see pile-up (avoid touching infinite scroll during normal flow)
1613
1629
  if (!detectPileUp(ul)) return;