nodebb-plugin-ezoic-infinite 1.5.43 → 1.5.45
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 +1 -1
- package/public/client.js +16 -1
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -117,6 +117,7 @@ function mutationHasRelevantAddedNodes(mutations) {
|
|
|
117
117
|
pageKey: null,
|
|
118
118
|
cfg: null,
|
|
119
119
|
|
|
120
|
+
navSeq: 0,
|
|
120
121
|
// Full lists (never consumed) + cursors for round-robin reuse
|
|
121
122
|
allTopics: [],
|
|
122
123
|
allPosts: [],
|
|
@@ -762,6 +763,7 @@ function drainQueue() {
|
|
|
762
763
|
function startShow(id) {
|
|
763
764
|
if (!id || isBlocked()) return;
|
|
764
765
|
|
|
766
|
+
const seq = state.navSeq;
|
|
765
767
|
state.inflight++;
|
|
766
768
|
let released = false;
|
|
767
769
|
const release = () => {
|
|
@@ -799,6 +801,7 @@ function startShow(id) {
|
|
|
799
801
|
const doShow = () => {
|
|
800
802
|
// Re-check right before showing: the placeholder can disappear between
|
|
801
803
|
// scheduling and execution (ajaxify/infinite scroll DOM churn).
|
|
804
|
+
if (seq !== state.navSeq) { try { clearTimeout(hardTimer); } catch (e) {} release(); return; }
|
|
802
805
|
const phNow = document.getElementById(domId);
|
|
803
806
|
if (!phNow || !phNow.isConnected) {
|
|
804
807
|
try { clearTimeout(hardTimer); } catch (e) {}
|
|
@@ -812,7 +815,13 @@ function startShow(id) {
|
|
|
812
815
|
}
|
|
813
816
|
} catch (e) {}
|
|
814
817
|
|
|
815
|
-
|
|
818
|
+
// Let the DOM settle for one macrotask; NodeBB can reflow/replace nodes right after mutations.
|
|
819
|
+
setTimeout(() => {
|
|
820
|
+
if (seq !== state.navSeq) { return; }
|
|
821
|
+
const phFinal = document.getElementById(domId);
|
|
822
|
+
if (!phFinal || !phFinal.isConnected) { return; }
|
|
823
|
+
try { ez.showAds(id); } catch (e) {}
|
|
824
|
+
}, 0);
|
|
816
825
|
try { state.usedOnce && state.usedOnce.add(id); } catch (e) {}
|
|
817
826
|
|
|
818
827
|
setTimeout(() => { clearTimeout(hardTimer); release(); }, 650);
|
|
@@ -1075,6 +1084,12 @@ function startShow(id) {
|
|
|
1075
1084
|
function cleanup() {
|
|
1076
1085
|
blockedUntil = Date.now() + 1200;
|
|
1077
1086
|
|
|
1087
|
+
// invalidate any queued showAds from previous view
|
|
1088
|
+
state.navSeq++;
|
|
1089
|
+
state.inflight = 0;
|
|
1090
|
+
state.pending = [];
|
|
1091
|
+
state.pendingSet = new Set();
|
|
1092
|
+
|
|
1078
1093
|
// remove all wrappers
|
|
1079
1094
|
try {
|
|
1080
1095
|
withInternalDomChange(() => {
|