@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodebb/nodebb-plugin-reactions",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "nbbpm": {
5
5
  "compatibility": "^3.3.0"
6
6
  },
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
- const mid = $this.attr('data-mid');
251
- const pid = $this.attr('data-pid');
253
+ clearTooltipTimeout();
252
254
  tooltipTimeoutId = setTimeout(async () => {
253
255
  if (mouseOverReactionEl && mouseOverReactionEl.length) {
254
- const d = await socket.emit('plugins.reactions.getReactionUsernames', {
255
- type: pid ? 'post' : 'message',
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: $this.attr('data-reaction'),
263
+ reaction: mouseOverReactionEl.attr('data-reaction'),
259
264
  });
260
- createTooltip(d);
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
- if (tooltipTimeoutId) {
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);
@@ -16,6 +16,9 @@
16
16
  &.reacted {
17
17
  border: 1px solid var(--bs-primary);
18
18
  }
19
+ &:hover {
20
+ background-color: var(--bs-primary-bg-subtle);
21
+ }
19
22
  .reaction-emoji-count {
20
23
  margin-left: 5px;
21
24
  &:before {