From 0015d26dc8a81ab17f4d84ebed3d0cce201e8e96 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sat, 10 Sep 2022 18:58:55 +0200 Subject: xC/xP: support hiding unimportant messages at all --- xP/public/xP.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'xP/public') diff --git a/xP/public/xP.js b/xP/public/xP.js index 864323a..2e7732e 100644 --- a/xP/public/xP.js +++ b/xP/public/xP.js @@ -171,6 +171,7 @@ rpc.addEventListener('BufferUpdate', event => { buffers.set(e.bufferName, (b = {lines: []})) resetBufferStats(b) } + b.hideUnimportant = e.hideUnimportant }) rpc.addEventListener('BufferStats', event => { @@ -465,6 +466,11 @@ let Buffer = { let markBefore = b.lines.length - b.newMessages - b.newUnimportantMessages b.lines.forEach((line, i) => { + if (i == markBefore) + lines.push(m('.unread')) + if (line.isUnimportant && b.hideUnimportant) + return + let date = new Date(line.when) let dateMark = date.toLocaleDateString() if (dateMark !== lastDateMark) { @@ -472,14 +478,10 @@ let Buffer = { lastDateMark = dateMark } - if (i == markBefore) - lines.push(m('.unread')) - let attrs = {} if (line.leaked) attrs.class = 'leaked' - // TODO: Make use of isUnimportant. lines.push(m('.time', {...attrs}, date.toLocaleTimeString())) lines.push(m(Content, {...attrs}, line)) }) @@ -604,6 +606,7 @@ let Main = { return m('.xP', {}, [ m('.title', {}, [`xP (${state})`, m(Toolbar)]), m('.middle', {}, [m(BufferList), m(BufferContainer)]), + // TODO: Indicate hideUnimportant. m('.status', {}, bufferCurrent), m(Input), ]) -- cgit v1.2.3-70-g09d2