diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-09-10 18:58:55 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-09-10 19:01:42 +0200 |
commit | 0015d26dc8a81ab17f4d84ebed3d0cce201e8e96 (patch) | |
tree | 87a0f5fa15f65b937c0a6fbc6f1849b59d4311a8 /xP | |
parent | 7d5e63be1fd6602ab8e62316202924b316c7436f (diff) | |
download | xK-0015d26dc8a81ab17f4d84ebed3d0cce201e8e96.tar.gz xK-0015d26dc8a81ab17f4d84ebed3d0cce201e8e96.tar.xz xK-0015d26dc8a81ab17f4d84ebed3d0cce201e8e96.zip |
xC/xP: support hiding unimportant messages at all
Diffstat (limited to 'xP')
-rw-r--r-- | xP/public/xP.js | 11 |
1 files changed, 7 insertions, 4 deletions
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), ]) |