- commit
- dc5c264ed08effaa27b1cbd4d84ac71c22cb7bdb
- parent
- 258c856e7d9d412686d0691b8e519131cb961828
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2021-10-01 18:04
mark as read on action
Diffstat
| M | src/js/message.js | 16 | +++++++++++++++- |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/js/message.js b/src/js/message.js
@@ -7,6 +7,7 @@ var util = require('./util.js');
7 7 var autoMarkAsRead = function(e, msg) {
8 8 var topWasInView = false;
9 9 var bottomWasInView = false;
-1 10 var clear;
10 11
11 12 var intervalId = window.setInterval(function() {
12 13 var rect = e.getBoundingClientRect();
@@ -21,10 +22,23 @@ var autoMarkAsRead = function(e, msg) {
21 22 }
22 23 if (topWasInView && bottomWasInView) {
23 24 actions.markAsRead(msg, true);
24 -1 window.clearInterval(intervalId);
-1 25 clear();
25 26 }
26 27 }
27 28 }, 100);
-1 29
-1 30 var onAction = function(event) {
-1 31 if (event.target.closest('[data-action]')) {
-1 32 actions.markAsRead(msg, true);
-1 33 clear();
-1 34 }
-1 35 }
-1 36 e.addEventListener('click', onAction);
-1 37
-1 38 clear = function() {
-1 39 window.clearInterval(intervalId);
-1 40 e.removeEventListener('click', onAction);
-1 41 };
28 42 };
29 43
30 44 var iconFilter = function() {