nodebb-plugin-ezoic-infinite 1.4.6 → 1.4.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/client.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
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
@@ -328,10 +328,14 @@
328
328
  const attempts = (state.retryById.get(id) || 0);
329
329
  const phNow = document.getElementById(`${PLACEHOLDER_PREFIX}${id}`);
330
330
  const wrapNow = phNow && phNow.parentElement;
331
+ // If Ezoic already defined this id earlier but the placeholder is empty now, we must destroy+reset before re-showAds.
332
+ if (wrapNow && wrapNow.isConnected && state.definedIds && state.definedIds.has(id) && !isPlaceholderFilled(id)) {
333
+ destroyPlaceholderIds([id]);
334
+ resetPlaceholderInWrap(wrapNow, id);
335
+ }
336
+ // If this id was previously attempted and still empty, force a full reset before re-requesting.
331
337
  if (attempts > 0 && wrapNow && wrapNow.isConnected && !isPlaceholderFilled(id)) {
332
- if (state.definedIds && state.definedIds.has(id)) {
333
- destroyPlaceholderIds([id]);
334
- }
338
+ destroyPlaceholderIds([id]);
335
339
  resetPlaceholderInWrap(wrapNow, id);
336
340
  }
337
341
  callShowAdsWhenReady(id);