summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/comment/js/comment-by-viewer.js
diff options
context:
space:
mode:
authorcatch <catch@35733.no-reply.drupal.org>2022-09-09 07:26:42 +0100
committercatch <catch@35733.no-reply.drupal.org>2022-09-09 07:26:42 +0100
commit8aa8ce1ffbcca9c727f46e58c714e1d351f7ef88 (patch)
tree27be6908992c340ba0b4c0bd3f4339670aa71e90 /core/modules/comment/js/comment-by-viewer.js
parent09f8f13d8a72b8e482cc689fcd10f023df41b899 (diff)
downloaddrupal-8aa8ce1ffbcca9c727f46e58c714e1d351f7ef88.tar.gz
drupal-8aa8ce1ffbcca9c727f46e58c714e1d351f7ef88.zip
Issue #3278415 by nod_, lauriii, catch, Wim Leers, longwave, xjm, claudiu.cristea: Remove usages of the JavaScript ES6 build step, the build step itself, and associated dev dependencies
Diffstat (limited to 'core/modules/comment/js/comment-by-viewer.js')
-rw-r--r--core/modules/comment/js/comment-by-viewer.js29
1 files changed, 18 insertions, 11 deletions
diff --git a/core/modules/comment/js/comment-by-viewer.js b/core/modules/comment/js/comment-by-viewer.js
index 3f47ceeaab27..261c818192ac 100644
--- a/core/modules/comment/js/comment-by-viewer.js
+++ b/core/modules/comment/js/comment-by-viewer.js
@@ -1,18 +1,25 @@
/**
-* DO NOT EDIT THIS FILE.
-* See the following change record for more information,
-* https://www.drupal.org/node/2815083
-* @preserve
-**/
+ * @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');
- }
-
+ $('[data-comment-user-id]')
+ .filter(function () {
+ return (
+ parseInt(this.getAttribute('data-comment-user-id'), 10) ===
+ currentUserID
+ );
+ })
+ .addClass('by-viewer');
+ },
};
-})(jQuery, Drupal, drupalSettings); \ No newline at end of file
+})(jQuery, Drupal, drupalSettings);