Mercurial > hg > cmmr2012-drupal-site
view core/modules/comment/js/comment-by-viewer.es6.js @ 2:5311817fb629
Theme updates
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 13:19:18 +0000 |
parents | c75dbcec494b |
children | a9cd425dd02b |
line wrap: on
line source
/** * @file * Attaches behaviors for the Comment module's "by-viewer" class. */ (function ($, Drupal, drupalSettings) { /** * Add 'by-viewer' class to comments written by the current user. * * @type {Drupal~behavior} */ Drupal.behaviors.commentByViewer = { attach(context) { const currentUserID = parseInt(drupalSettings.user.uid, 10); $('[data-comment-user-id]') .filter(function () { return parseInt(this.getAttribute('data-comment-user-id'), 10) === currentUserID; }) .addClass('by-viewer'); }, }; }(jQuery, Drupal, drupalSettings));