nodebb-plugin-discord-onekite 1.1.21 → 1.1.23
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/README.md +6 -9
- package/package.json +1 -1
- package/plugin.json +4 -1
- package/static/lib/admin.js +12 -32
- package/templates/admin/plugins/discord-onekite.tpl +4 -9
package/README.md
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
# nodebb-plugin-discord-onekite v1.1.4.
|
|
1
|
+
# nodebb-plugin-discord-onekite v1.1.4.13
|
|
2
2
|
|
|
3
|
-
ACP:
|
|
4
|
-
- Uses
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
Discord:
|
|
10
|
-
- Same as v1.1.4.10 line (embed only, message in embed description).
|
|
3
|
+
Fixes ACP not applying JS / not persisting:
|
|
4
|
+
- Uses `acpScripts` + modules key `admin/plugins/discord-onekite.js` to ensure admin script loads.
|
|
5
|
+
- Removes bottom-right save button partial; uses only the top "Enregistrer les paramètres" button.
|
|
6
|
+
- Persists categories via hidden CSV field `data-field="cids"`.
|
|
7
|
+
- Toast uses title "Succès" and message "Paramètres enregistrés".
|
package/package.json
CHANGED
package/plugin.json
CHANGED
package/static/lib/admin.js
CHANGED
|
@@ -4,32 +4,28 @@
|
|
|
4
4
|
define('admin/plugins/discord-onekite', ['settings'], function (settings) {
|
|
5
5
|
const ACP = {};
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function parseCsv(v) {
|
|
8
|
+
if (!v) return [];
|
|
9
|
+
return String(v).split(',').map(s => s.trim()).filter(Boolean);
|
|
10
|
+
}
|
|
11
|
+
function toCsv(arr) {
|
|
12
|
+
return (arr || []).map(String).filter(Boolean).join(',');
|
|
9
13
|
}
|
|
10
|
-
|
|
11
14
|
function setSelectedCids(cids) {
|
|
12
15
|
const set = new Set((cids || []).map(String));
|
|
13
16
|
$('#cidsMulti option').each(function () {
|
|
14
17
|
$(this).prop('selected', set.has(String($(this).val())));
|
|
15
18
|
});
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (!v) return [];
|
|
20
|
-
if (Array.isArray(v)) return v.map(String).filter(Boolean);
|
|
21
|
-
return String(v).split(',').map(s => s.trim()).filter(Boolean);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function toCsv(arr) {
|
|
25
|
-
return (arr || []).map(String).filter(Boolean).join(',');
|
|
20
|
+
function getSelectedCids() {
|
|
21
|
+
return $('#cidsMulti option:selected').map(function () { return String($(this).val()); }).get();
|
|
26
22
|
}
|
|
27
23
|
|
|
28
24
|
function toastSuccess() {
|
|
29
25
|
if (window.app && typeof app.alert === 'function') {
|
|
30
26
|
app.alert({ type: 'success', title: 'Succès', message: 'Paramètres enregistrés' });
|
|
31
27
|
} else if (window.app && typeof app.alertSuccess === 'function') {
|
|
32
|
-
app.alertSuccess('Paramètres enregistrés');
|
|
28
|
+
app.alertSuccess('Succès: Paramètres enregistrés');
|
|
33
29
|
}
|
|
34
30
|
}
|
|
35
31
|
|
|
@@ -37,32 +33,16 @@ define('admin/plugins/discord-onekite', ['settings'], function (settings) {
|
|
|
37
33
|
const $form = $('.discord-onekite-settings');
|
|
38
34
|
if (!$form.length) return;
|
|
39
35
|
|
|
40
|
-
// Sync settings into form fields (data-field)
|
|
41
36
|
settings.sync('discord-onekite', $form, function () {
|
|
42
|
-
|
|
43
|
-
const csv = $('#cids').val();
|
|
44
|
-
setSelectedCids(parseCsv(csv));
|
|
37
|
+
setSelectedCids(parseCsv($('#cids').val()));
|
|
45
38
|
});
|
|
46
39
|
|
|
47
|
-
function
|
|
48
|
-
|
|
40
|
+
$('#onekite-save').off('click.discordOnekite').on('click.discordOnekite', function (e) {
|
|
41
|
+
e.preventDefault();
|
|
49
42
|
$('#cids').val(toCsv(getSelectedCids()));
|
|
50
|
-
|
|
51
43
|
settings.persist('discord-onekite', $form, function () {
|
|
52
44
|
toastSuccess();
|
|
53
45
|
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// bottom-right save button has id #save (from partial)
|
|
57
|
-
$('#save').off('click.discordOnekite').on('click.discordOnekite', function (e) {
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
persist();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// top button
|
|
63
|
-
$('#save-top').off('click.discordOnekite').on('click.discordOnekite', function (e) {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
persist();
|
|
66
46
|
});
|
|
67
47
|
};
|
|
68
48
|
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
<h4 class="mb-1">Discord Onekite</h4>
|
|
5
5
|
<p class="text-muted mb-0">Notifications Discord via webhook.</p>
|
|
6
6
|
</div>
|
|
7
|
-
<button id="save
|
|
7
|
+
<button id="onekite-save" type="button" class="btn btn-primary">Enregistrer les paramètres</button>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<form role="form" class="discord-onekite-settings">
|
|
11
11
|
<div class="mb-3">
|
|
12
12
|
<label class="form-label" for="webhookUrl">Discord Webhook URL</label>
|
|
13
|
-
<input type="text" class="form-control" id="webhookUrl"
|
|
13
|
+
<input type="text" class="form-control" id="webhookUrl" data-key="webhookUrl" value="{settings.webhookUrl}" placeholder="https://discord.com/api/webhooks/..." />
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
16
|
<div class="form-check mb-3">
|
|
17
|
-
<input class="form-check-input" type="checkbox" id="notifyReplies"
|
|
17
|
+
<input class="form-check-input" type="checkbox" id="notifyReplies" data-key="notifyReplies" <!-- IF settings.notifyReplies -->checked<!-- ENDIF settings.notifyReplies -->>
|
|
18
18
|
<label class="form-check-label" for="notifyReplies">
|
|
19
19
|
Notifier aussi les réponses (si décoché : uniquement les nouveaux sujets)
|
|
20
20
|
</label>
|
|
@@ -23,22 +23,17 @@
|
|
|
23
23
|
<div class="mb-3">
|
|
24
24
|
<label class="form-label" for="cidsMulti">Catégories à notifier</label>
|
|
25
25
|
|
|
26
|
-
<!-- UI multi-select (not directly persisted) -->
|
|
27
26
|
<select class="form-select" id="cidsMulti" multiple size="12">
|
|
28
27
|
<!-- BEGIN categories -->
|
|
29
28
|
<option value="{categories.cid}" <!-- IF categories.selected -->selected<!-- ENDIF categories.selected -->>{categories.name}</option>
|
|
30
29
|
<!-- END categories -->
|
|
31
30
|
</select>
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
<input type="hidden" id="cids" name="cids" data-field="cids" value="{settings.cids}" />
|
|
32
|
+
<input type="hidden" id="cids" data-key="cids" value="{settings.cids}" />
|
|
35
33
|
|
|
36
34
|
<p class="form-text text-muted">
|
|
37
35
|
Si aucune catégorie n’est sélectionnée : <strong>toutes les catégories</strong> seront notifiées.
|
|
38
36
|
</p>
|
|
39
37
|
</div>
|
|
40
|
-
|
|
41
|
-
<!-- Bottom-right official save button -->
|
|
42
|
-
<!-- IMPORT admin/partials/save_button.tpl -->
|
|
43
38
|
</form>
|
|
44
39
|
</div>
|