Chris@0: /** Chris@0: * @file Chris@0: * Marks the nodes listed in drupalSettings.history.nodesToMarkAsRead as read. Chris@0: * Chris@0: * Uses the History module JavaScript API. Chris@0: * Chris@0: * @see Drupal.history Chris@0: */ Chris@0: Chris@17: (function(window, Drupal, drupalSettings) { Chris@0: // When the window's "load" event is triggered, mark all enumerated nodes as Chris@0: // read. This still allows for Drupal behaviors (which are triggered on the Chris@0: // "DOMContentReady" event) to add "new" and "updated" indicators. Chris@0: window.addEventListener('load', () => { Chris@0: if (drupalSettings.history && drupalSettings.history.nodesToMarkAsRead) { Chris@17: Object.keys(drupalSettings.history.nodesToMarkAsRead).forEach( Chris@17: Drupal.history.markAsRead, Chris@17: ); Chris@0: } Chris@0: }); Chris@17: })(window, Drupal, drupalSettings);