nodebb-plugin-ezoic-infinite 0.7.0 → 0.7.2

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 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
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
@@ -146,6 +146,11 @@ function callEzoic(ids) {
146
146
  window.ezstandalone.cmd = window.ezstandalone.cmd || [];
147
147
 
148
148
  const run = function () {
149
+ try {
150
+ if (typeof window.ezstandalone.destroyPlaceholders === 'function') {
151
+ window.ezstandalone.destroyPlaceholders.apply(window.ezstandalone, ids);
152
+ }
153
+ } catch (e) {}
149
154
  try {
150
155
  if (typeof window.ezstandalone.showAds === 'function') {
151
156
  window.ezstandalone.showAds.apply(window.ezstandalone, ids);
@@ -198,11 +203,7 @@ function injectTopicMessageAds($posts, pool, interval) {
198
203
  if (seenAfterPostNo.has(postNo)) return;
199
204
 
200
205
  let id = pickNextId(pool);
201
- if (!id) {
202
- if (!removeOldestTopicAd()) return;
203
- id = pickNextId(pool);
204
- if (!id) return;
205
- }
206
+ if (!id) { return; }
206
207
 
207
208
  const inner = '<div class="ezoic-ad-message-inner"><div id="ezoic-pub-ad-placeholder-' + id + '"></div></div>';
208
209
  const html = makeWrapperLike(
@@ -237,11 +238,7 @@ function injectCategoryBetweenAds($items, pool, interval) {
237
238
  if (seenAfterTopicPos.has(pos)) return;
238
239
 
239
240
  let id = pickNextId(pool);
240
- if (!id) {
241
- if (!removeOldestCategoryAd()) return;
242
- id = pickNextId(pool);
243
- if (!id) return;
244
- }
241
+ if (!id) { return; }
245
242
 
246
243
  const placeholder = '<div id="ezoic-pub-ad-placeholder-' + id + '"></div>';
247
244
  const html = makeWrapperLike(