Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / tracker / js / tracker-history.js
index a147eb8a63641fbce5bd37c85da221a9108a37c4..30a500fe708f154295fb4b1795f6d5bf8d54885c 100644 (file)
@@ -6,49 +6,6 @@
 **/
 
 (function ($, Drupal, window) {
-  Drupal.behaviors.trackerHistory = {
-    attach: function attach(context) {
-      var nodeIDs = [];
-      var $nodeNewPlaceholders = $(context).find('[data-history-node-timestamp]').once('history').filter(function () {
-        var nodeTimestamp = parseInt(this.getAttribute('data-history-node-timestamp'), 10);
-        var nodeID = this.getAttribute('data-history-node-id');
-        if (Drupal.history.needsServerCheck(nodeID, nodeTimestamp)) {
-          nodeIDs.push(nodeID);
-          return true;
-        }
-
-        return false;
-      });
-
-      var $newRepliesPlaceholders = $(context).find('[data-history-node-last-comment-timestamp]').once('history').filter(function () {
-        var lastCommentTimestamp = parseInt(this.getAttribute('data-history-node-last-comment-timestamp'), 10);
-        var nodeTimestamp = parseInt(this.previousSibling.previousSibling.getAttribute('data-history-node-timestamp'), 10);
-
-        if (lastCommentTimestamp === nodeTimestamp) {
-          return false;
-        }
-        var nodeID = this.previousSibling.previousSibling.getAttribute('data-history-node-id');
-        if (Drupal.history.needsServerCheck(nodeID, lastCommentTimestamp)) {
-          if (nodeIDs.indexOf(nodeID) === -1) {
-            nodeIDs.push(nodeID);
-          }
-          return true;
-        }
-
-        return false;
-      });
-
-      if ($nodeNewPlaceholders.length === 0 && $newRepliesPlaceholders.length === 0) {
-        return;
-      }
-
-      Drupal.history.fetchTimestamps(nodeIDs, function () {
-        processNodeNewIndicators($nodeNewPlaceholders);
-        processNewRepliesIndicators($newRepliesPlaceholders);
-      });
-    }
-  };
-
   function processNodeNewIndicators($placeholders) {
     var newNodeString = Drupal.t('new');
     var updatedNodeString = Drupal.t('updated');
       }
     });
   }
+
+  Drupal.behaviors.trackerHistory = {
+    attach: function attach(context) {
+      var nodeIDs = [];
+      var $nodeNewPlaceholders = $(context).find('[data-history-node-timestamp]').once('history').filter(function () {
+        var nodeTimestamp = parseInt(this.getAttribute('data-history-node-timestamp'), 10);
+        var nodeID = this.getAttribute('data-history-node-id');
+        if (Drupal.history.needsServerCheck(nodeID, nodeTimestamp)) {
+          nodeIDs.push(nodeID);
+          return true;
+        }
+
+        return false;
+      });
+
+      var $newRepliesPlaceholders = $(context).find('[data-history-node-last-comment-timestamp]').once('history').filter(function () {
+        var lastCommentTimestamp = parseInt(this.getAttribute('data-history-node-last-comment-timestamp'), 10);
+        var nodeTimestamp = parseInt(this.previousSibling.previousSibling.getAttribute('data-history-node-timestamp'), 10);
+
+        if (lastCommentTimestamp === nodeTimestamp) {
+          return false;
+        }
+        var nodeID = this.previousSibling.previousSibling.getAttribute('data-history-node-id');
+        if (Drupal.history.needsServerCheck(nodeID, lastCommentTimestamp)) {
+          if (nodeIDs.indexOf(nodeID) === -1) {
+            nodeIDs.push(nodeID);
+          }
+          return true;
+        }
+
+        return false;
+      });
+
+      if ($nodeNewPlaceholders.length === 0 && $newRepliesPlaceholders.length === 0) {
+        return;
+      }
+
+      Drupal.history.fetchTimestamps(nodeIDs, function () {
+        processNodeNewIndicators($nodeNewPlaceholders);
+        processNewRepliesIndicators($newRepliesPlaceholders);
+      });
+    }
+  };
 })(jQuery, Drupal, window);
\ No newline at end of file