@nodebb/nodebb-plugin-reactions 2.1.4 → 2.1.6
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 +1 -1
- package/public/client.js +23 -13
- package/scss/reactions.scss +3 -0
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -218,9 +218,6 @@ $(document).ready(function () {
|
|
|
218
218
|
function createReactionTooltips() {
|
|
219
219
|
require(['bootstrap', 'translator'], function (bootstrap, translator) {
|
|
220
220
|
async function createTooltip(data) {
|
|
221
|
-
if (!mouseOverReactionEl || !mouseOverReactionEl.length) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
221
|
const el = mouseOverReactionEl;
|
|
225
222
|
let usernames = data.usernames.filter(name => name !== '[[global:former_user]]');
|
|
226
223
|
if (!usernames.length) {
|
|
@@ -242,30 +239,43 @@ $(document).ready(function () {
|
|
|
242
239
|
animation: false,
|
|
243
240
|
})).show();
|
|
244
241
|
}
|
|
242
|
+
function clearTooltipTimeout() {
|
|
243
|
+
if (tooltipTimeoutId) {
|
|
244
|
+
clearTimeout(tooltipTimeoutId);
|
|
245
|
+
tooltipTimeoutId = 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
245
248
|
|
|
246
249
|
if (!utils.isTouchDevice()) {
|
|
247
250
|
$('#content').on('mouseenter', '.reaction', function () {
|
|
248
251
|
const $this = $(this);
|
|
249
252
|
mouseOverReactionEl = $this;
|
|
250
|
-
|
|
251
|
-
const pid = $this.attr('data-pid');
|
|
253
|
+
clearTooltipTimeout();
|
|
252
254
|
tooltipTimeoutId = setTimeout(async () => {
|
|
253
255
|
if (mouseOverReactionEl && mouseOverReactionEl.length) {
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
+
const pid = mouseOverReactionEl.attr('data-pid');
|
|
257
|
+
const mid = mouseOverReactionEl.attr('data-mid');
|
|
258
|
+
const type = pid ? 'post' : 'message';
|
|
259
|
+
const data = await socket.emit('plugins.reactions.getReactionUsernames', {
|
|
260
|
+
type: type,
|
|
256
261
|
mid: mid,
|
|
257
262
|
pid: pid,
|
|
258
|
-
reaction:
|
|
263
|
+
reaction: mouseOverReactionEl.attr('data-reaction'),
|
|
259
264
|
});
|
|
260
|
-
|
|
265
|
+
|
|
266
|
+
if (mouseOverReactionEl && mouseOverReactionEl.length &&
|
|
267
|
+
(
|
|
268
|
+
(type === 'post' && pid === mouseOverReactionEl.attr('data-pid')) ||
|
|
269
|
+
(type === 'message' && mid === mouseOverReactionEl.attr('data-mid'))
|
|
270
|
+
)
|
|
271
|
+
) {
|
|
272
|
+
createTooltip(data);
|
|
273
|
+
}
|
|
261
274
|
}
|
|
262
275
|
}, 200);
|
|
263
276
|
});
|
|
264
277
|
$('#content').on('mouseleave', '.reaction', function () {
|
|
265
|
-
|
|
266
|
-
clearTimeout(tooltipTimeoutId);
|
|
267
|
-
tooltipTimeoutId = 0;
|
|
268
|
-
}
|
|
278
|
+
clearTooltipTimeout();
|
|
269
279
|
mouseOverReactionEl = null;
|
|
270
280
|
const $this = $(this);
|
|
271
281
|
const tooltip = bootstrap.Tooltip.getInstance(this);
|