nodebb-plugin-ezoic-infinite 0.9.4 → 0.9.5
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 +26 -1
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -249,4 +249,29 @@ function debounceRefresh() {
|
|
|
249
249
|
|
|
250
250
|
$(document).ready(debounceRefresh);
|
|
251
251
|
$(window).on('action:ajaxify.end action:posts.loaded action:topic.loaded', debounceRefresh);
|
|
252
|
-
setTimeout(debounceRefresh, 1800);
|
|
252
|
+
setTimeout(debounceRefresh, 1800); function removeExistingPlaceholder(id) {
|
|
253
|
+
const el = document.getElementById('ezoic-pub-ad-placeholder-' + id);
|
|
254
|
+
if (!el) return;
|
|
255
|
+
const wrap = el.closest('.ezoic-ad');
|
|
256
|
+
if (wrap) {
|
|
257
|
+
try { $(wrap).remove(); } catch (e) { wrap.remove(); }
|
|
258
|
+
} else {
|
|
259
|
+
el.remove();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function preDestroyPools() {
|
|
264
|
+
try {
|
|
265
|
+
const poolA = parsePool(settings && settings.placeholderIds);
|
|
266
|
+
const poolB = parsePool(settings && settings.messagePlaceholderIds);
|
|
267
|
+
const ids = Array.from(new Set([].concat(poolA, poolB)));
|
|
268
|
+
if (!ids.length) return;
|
|
269
|
+
ids.forEach(function (id) {
|
|
270
|
+
// If Ezoic has already defined the placeholder in this SPA session, destroy it before we re-use it
|
|
271
|
+
destroyPlaceholder(id);
|
|
272
|
+
removeExistingPlaceholder(id);
|
|
273
|
+
});
|
|
274
|
+
} catch (e) {}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
|