nodebb-plugin-ezoic-infinite 1.5.91 → 1.5.93

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 +0 -78
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.5.91",
3
+ "version": "1.5.93",
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,56 +1,6 @@
1
1
  (function () {
2
2
  'use strict';
3
3
 
4
- // ===== V6 anchor-map stability layer =====
5
- var __ezoicAnchorMap = Object.create(null);
6
-
7
- function ezoicGetAnchorKey(el, afterPos, kindClass) {
8
- try {
9
- if (!el) return kindClass + ':pos:' + String(afterPos || 0);
10
- var pid = el.getAttribute && (el.getAttribute('data-pid') || el.getAttribute('data-id'));
11
- if (pid) return kindClass + ':pid:' + String(pid);
12
- var tid = el.getAttribute && (el.getAttribute('data-tid') || el.getAttribute('data-topic-id'));
13
- if (tid) return kindClass + ':tid:' + String(tid);
14
- var a = el.querySelector && el.querySelector('[data-pid],[data-id],[data-tid],[data-topic-id]');
15
- if (a) {
16
- var p = a.getAttribute('data-pid') || a.getAttribute('data-id');
17
- if (p) return kindClass + ':pid:' + String(p);
18
- var t = a.getAttribute('data-tid') || a.getAttribute('data-topic-id');
19
- if (t) return kindClass + ':tid:' + String(t);
20
- }
21
- } catch (e) {}
22
- return kindClass + ':pos:' + String(afterPos || 0);
23
- }
24
-
25
- function ezoicRegisterWrapAnchor(wrap, anchorKey) {
26
- try {
27
- if (!wrap || !anchorKey) return;
28
- wrap.setAttribute('data-ezoic-anchor', anchorKey);
29
- __ezoicAnchorMap[anchorKey] = wrap;
30
- } catch (e) {}
31
- }
32
-
33
- function ezoicFindWrapByAnchor(anchorKey) {
34
- try {
35
- var w = __ezoicAnchorMap[anchorKey];
36
- if (w && w.isConnected) return w;
37
- } catch (e) {}
38
- try {
39
- return document.querySelector('.nodebb-ezoic-wrap[data-ezoic-anchor="' + String(anchorKey).replace(/"/g, '') + '"]');
40
- } catch (e) { return null; }
41
- }
42
-
43
- function ezoicCleanupAnchorMap() {
44
- try {
45
- Object.keys(__ezoicAnchorMap).forEach(function(k){
46
- var w = __ezoicAnchorMap[k];
47
- if (!w || !w.isConnected) delete __ezoicAnchorMap[k];
48
- });
49
- } catch (e) {}
50
- }
51
- // ===== /V6 =====
52
-
53
-
54
4
  // Track scroll direction to avoid aggressive recycling when the user scrolls upward.
55
5
  // Recycling while scrolling up is a common cause of ads "bunching" and a "disappearing too fast" feeling.
56
6
  let lastScrollY = 0;
@@ -690,8 +640,6 @@ function globalGapFixInit() {
690
640
  const wrap = document.createElement('div');
691
641
  wrap.className = `${WRAP_CLASS} ${kindClass}`;
692
642
  wrap.setAttribute('data-ezoic-after', String(afterPos));
693
- var __anchorKey = ezoicGetAnchorKey(el, afterPos, kindClass);
694
- ezoicRegisterWrapAnchor(wrap, __anchorKey);
695
643
  wrap.setAttribute('data-ezoic-wrapid', String(id));
696
644
  wrap.setAttribute('data-created', String(now()));
697
645
  // "Pinned" placements (after the first item) should remain stable.
@@ -1131,7 +1079,6 @@ function buildOrdinalMap(items) {
1131
1079
  }
1132
1080
 
1133
1081
  function injectBetween(kindClass, items, interval, showFirst, allIds, cursorKey) {
1134
- ezoicCleanupAnchorMap();
1135
1082
  if (!items.length) return 0;
1136
1083
 
1137
1084
  const { map: ordinalMap, max: maxOrdinal } = buildOrdinalMap(items);
@@ -1525,28 +1472,3 @@ function buildOrdinalMap(items) {
1525
1472
  insertHeroAdEarly().catch(() => {});
1526
1473
  requestBurst();
1527
1474
  })();
1528
-
1529
-
1530
- // V6 guard: prevent unexpected regrouping under first topic
1531
- try {
1532
- if (typeof MutationObserver !== 'undefined' && !window.__ezoicWrapGuardInstalled) {
1533
- window.__ezoicWrapGuardInstalled = true;
1534
- var guardObserver = new MutationObserver(function() {
1535
- try {
1536
- Object.keys(__ezoicAnchorMap).forEach(function(k){
1537
- var w = __ezoicAnchorMap[k];
1538
- if (!w || !w.isConnected) return;
1539
- var anchor = w.getAttribute('data-ezoic-anchor') || '';
1540
- var m = anchor.match(/:(pid|tid):(.+)$/);
1541
- if (!m) return;
1542
- var val = m[2];
1543
- var anchorEl = document.querySelector('[data-pid="' + val + '"], [data-id="' + val + '"], [data-tid="' + val + '"], [data-topic-id="' + val + '"]');
1544
- if (anchorEl && w.previousElementSibling !== anchorEl) {
1545
- if (anchorEl.parentNode) anchorEl.parentNode.insertBefore(w, anchorEl.nextSibling);
1546
- }
1547
- });
1548
- } catch (e) {}
1549
- });
1550
- guardObserver.observe(document.body || document.documentElement, { childList: true, subtree: true });
1551
- }
1552
- } catch (e) {}