1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | define('admin/plugins/emoji', [], function () {
|
8 | $('#save').on('click', function () {
|
9 | var settings = {
|
10 | parseAscii: !!$('#emoji-parseAscii').prop('checked'),
|
11 | parseNative: !!$('#emoji-parseNative').prop('checked'),
|
12 | customFirst: !!$('#emoji-customFirst').prop('checked'),
|
13 | };
|
14 | $.get(window.config.relative_path + '/api/admin/plugins/emoji/save', { settings: JSON.stringify(settings) }, function () {
|
15 | window.app.alertSuccess();
|
16 | });
|
17 | });
|
18 |
|
19 | $('#build').on('click', function () {
|
20 | $.get(window.config.relative_path + '/api/admin/plugins/emoji/build', function () {
|
21 | window.app.alertSuccess();
|
22 | });
|
23 | });
|
24 |
|
25 | require.config({
|
26 | shim: {
|
27 | preact: {
|
28 | exports: 'preact',
|
29 | },
|
30 | },
|
31 | });
|
32 |
|
33 | var addedStyle = false;
|
34 | $('#edit').click(function () {
|
35 | require(['custom-emoji'], function (customEmoji) {
|
36 | customEmoji.init(document.getElementById('editModalBody'), function () {
|
37 | $('#editModal').modal({
|
38 | backdrop: false,
|
39 | show: true,
|
40 | });
|
41 | });
|
42 | });
|
43 | if (!addedStyle) {
|
44 | addedStyle = true;
|
45 | $('head').append(
|
46 | '<style>@import "' + window.config.relative_path + '/plugins/nodebb-plugin-emoji/emoji/styles.css";</style>'
|
47 | );
|
48 | }
|
49 | });
|
50 | });
|