nodebb-plugin-ezoic-infinite 0.5.2 → 0.5.3
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
CHANGED
package/plugin.json
CHANGED
package/public/admin.js
CHANGED
|
@@ -9,27 +9,18 @@
|
|
|
9
9
|
require(['settings', 'alerts'], function (Settings, alerts) {
|
|
10
10
|
Settings.load('ezoic-infinite', $form);
|
|
11
11
|
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
const $btn = $('#save');
|
|
15
|
-
$btn.prop('disabled', true);
|
|
12
|
+
$('#save').off('click.ezoicInfinite').on('click.ezoicInfinite', function (e) {
|
|
13
|
+
e.preventDefault();
|
|
16
14
|
|
|
17
|
-
// Settings.save signature differs slightly across versions; keep compatible
|
|
18
15
|
Settings.save('ezoic-infinite', $form, function () {
|
|
16
|
+
// Toast vert (NodeBB core)
|
|
19
17
|
if (alerts && typeof alerts.success === 'function') {
|
|
20
18
|
alerts.success('Enregistré');
|
|
21
19
|
} else if (window.app && typeof window.app.alertSuccess === 'function') {
|
|
22
20
|
window.app.alertSuccess('Enregistré');
|
|
23
21
|
}
|
|
24
|
-
$btn.prop('disabled', false);
|
|
25
22
|
});
|
|
26
|
-
|
|
27
|
-
// Fallback: re-enable even if callback not fired (mobile sometimes)
|
|
28
|
-
setTimeout(function () { $btn.prop('disabled', false); }, 4000);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
$form.off('submit.ezoicInfinite').on('submit.ezoicInfinite', doSave);
|
|
32
|
-
$('#save').off('click.ezoicInfinite').on('click.ezoicInfinite', doSave);
|
|
23
|
+
});
|
|
33
24
|
});
|
|
34
25
|
}
|
|
35
26
|
|
package/public/client.js
CHANGED
|
@@ -71,6 +71,7 @@ function makeAdMessageWrapper($targetPost, placeholderId) {
|
|
|
71
71
|
'</li>'
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
|
+
|
|
74
75
|
return (
|
|
75
76
|
'<div class="post ezoic-ad-post" data-ezoic-ad="1">' +
|
|
76
77
|
'<div class="content">' +
|
|
@@ -119,12 +120,7 @@ function insertAdMessagesBetweenReplies($posts, pool, interval) {
|
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
async function refreshAds() {
|
|
122
|
-
|
|
123
|
-
try {
|
|
124
|
-
cfg = await fetchConfig();
|
|
125
|
-
} catch (e) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
123
|
+
const cfg = await fetchConfig();
|
|
128
124
|
if (!cfg || cfg.excluded) return;
|
|
129
125
|
|
|
130
126
|
const betweenPool = parsePool(cfg.placeholderIds);
|
|
@@ -160,9 +156,8 @@ async function refreshAds() {
|
|
|
160
156
|
|
|
161
157
|
function debounceRefresh() {
|
|
162
158
|
clearTimeout(debounceTimer);
|
|
163
|
-
debounceTimer = setTimeout(refreshAds,
|
|
159
|
+
debounceTimer = setTimeout(refreshAds, 100);
|
|
164
160
|
}
|
|
165
161
|
|
|
166
|
-
$(document).ready(debounceRefresh);
|
|
167
162
|
$(window).on('action:ajaxify.end action:posts.loaded action:topic.loaded', debounceRefresh);
|
|
168
|
-
setTimeout(debounceRefresh,
|
|
163
|
+
setTimeout(debounceRefresh, 800);
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
<p class="form-text">Si l’utilisateur appartient à un de ces groupes, aucune pub n’est injectée.</p>
|
|
55
55
|
</div>
|
|
56
56
|
|
|
57
|
-
<button id="save"
|
|
57
|
+
<button id="save" class="btn btn-primary">Enregistrer</button>
|
|
58
58
|
</form>
|
|
59
59
|
</div>
|