nodebb-plugin-ezoic-infinite 1.4.66 → 1.4.68

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.4.66",
3
+ "version": "1.4.68",
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
@@ -116,6 +116,11 @@
116
116
  window.ezstandalone.destroyPlaceholders(filtered);
117
117
  }
118
118
  } catch (e) {}
119
+
120
+ // Recyclage: libérer IDs après 100ms
121
+ setTimeout(() => {
122
+ filtered.forEach(id => sessionDefinedIds.delete(id));
123
+ }, 100);
119
124
  };
120
125
  try {
121
126
  window.ezstandalone = window.ezstandalone || {};
@@ -123,6 +128,48 @@
123
128
  if (window.ezstandalone && typeof window.ezstandalone.destroyPlaceholders === 'function') call();
124
129
  else window.ezstandalone.cmd.push(call);
125
130
  } catch (e) {}
131
+
132
+ // Recyclage: libérer IDs après 100ms
133
+ setTimeout(() => {
134
+ filtered.forEach(id => sessionDefinedIds.delete(id));
135
+ }, 100);
136
+ }
137
+
138
+ // Nettoyer éléments Ezoic invisibles qui créent espace vertical
139
+ function cleanupInvisibleEzoicElements() {
140
+ try {
141
+ document.querySelectorAll('.ezoic-ad').forEach(wrapper => {
142
+ const ph = wrapper.querySelector('[id^="ezoic-pub-ad-placeholder-"]');
143
+ if (!ph) return;
144
+
145
+ // Supprimer TOUS les éléments après le placeholder rempli
146
+ // qui créent de l'espace vertical
147
+ let found = false;
148
+ Array.from(wrapper.children).forEach(child => {
149
+ if (child === ph || child.contains(ph)) {
150
+ found = true;
151
+ return;
152
+ }
153
+
154
+ // Si élément APRÈS le placeholder
155
+ if (found) {
156
+ const rect = child.getBoundingClientRect();
157
+ const computed = window.getComputedStyle(child);
158
+
159
+ // Supprimer si:
160
+ // 1. Height > 0 mais pas de texte/image visible
161
+ // 2. Ou opacity: 0
162
+ // 3. Ou visibility: hidden
163
+ const hasContent = child.textContent.trim().length > 0 ||
164
+ child.querySelector('img, iframe, video');
165
+
166
+ if (!hasContent || computed.opacity === '0' || computed.visibility === 'hidden') {
167
+ child.remove();
168
+ }
169
+ }
170
+ });
171
+ });
172
+ } catch (e) {}
126
173
  }
127
174
 
128
175
  function cleanupEmptyWrappers() {
@@ -135,7 +182,7 @@
135
182
  if (ph.children.length === 0) {
136
183
  wrapper.remove();
137
184
  }
138
- }, 3000);
185
+ }, 1500);
139
186
  }
140
187
  });
141
188
  } catch (e) {}
@@ -289,14 +336,14 @@
289
336
  if (!ph) return;
290
337
  // Already filled?
291
338
  if (ph.childNodes && ph.childNodes.length > 0) {
292
- markFilled(wrap);
293
- state.definedIds && state.definedIds.add(id); sessionDefinedIds.add(id);
339
+ markFilled(wrap); // Afficher wrapper
340
+ sessionDefinedIds.add(id);
294
341
  return;
295
342
  }
296
343
  const obs = new MutationObserver(() => {
297
344
  if (ph.childNodes && ph.childNodes.length > 0) {
298
- markFilled(wrap);
299
- try { state.definedIds && state.definedIds.add(id); sessionDefinedIds.add(id); } catch (e) {}
345
+ markFilled(wrap); // CRITIQUE: Afficher wrapper maintenant
346
+ try { sessionDefinedIds.add(id); } catch (e) {}
300
347
  try { obs.disconnect(); } catch (e) {}
301
348
  }
302
349
  });
@@ -363,6 +410,11 @@
363
410
  }
364
411
  });
365
412
  } catch (e) {}
413
+
414
+ // CRITIQUE: Nettoyer éléments invisibles APRÈS que pubs soient chargées
415
+ setTimeout(() => {
416
+ cleanupInvisibleEzoicElements();
417
+ }, 800); // 1.5s pour laisser Ezoic charger
366
418
  }, 100);
367
419
  }
368
420
 
package/public/style.css CHANGED
@@ -1,18 +1,10 @@
1
- .ezoic-ad{height:auto !important; padding:0 !important; margin: 0.25rem 0;}
2
- .ezoic-ad .ezoic-ad-inner{padding:0;margin:0;}
3
- .ezoic-ad .ezoic-ad-inner > div{padding:0;margin:0;}
4
-
5
- /* Cacher placeholder vide pour éviter espace réservé */
6
- .ezoic-ad [id^="ezoic-pub-ad-placeholder-"]:empty {
7
- display: none !important;
8
- height: 0 !important;
9
- margin: 0 !important;
1
+ .ezoic-ad {
2
+ height: auto !important;
10
3
  padding: 0 !important;
4
+ margin: 0 !important;
11
5
  }
12
6
 
13
- /* Wrapper vide aussi caché */
14
- .ezoic-ad:has([id^="ezoic-pub-ad-placeholder-"]:empty) {
15
- display: none !important;
16
- height: 0 !important;
7
+ .ezoic-ad * {
17
8
  margin: 0 !important;
9
+ padding: 0 !important;
18
10
  }