Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / comment / js / node-new-comments-link.js
index 1396018a561872b3a47ff5ac8993b0c3d03e9c39..b7439940f61ac81bc5739ca3ef73af8ea865bcdc 100644 (file)
@@ -6,34 +6,6 @@
 **/
 
 (function ($, Drupal, drupalSettings) {
-  Drupal.behaviors.nodeNewCommentsLink = {
-    attach: function attach(context) {
-      var nodeIDs = [];
-      var $placeholders = $(context).find('[data-history-node-last-comment-timestamp]').once('history').filter(function () {
-        var $placeholder = $(this);
-        var lastCommentTimestamp = parseInt($placeholder.attr('data-history-node-last-comment-timestamp'), 10);
-        var nodeID = $placeholder.closest('[data-history-node-id]').attr('data-history-node-id');
-        if (Drupal.history.needsServerCheck(nodeID, lastCommentTimestamp)) {
-          nodeIDs.push(nodeID);
-
-          hide($placeholder);
-          return true;
-        }
-
-        remove($placeholder);
-        return false;
-      });
-
-      if ($placeholders.length === 0) {
-        return;
-      }
-
-      Drupal.history.fetchTimestamps(nodeIDs, function () {
-        processNodeNewCommentLinks($placeholders);
-      });
-    }
-  };
-
   function hide($placeholder) {
     return $placeholder.closest('.comment-new-comments').prev().addClass('last').end().hide();
   }
       });
     }
   }
+
+  Drupal.behaviors.nodeNewCommentsLink = {
+    attach: function attach(context) {
+      var nodeIDs = [];
+      var $placeholders = $(context).find('[data-history-node-last-comment-timestamp]').once('history').filter(function () {
+        var $placeholder = $(this);
+        var lastCommentTimestamp = parseInt($placeholder.attr('data-history-node-last-comment-timestamp'), 10);
+        var nodeID = $placeholder.closest('[data-history-node-id]').attr('data-history-node-id');
+        if (Drupal.history.needsServerCheck(nodeID, lastCommentTimestamp)) {
+          nodeIDs.push(nodeID);
+
+          hide($placeholder);
+          return true;
+        }
+
+        remove($placeholder);
+        return false;
+      });
+
+      if ($placeholders.length === 0) {
+        return;
+      }
+
+      Drupal.history.fetchTimestamps(nodeIDs, function () {
+        processNodeNewCommentLinks($placeholders);
+      });
+    }
+  };
 })(jQuery, Drupal, drupalSettings);
\ No newline at end of file