Mercurial > hg > isophonics-drupal-site
comparison core/modules/comment/js/comment-by-viewer.es6.js @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
1 /** | 1 /** |
2 * @file | 2 * @file |
3 * Attaches behaviors for the Comment module's "by-viewer" class. | 3 * Attaches behaviors for the Comment module's "by-viewer" class. |
4 */ | 4 */ |
5 | 5 |
6 (function ($, Drupal, drupalSettings) { | 6 (function($, Drupal, drupalSettings) { |
7 /** | 7 /** |
8 * Add 'by-viewer' class to comments written by the current user. | 8 * Add 'by-viewer' class to comments written by the current user. |
9 * | 9 * |
10 * @type {Drupal~behavior} | 10 * @type {Drupal~behavior} |
11 */ | 11 */ |
12 Drupal.behaviors.commentByViewer = { | 12 Drupal.behaviors.commentByViewer = { |
13 attach(context) { | 13 attach(context) { |
14 const currentUserID = parseInt(drupalSettings.user.uid, 10); | 14 const currentUserID = parseInt(drupalSettings.user.uid, 10); |
15 $('[data-comment-user-id]') | 15 $('[data-comment-user-id]') |
16 .filter(function () { | 16 .filter(function() { |
17 return parseInt(this.getAttribute('data-comment-user-id'), 10) === currentUserID; | 17 return ( |
18 parseInt(this.getAttribute('data-comment-user-id'), 10) === | |
19 currentUserID | |
20 ); | |
18 }) | 21 }) |
19 .addClass('by-viewer'); | 22 .addClass('by-viewer'); |
20 }, | 23 }, |
21 }; | 24 }; |
22 }(jQuery, Drupal, drupalSettings)); | 25 })(jQuery, Drupal, drupalSettings); |