nodebb-plugin-ezoic-infinite 1.4.67 → 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 +1 -1
- package/public/client.js +33 -15
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -139,20 +139,33 @@
|
|
|
139
139
|
function cleanupInvisibleEzoicElements() {
|
|
140
140
|
try {
|
|
141
141
|
document.querySelectorAll('.ezoic-ad').forEach(wrapper => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
+
}
|
|
156
169
|
}
|
|
157
170
|
});
|
|
158
171
|
});
|
|
@@ -169,7 +182,7 @@
|
|
|
169
182
|
if (ph.children.length === 0) {
|
|
170
183
|
wrapper.remove();
|
|
171
184
|
}
|
|
172
|
-
},
|
|
185
|
+
}, 1500);
|
|
173
186
|
}
|
|
174
187
|
});
|
|
175
188
|
} catch (e) {}
|
|
@@ -397,6 +410,11 @@
|
|
|
397
410
|
}
|
|
398
411
|
});
|
|
399
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
|
|
400
418
|
}, 100);
|
|
401
419
|
}
|
|
402
420
|
|