nodebb-plugin-ezoic-infinite 1.5.87 → 1.5.89

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 +10 -39
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.5.87",
3
+ "version": "1.5.89",
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
@@ -1,29 +1,15 @@
1
1
  (function () {
2
2
  'use strict';
3
3
 
4
- // ===== V4 stateless anti-remontée =====
5
- function purgeAllEzoicWraps(root) {
6
- var scope = root || document;
4
+ function purgeEzoicWrapsInContainer(containerEl) {
7
5
  try {
8
- scope.querySelectorAll('.nodebb-ezoic-wrap').forEach(function (n) {
6
+ if (!containerEl || !containerEl.querySelectorAll) return;
7
+ containerEl.querySelectorAll('.nodebb-ezoic-wrap').forEach(function (n) {
9
8
  try { n.remove(); } catch (e) {}
10
9
  });
11
10
  } catch (e) {}
12
11
  }
13
12
 
14
- function resetEzoicState() {
15
- try { if (typeof shownAdsSet !== 'undefined' && shownAdsSet && shownAdsSet.clear) shownAdsSet.clear(); } catch (e) {}
16
- try { if (typeof pendingShowSet !== 'undefined' && pendingShowSet && pendingShowSet.clear) pendingShowSet.clear(); } catch (e) {}
17
- try { if (typeof showQueue !== 'undefined') showQueue = []; } catch (e) {}
18
- }
19
-
20
- function hardResetAndReinject() {
21
- purgeAllEzoicWraps(document);
22
- resetEzoicState();
23
- try { if (typeof scheduleInject === 'function') scheduleInject(); } catch (e) {}
24
- }
25
- // ===== /V4 =====
26
-
27
13
 
28
14
  // Track scroll direction to avoid aggressive recycling when the user scrolls upward.
29
15
  // Recycling while scrolling up is a common cause of ads "bunching" and a "disappearing too fast" feeling.
@@ -728,11 +714,11 @@ function globalGapFixInit() {
728
714
  }
729
715
 
730
716
  function pruneOrphanWraps(kindClass, items) {
731
- return;
717
+ return;
732
718
  }
733
719
 
734
720
  function decluster(kindClass) {
735
- return;
721
+ return;
736
722
  }
737
723
 
738
724
  // ---------------- show (preload / fast fill) ----------------
@@ -972,7 +958,8 @@ function buildOrdinalMap(items) {
972
958
  }
973
959
 
974
960
  function injectBetween(kindClass, items, interval, showFirst, allIds, cursorKey) {
975
- try { if (containerEl) purgeAllEzoicWraps(containerEl); } catch (e) {}
961
+ // V5: local stateless mode (container only)
962
+ purgeEzoicWrapsInContainer(containerEl);
976
963
 
977
964
  if (!items.length) return 0;
978
965
 
@@ -999,7 +986,7 @@ function buildOrdinalMap(items) {
999
986
  if (!id) {
1000
987
  // Only recycle while scrolling down. Recycling while scrolling up tends to
1001
988
  // cause perceived instability (ads bunching/disappearing).
1002
- recycledWrap = scrollDir > 0 ? pickRecyclableWrap(kindClass) : null;
989
+ recycledWrap = null;
1003
990
  if (recycledWrap) {
1004
991
  id = recycledWrap.getAttribute('data-ezoic-wrapid') || '';
1005
992
  }
@@ -1022,11 +1009,11 @@ function buildOrdinalMap(items) {
1022
1009
  }
1023
1010
 
1024
1011
  function pickRecyclableWrap(kindClass) {
1025
- return null;
1012
+ return null;
1026
1013
  }
1027
1014
 
1028
1015
  function moveWrapAfter(anchorEl, wrap, kindClass, afterPos) {
1029
- return;
1016
+ return;
1030
1017
  }
1031
1018
 
1032
1019
  async function runCore() {
@@ -1366,19 +1353,3 @@ return;
1366
1353
  insertHeroAdEarly().catch(() => {});
1367
1354
  requestBurst();
1368
1355
  })();
1369
-
1370
-
1371
-
1372
- // V4 stateless hooks
1373
- try {
1374
- if (typeof window !== 'undefined' && window.jQuery) {
1375
- window.jQuery(window).off('action:ajaxify.start.ezoicv4 action:infiniteScroll.start.ezoicv4 action:ajaxify.end.ezoicv4 action:infiniteScroll.loaded.ezoicv4');
1376
- window.jQuery(window).on('action:ajaxify.start.ezoicv4 action:infiniteScroll.start.ezoicv4', function () {
1377
- hardResetAndReinject();
1378
- });
1379
- window.jQuery(window).on('action:ajaxify.end.ezoicv4 action:infiniteScroll.loaded.ezoicv4', function () {
1380
- hardResetAndReinject();
1381
- });
1382
- }
1383
- } catch (e) {}
1384
-