nodebb-plugin-ezoic-infinite 0.8.6 → 0.8.7

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": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "description": "Ezoic ads with infinite scroll using a pool of placeholder IDs",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -210,6 +210,10 @@ function setupAdAutoHeight() {
210
210
  try {
211
211
  const ro = new ResizeObserver(function () {
212
212
  document.querySelectorAll('.ezoic-ad').forEach(function (wrap) {
213
+ // Collapse until content is injected
214
+ if (!wrap.classList.contains('ezoic-filled')) {
215
+ wrap.style.display = 'none';
216
+ }
213
217
  wrap.style.minHeight = '0px';
214
218
  wrap.style.height = 'auto';
215
219
  });
@@ -217,6 +221,10 @@ function setupAdAutoHeight() {
217
221
 
218
222
  function attach() {
219
223
  document.querySelectorAll('.ezoic-ad').forEach(function (wrap) {
224
+ // Collapse until content is injected
225
+ if (!wrap.classList.contains('ezoic-filled')) {
226
+ wrap.style.display = 'none';
227
+ }
220
228
  if (wrap.__ezoicRO) return;
221
229
  wrap.__ezoicRO = true;
222
230
  ro.observe(wrap);
@@ -260,8 +268,17 @@ function callEzoic(ids) {
260
268
  const collect = function () {
261
269
  const list = [];
262
270
  document.querySelectorAll('.ezoic-ad').forEach(function (wrap) {
271
+ // Collapse until content is injected
272
+ if (!wrap.classList.contains('ezoic-filled')) {
273
+ wrap.style.display = 'none';
274
+ }
263
275
  if (wrap.getAttribute('data-ezoic-rendered') === '1') return;
264
276
  const ph = wrap.querySelector('[id^="ezoic-pub-ad-placeholder-"]');
277
+ if (ph && ph.children && ph.children.length) {
278
+ // Content injected
279
+ wrap.classList.add('ezoic-filled');
280
+ wrap.style.display = '';
281
+ }
265
282
  if (!ph) return;
266
283
  const idStr = ph.id.replace('ezoic-pub-ad-placeholder-', '');
267
284
  const id = parseInt(idStr, 10);
package/public/style.css CHANGED
@@ -1,3 +1,4 @@
1
- .ezoic-ad{min-height:0!important;height:auto!important;padding:0!important;}
2
- .ezoic-ad-post,.ezoic-ad-topic{margin:0.5rem 0;}
1
+ .ezoic-ad{min-height:0 !important;height:auto !important;padding:0 !important;margin:0.5rem 0;}
2
+ .ezoic-ad:not(.ezoic-filled){display:none !important;}
3
3
  .ezoic-ad-message-inner{padding:0;margin:0;}
4
+ .ezoic-ad-message-inner > div{margin:0;padding:0;}