nodebb-plugin-ezoic-infinite 1.5.64 → 1.5.65

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.5.64",
3
+ "version": "1.5.65",
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
@@ -99,6 +99,16 @@
99
99
 
100
100
  const insertingIds = new Set();
101
101
 
102
+ function unemptyIfFilled(wrap, ph) {
103
+ try {
104
+ if (!wrap || !ph) return false;
105
+ const hasAd = !!(ph.querySelector && ph.querySelector('iframe, ins, img, .ez-ad, .ezoic-ad'));
106
+ if (hasAd) wrap.classList.remove('is-empty');
107
+ return hasAd;
108
+ } catch (e) { return false; }
109
+ }
110
+
111
+
102
112
 
103
113
  function markEmptyWrapper(id) {
104
114
  try {
@@ -116,6 +126,17 @@
116
126
  // consider empty if only whitespace and no iframes/ins/img
117
127
  const hasAd = !!(ph2.querySelector && ph2.querySelector('iframe, ins, img, .ez-ad, .ezoic-ad'));
118
128
  if (!hasAd) w2.classList.add('is-empty');
129
+ // If the ad fills later, immediately uncollapse to avoid "missing ads" perception.
130
+ if (!unemptyIfFilled(w2, ph2)) {
131
+ try {
132
+ const mo = new MutationObserver(() => {
133
+ if (unemptyIfFilled(w2, ph2)) { try { mo.disconnect(); } catch (e) {} }
134
+ });
135
+ mo.observe(ph2, { childList: true, subtree: true });
136
+ // safety stop
137
+ setTimeout(() => { try { mo.disconnect(); } catch (e) {} }, 30000);
138
+ } catch (e) {}
139
+ }
119
140
  } catch (e) {}
120
141
  }, 3500);
121
142
  } catch (e) {}
package/public/style.css CHANGED
@@ -29,17 +29,17 @@
29
29
  display: block !important;
30
30
  margin: 0 !important;
31
31
  padding: 0 !important;
32
- height: 0 !important;
33
- min-height: 0 !important;
32
+ height: 1px !important;
33
+ min-height: 1px !important;
34
34
  overflow: hidden !important;
35
35
  }
36
36
 
37
37
  .nodebb-ezoic-wrap {
38
- min-height: 0 !important;
38
+ min-height: 1px !important;
39
39
  }
40
40
 
41
41
  .nodebb-ezoic-wrap > [id^="ezoic-pub-ad-placeholder-"] {
42
- min-height: 0 !important;
42
+ min-height: 1px !important;
43
43
  }
44
44
 
45
45
  /*