Mercurial > hg > isophonics-drupal-site
annotate core/modules/history/js/mark-as-read.es6.js @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 129ea1e6d783 |
children |
rev | line source |
---|---|
Chris@0 | 1 /** |
Chris@0 | 2 * @file |
Chris@0 | 3 * Marks the nodes listed in drupalSettings.history.nodesToMarkAsRead as read. |
Chris@0 | 4 * |
Chris@0 | 5 * Uses the History module JavaScript API. |
Chris@0 | 6 * |
Chris@0 | 7 * @see Drupal.history |
Chris@0 | 8 */ |
Chris@0 | 9 |
Chris@17 | 10 (function(window, Drupal, drupalSettings) { |
Chris@0 | 11 // When the window's "load" event is triggered, mark all enumerated nodes as |
Chris@0 | 12 // read. This still allows for Drupal behaviors (which are triggered on the |
Chris@0 | 13 // "DOMContentReady" event) to add "new" and "updated" indicators. |
Chris@0 | 14 window.addEventListener('load', () => { |
Chris@0 | 15 if (drupalSettings.history && drupalSettings.history.nodesToMarkAsRead) { |
Chris@17 | 16 Object.keys(drupalSettings.history.nodesToMarkAsRead).forEach( |
Chris@17 | 17 Drupal.history.markAsRead, |
Chris@17 | 18 ); |
Chris@0 | 19 } |
Chris@0 | 20 }); |
Chris@17 | 21 })(window, Drupal, drupalSettings); |