nodebb-plugin-tenor-gif 4.0.0 → 4.1.0
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 +9 -0
- package/lib/controllers.js +3 -4
- package/library.js +6 -6
- package/package-lock.json +3643 -0
- package/package.json +9 -12
- package/plugin.json +4 -1
- package/static/images/klipy-powered.svg +65 -0
- package/static/lib/admin.js +1 -1
- package/static/lib/main.js +21 -30
- package/static/scss/modal.scss +8 -0
- package/static/templates/plugins/tenor-gif/modal.tpl +1 -1
- package/websockets.js +1 -1
- package/.eslintignore +0 -20
- package/.eslintrc +0 -3
- package/static/lib/.eslintrc +0 -3
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-tenor-gif",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/julianlam/nodebb-plugin-tenor-gif"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"lint": "eslint ."
|
|
12
|
+
},
|
|
10
13
|
"keywords": [
|
|
11
14
|
"nodebb",
|
|
12
15
|
"plugin"
|
|
@@ -21,21 +24,15 @@
|
|
|
21
24
|
},
|
|
22
25
|
"readmeFilename": "README.md",
|
|
23
26
|
"nbbpm": {
|
|
24
|
-
"compatibility": "^4.
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@commitlint/cli": "^9.1.2",
|
|
28
|
-
"eslint": "8.x",
|
|
29
|
-
"lint-staged": "^13.0.3"
|
|
27
|
+
"compatibility": "^4.14.0"
|
|
30
28
|
},
|
|
29
|
+
"dependencies": {},
|
|
31
30
|
"devDependencies": {
|
|
32
31
|
"@commitlint/cli": "^9.1.2",
|
|
33
32
|
"@commitlint/config-angular": "^7.1.2",
|
|
34
|
-
"eslint": "
|
|
35
|
-
"eslint-config-
|
|
36
|
-
"eslint-config-nodebb": "0.1.1",
|
|
37
|
-
"eslint-plugin-import": "2.x",
|
|
33
|
+
"eslint": "10.5.0",
|
|
34
|
+
"eslint-config-nodebb": "2.0.3",
|
|
38
35
|
"husky": "^2.4.0",
|
|
39
|
-
"lint-staged": "^
|
|
36
|
+
"lint-staged": "^13.0.3"
|
|
40
37
|
}
|
|
41
38
|
}
|
package/plugin.json
CHANGED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 28.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 640 107.3" style="enable-background:new 0 0 640 107.3;" xml:space="preserve">
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
.st0{opacity:0.4;}
|
|
7
|
+
.st1{fill:#F7DC3C;}
|
|
8
|
+
.st2{fill:#EE4523;}
|
|
9
|
+
</style>
|
|
10
|
+
<g>
|
|
11
|
+
<g>
|
|
12
|
+
<g>
|
|
13
|
+
<path d="M498.7,107.1h-16.5c-1.9,0-3.3-1.5-3.3-3.3V33.1c0-1.9,1.5-3.3,3.3-3.3h16.5c1.9,0,3.3,1.5,3.3,3.3v70.6
|
|
14
|
+
C502.1,105.7,500.7,107.1,498.7,107.1z"/>
|
|
15
|
+
<path d="M441.4,83.4V33.1c0-1.9-1.5-3.3-3.3-3.3h-16.5c-1.9,0-3.3,1.5-3.3,3.3v53.7v17c0,1.9,1.5,3.3,3.3,3.3h19.7h29.3
|
|
16
|
+
c1.9,0,3.3-1.5,3.3-3.3V90.1c0-1.9-1.5-3.3-3.3-3.3h-25.9C442.9,86.7,441.4,85.4,441.4,83.4z"/>
|
|
17
|
+
<path d="M539.2,29.8c-0.8,0-2.6,0-2.7,0h-8.2h-18.1c-1.9,0-3.3,1.5-3.3,3.3v70.6c0,1.9,1.5,3.3,3.3,3.3h16.5
|
|
18
|
+
c1.9,0,3.3-1.5,3.3-3.3V84.3c0-0.6,0.6-1,1-0.8c8.3,2.4,19,2.6,28.4-6.6C579.4,56.9,560.7,29.8,539.2,29.8z M545,63.7
|
|
19
|
+
c-8.8,6.3-18.6-3.5-12.3-12.3c0.2-0.3,0.5-0.6,0.8-0.8c8.8-6.3,18.6,3.5,12.3,12.3C545.5,63.2,545.2,63.5,545,63.7z"/>
|
|
20
|
+
<path d="M639.1,42l-11.3-11.3c-1.3-1.3-3.3-1.3-4.7,0l-18.1,18.1c-0.5,0.5-1.4,0.5-1.8,0l-18.1-18.1c-1.3-1.3-3.3-1.3-4.7,0
|
|
21
|
+
L569.3,42c-1.3,1.3-1.3,3.3,0,4.7l23.2,23.2c0.2,0.2,0.3,0.6,0.3,0.9v33.1c0,1.8,1.5,3.2,3.2,3.2h16.1c1.8,0,3.2-1.5,3.2-3.2v-33
|
|
22
|
+
c0-0.3,0.1-0.7,0.3-0.9l23.2-23.2C640.3,45.4,640.3,43.3,639.1,42z"/>
|
|
23
|
+
</g>
|
|
24
|
+
</g>
|
|
25
|
+
<g class="st0">
|
|
26
|
+
<path d="M23,54.1c2,2,3,4.7,3,8.1c0,2.3-0.5,4.4-1.4,6c-0.9,1.7-2.3,2.9-4,3.8c-1.7,0.8-3.6,1.4-5.8,1.4h-8v12.5H0V51.2h14.9
|
|
27
|
+
C18.3,51.2,21,52.1,23,54.1z M14.1,67.2c1.5,0,2.6-0.5,3.5-1.4c0.9-0.8,1.4-2.1,1.4-3.6c0-1.7-0.5-2.9-1.4-3.7
|
|
28
|
+
c-0.9-0.8-2.2-1.4-3.5-1.4H6.9v10.1L14.1,67.2L14.1,67.2z"/>
|
|
29
|
+
<path d="M56.9,52.8c2.7,1.5,4.8,3.5,6.4,6.2s2.3,5.8,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4h-7v9.9L164.3,67.1L164.3,67.1z"/>
|
|
39
|
+
<path d="M190,65h13.3v6H190v8.7h15.3v6.1h-22.2V51.2h22.1v6H190L190,65L190,65z"/>
|
|
40
|
+
<path d="M234,53.1c2.6,1.4,4.7,3.4,6.1,6c1.5,2.6,2.3,5.6,2.3,9.3s-0.8,6.7-2.3,9.3c-1.5,2.6-3.5,4.6-6.1,6
|
|
41
|
+
c-2.6,1.4-5.6,2.1-8.9,2.1H211V51.2h14.2C228.5,51.2,231.5,51.8,234,53.1z M225.3,79.9c3.2,0,5.6-1,7.5-2.9c1.9-2,2.8-4.8,2.8-8.4
|
|
42
|
+
c0-3.7-0.9-6.6-2.8-8.4c-1.9-2-4.4-2.9-7.5-2.9h-7.4v22.8L225.3,79.9L225.3,79.9z"/>
|
|
43
|
+
<path d="M281,53.6c2,1.7,2.9,4.1,2.9,7.2c0,1.6-0.3,2.9-0.8,4.1c-0.6,1.1-1.4,2.1-2.3,2.8c1.4,0.6,2.4,1.6,3.2,3
|
|
44
|
+
c0.8,1.4,1.4,3.1,1.4,5.2c0,3.2-1,5.7-3,7.5s-4.7,2.6-8.1,2.6h-15.4V51.2h14.4C276.4,51.2,279,51.9,281,53.6z M272.8,65.1
|
|
45
|
+
c1.2,0,2.3-0.3,3-0.9c0.7-0.6,1.1-1.7,1.1-2.9c0-1.4-0.4-2.3-1.2-3c-0.8-0.7-2-1-3.3-1h-6.7v7.8H272.8L272.8,65.1z M273.3,79.7
|
|
46
|
+
c1.6,0,2.7-0.4,3.6-1.1c0.9-0.7,1.4-1.8,1.4-3.2c0-1.5-0.5-2.6-1.4-3.2c-0.8-0.7-2-1.1-3.5-1.1h-7.8v8.7L273.3,79.7L273.3,79.7z"
|
|
47
|
+
/>
|
|
48
|
+
<path d="M300.4,85.7V72.3L287.2,51h8l8.6,14.5l8.7-14.4h8l-13.1,21.3v13.4L300.4,85.7L300.4,85.7z"/>
|
|
49
|
+
</g>
|
|
50
|
+
<g>
|
|
51
|
+
<g>
|
|
52
|
+
<g>
|
|
53
|
+
<path class="st1" d="M407.6,104.3L385,69.4c-0.4-0.7-0.4-1.4,0-2l21.2-34.9c0.8-1.3-0.1-3-1.7-3l-13.4,3
|
|
54
|
+
c-10.6,2.4-13.8,8.6-20.2,17.5c-1.2,1.7-2,2.9-2,2.9c-1,1.8-3.7,1.1-3.7-1V23.2c-8.1,0-12.4,3-15.6,5.7
|
|
55
|
+
c-10.2,8.4-12.4,18.8-12.4,32v44.4c0,1.1,0.9,2,2,2h24.2c1.1,0,2-0.9,2-2V83.2c0-2,2.6-2.7,3.6-1l8.2,24.2c0.4,0.7,1,1,1.7,1
|
|
56
|
+
h27.2C407.5,107.2,408.5,105.5,407.6,104.3z M359.7,33.4c-1.5,0-2.7-1.2-2.7-2.7s1.2-2.7,2.7-2.7c1.5,0,2.7,1.2,2.7,2.7
|
|
57
|
+
C362.3,32.3,361.2,33.4,359.7,33.4z"/>
|
|
58
|
+
</g>
|
|
59
|
+
<path class="st2" d="M333.8,48.8c0.2,0.6,2.1-29.7,31.7-30c0,0-24-28.2-32.9-15.6c0,0-4.4,6.9,4.1,9.1c0,0-13.7,3.6-13.5,13.1
|
|
60
|
+
c0.1,3,3.1,4.9,5.9,3.7c1.6-0.7,3.6-2,6.2-4.4C335.3,24.6,329.3,36.7,333.8,48.8z"/>
|
|
61
|
+
</g>
|
|
62
|
+
<path class="st2" d="M368.5,24.4v7.4c0,0.6,0.6,0.9,1,0.6l7.1-4.7l-7.1-3.8C369,23.6,368.5,23.9,368.5,24.4z"/>
|
|
63
|
+
</g>
|
|
64
|
+
</g>
|
|
65
|
+
</svg>
|
package/static/lib/admin.js
CHANGED
package/static/lib/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
$(document).ready(function () {
|
|
4
|
-
|
|
4
|
+
const Tenor = {};
|
|
5
5
|
|
|
6
6
|
$(window).on('action:composer.enhanced', function () {
|
|
7
7
|
Tenor.prepareFormattingTools();
|
|
@@ -60,15 +60,15 @@ $(document).ready(function () {
|
|
|
60
60
|
$.Redactor.prototype['tenor-gif'] = function () {
|
|
61
61
|
return {
|
|
62
62
|
init: function () {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const self = this;
|
|
64
|
+
const button = self.button.add('tenor-gif', 'Insert GIF');
|
|
65
65
|
self.button.setIcon(button, '<i class="fa fa-tenor-gif"></i>');
|
|
66
66
|
self.button.addCallback(button, self['tenor-gif'].onClick);
|
|
67
67
|
},
|
|
68
68
|
onClick: function () {
|
|
69
|
-
|
|
69
|
+
const self = this;
|
|
70
70
|
Tenor.showModal(function (url, query) {
|
|
71
|
-
|
|
71
|
+
let code = self.code.get();
|
|
72
72
|
code += '<p><img src="' + url + '" alt="' + query + '" /></p>';
|
|
73
73
|
|
|
74
74
|
self.code.set(code);
|
|
@@ -89,18 +89,17 @@ $(document).ready(function () {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
Tenor.showModal = function (callback) {
|
|
92
|
-
require(['
|
|
93
|
-
Benchpress.parse('plugins/tenor-gif/modal', {}, function (html) {
|
|
94
|
-
|
|
92
|
+
require(['benchpress', 'modals'], function (Benchpress, modals) {
|
|
93
|
+
Benchpress.parse('plugins/tenor-gif/modal', {}, async function (html) {
|
|
94
|
+
const modal = await modals.dialog({
|
|
95
95
|
title: 'Insert GIF',
|
|
96
96
|
message: html,
|
|
97
97
|
className: 'tenor-gif-modal',
|
|
98
98
|
onEscape: true,
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var queryTimeout;
|
|
101
|
+
const queryEl = modal.find('#gif-query');
|
|
102
|
+
const resultsEl = modal.find('#gif-results');
|
|
104
103
|
|
|
105
104
|
modal.on('shown.bs.modal', function () {
|
|
106
105
|
queryEl.focus();
|
|
@@ -113,25 +112,17 @@ $(document).ready(function () {
|
|
|
113
112
|
});
|
|
114
113
|
});
|
|
115
114
|
|
|
116
|
-
queryEl.on('keyup', function () {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
115
|
+
queryEl.on('keyup', utils.debounce(function () {
|
|
116
|
+
socket.emit('plugins.tenor-gif.query', {
|
|
117
|
+
query: queryEl.val(),
|
|
118
|
+
}, function (err, gifs) {
|
|
119
|
+
if (err) {
|
|
120
|
+
resultsEl.addClass('alert alert-warning').translateText(err.message);
|
|
121
|
+
}
|
|
120
122
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}, function (err, gifs) {
|
|
125
|
-
if (err) {
|
|
126
|
-
return translator.translate(err.message, function (translated) {
|
|
127
|
-
resultsEl.addClass('alert alert-warning').text(translated);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
Tenor.populateDOM(resultsEl, gifs);
|
|
132
|
-
});
|
|
133
|
-
}, 250);
|
|
134
|
-
});
|
|
123
|
+
Tenor.populateDOM(resultsEl, gifs);
|
|
124
|
+
});
|
|
125
|
+
}, 300));
|
|
135
126
|
|
|
136
127
|
resultsEl.on('click', 'img[data-url]', function () {
|
|
137
128
|
callback(this.getAttribute('data-url'), queryEl.val(), this.getAttribute('alt'));
|
|
@@ -155,7 +146,7 @@ $(document).ready(function () {
|
|
|
155
146
|
textarea, selectionStart + alt.length + 4, selectionEnd + alt.length + url.length + 4
|
|
156
147
|
);
|
|
157
148
|
} else {
|
|
158
|
-
|
|
149
|
+
const wrapDelta = controls.wrapSelectionInTextareaWith(textarea, '');
|
|
159
150
|
controls.updateTextareaSelection(
|
|
160
151
|
textarea, selectionEnd + 4 - wrapDelta[1], selectionEnd + url.length + 4 - wrapDelta[1]
|
|
161
152
|
);
|
package/static/scss/modal.scss
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
.tenor-gif-modal {
|
|
2
|
+
#gif-query {
|
|
3
|
+
padding-right: 170px;
|
|
4
|
+
background-image: url('/assets/plugins/nodebb-plugin-tenor-gif/images/klipy-powered.svg');
|
|
5
|
+
background-repeat: no-repeat;
|
|
6
|
+
background-position: right 8px center;
|
|
7
|
+
background-size: 150px auto;
|
|
8
|
+
}
|
|
9
|
+
|
|
2
10
|
#gif-results {
|
|
3
11
|
overflow-x: auto;
|
|
4
12
|
white-space: nowrap;
|
package/websockets.js
CHANGED
package/.eslintignore
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
node_modules/
|
|
2
|
-
*.sublime-project
|
|
3
|
-
*.sublime-workspace
|
|
4
|
-
.project
|
|
5
|
-
.vagrant
|
|
6
|
-
.DS_Store
|
|
7
|
-
logs/
|
|
8
|
-
/public/templates
|
|
9
|
-
/public/uploads
|
|
10
|
-
/public/sounds
|
|
11
|
-
/public/vendor
|
|
12
|
-
/public/src/modules/string.js
|
|
13
|
-
.idea/
|
|
14
|
-
.vscode/
|
|
15
|
-
*.ipr
|
|
16
|
-
*.iws
|
|
17
|
-
/coverage
|
|
18
|
-
/build
|
|
19
|
-
.eslintrc
|
|
20
|
-
test/files
|
package/.eslintrc
DELETED
package/static/lib/.eslintrc
DELETED