nodebb-plugin-audio-embed 2.0.1 → 3.0.1
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/eslint.config.mjs +10 -0
- package/lib/controllers.js +61 -14
- package/library.js +72 -97
- package/package-lock.json +1127 -0
- package/package.json +10 -5
- package/static/lib/admin.js +7 -8
- package/static/lib/main.js +12 -13
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-audio-embed",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/julianlam/nodebb-plugin-audio-embed"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"lint": "eslint ."
|
|
12
|
+
},
|
|
10
13
|
"keywords": [
|
|
11
14
|
"nodebb",
|
|
12
15
|
"plugin"
|
|
@@ -21,11 +24,13 @@
|
|
|
21
24
|
},
|
|
22
25
|
"readmeFilename": "README.md",
|
|
23
26
|
"nbbpm": {
|
|
24
|
-
"compatibility": "^
|
|
27
|
+
"compatibility": "^4.14.0"
|
|
25
28
|
},
|
|
26
29
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
"mkdirp": "^3.0.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"eslint": "10.6.0",
|
|
34
|
+
"eslint-config-nodebb": "^2.0.3"
|
|
30
35
|
}
|
|
31
36
|
}
|
package/static/lib/admin.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* globals $, app, socket, define */
|
|
3
2
|
|
|
4
|
-
define('admin/plugins/audio-embed', ['settings', 'alerts'], function(Settings, alerts) {
|
|
3
|
+
define('admin/plugins/audio-embed', ['settings', 'alerts'], function (Settings, alerts) {
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
const ACP = {};
|
|
7
6
|
|
|
8
|
-
ACP.init = function() {
|
|
7
|
+
ACP.init = function () {
|
|
9
8
|
Settings.load('audio-embed', $('.audio-embed-settings'));
|
|
10
9
|
|
|
11
|
-
$('#save').on('click', function() {
|
|
12
|
-
Settings.save('audio-embed', $('.audio-embed-settings'), function() {
|
|
10
|
+
$('#save').on('click', function () {
|
|
11
|
+
Settings.save('audio-embed', $('.audio-embed-settings'), function () {
|
|
13
12
|
alerts.alert({
|
|
14
13
|
type: 'success',
|
|
15
14
|
alert_id: 'audio-embed-saved',
|
|
16
15
|
title: 'Settings Saved',
|
|
17
16
|
message: 'Please reload your NodeBB to apply these settings',
|
|
18
|
-
clickfn: function() {
|
|
17
|
+
clickfn: function () {
|
|
19
18
|
socket.emit('admin.reload');
|
|
20
|
-
}
|
|
19
|
+
},
|
|
21
20
|
});
|
|
22
21
|
});
|
|
23
22
|
});
|
package/static/lib/main.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
/* globals $, require */
|
|
1
|
+
'use strict';
|
|
3
2
|
|
|
4
|
-
$(document).ready(function() {
|
|
3
|
+
$(document).ready(function () {
|
|
5
4
|
function upload(callback) {
|
|
6
5
|
require(['uploader'], function (uploader) {
|
|
7
6
|
uploader.show({
|
|
8
7
|
title: 'Upload Audio',
|
|
9
8
|
description: 'Upload an audio file for embedding into your post',
|
|
10
|
-
route: config.relative_path + '/plugins/nodebb-plugin-audio-embed/upload'
|
|
9
|
+
route: config.relative_path + '/plugins/nodebb-plugin-audio-embed/upload',
|
|
11
10
|
}, callback);
|
|
12
11
|
});
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
$(window).on('action:composer.loaded', function (
|
|
16
|
-
require(['composer/formatting', 'composer/controls'], function(formatting, controls) {
|
|
14
|
+
$(window).on('action:composer.loaded', function () {
|
|
15
|
+
require(['composer/formatting', 'composer/controls'], function (formatting, controls) {
|
|
17
16
|
if (formatting && controls) {
|
|
18
|
-
formatting.addButtonDispatch('audio-embed', function(textarea
|
|
17
|
+
formatting.addButtonDispatch('audio-embed', function (textarea) {
|
|
19
18
|
upload(function (id) {
|
|
20
19
|
controls.insertIntoTextarea(textarea, '[audio/' + id + ']');
|
|
21
20
|
controls.updateTextareaSelection(textarea, id.length + 8, id.length + 8);
|
|
@@ -29,33 +28,33 @@ $(document).ready(function() {
|
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
30
|
|
|
32
|
-
$(window).on('action:redactor.load', function() {
|
|
31
|
+
$(window).on('action:redactor.load', function () {
|
|
33
32
|
$.Redactor.prototype['audio-embed'] = function () {
|
|
34
33
|
return {
|
|
35
34
|
init: function () {
|
|
36
|
-
|
|
35
|
+
const self = this;
|
|
37
36
|
|
|
38
37
|
// require translator as such because it was undefined without it
|
|
39
38
|
require(['translator'], function (translator) {
|
|
40
39
|
translator.translate('Embed Audio', function (translated) {
|
|
41
|
-
|
|
40
|
+
const button = self.button.add('audio-embed', translated);
|
|
42
41
|
self.button.setIcon(button, '<i class="fa fa-file-audio-o"></i>');
|
|
43
42
|
self.button.addCallback(button, self['audio-embed'].onClick);
|
|
44
43
|
});
|
|
45
44
|
});
|
|
46
45
|
},
|
|
47
46
|
onClick: function () {
|
|
48
|
-
|
|
47
|
+
const self = this;
|
|
49
48
|
upload(function (id) {
|
|
50
49
|
require(['benchpress'], (Benchpress) => {
|
|
51
50
|
Benchpress.parse('partials/audio-embed', {
|
|
52
|
-
path: config.relative_path + '/uploads/audio-embed/' + id
|
|
51
|
+
path: config.relative_path + '/uploads/audio-embed/' + id,
|
|
53
52
|
}, function (html) {
|
|
54
53
|
self.insert.html(html);
|
|
55
54
|
});
|
|
56
55
|
});
|
|
57
56
|
});
|
|
58
|
-
}
|
|
57
|
+
},
|
|
59
58
|
};
|
|
60
59
|
};
|
|
61
60
|
});
|