Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / comment / js / comment-by-viewer.js
1 /**
2  * @file
3  * Attaches behaviors for the Comment module's "by-viewer" class.
4  */
5
6 (function ($, Drupal, drupalSettings) {
7
8   'use strict';
9
10   /**
11    * Add 'by-viewer' class to comments written by the current user.
12    *
13    * @type {Drupal~behavior}
14    */
15   Drupal.behaviors.commentByViewer = {
16     attach: function (context) {
17       var currentUserID = parseInt(drupalSettings.user.uid, 10);
18       $('[data-comment-user-id]')
19         .filter(function () {
20           return parseInt(this.getAttribute('data-comment-user-id'), 10) === currentUserID;
21         })
22         .addClass('by-viewer');
23     }
24   };
25
26 })(jQuery, Drupal, drupalSettings);