From fb700c91cfb9b26ad5ed7c8235629c37f3e31efd Mon Sep 17 00:00:00 2001 From: Mute Date: Wed, 4 Sep 2024 15:30:03 +0000 Subject: [PATCH] better history hint --- mbchc.mjs | 8 ++++++-- package.json | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mbchc.mjs b/mbchc.mjs index 2ea0126..0595c6a 100644 --- a/mbchc.mjs +++ b/mbchc.mjs @@ -590,9 +590,12 @@ const/**@type {SDK.Hook}*/after = (name, f) => mod.hookFunction(name, 0, (na, n) #${C.e.id}[data-colortheme^="dark"] > div { background-color: ${U.RGB.Mute}; color: white; } #${C.e.id} > div div { margin: 0.25ex 0; } #chat-room-div #TextAreaChatLog::before { content: ''; display: block; height: 100%; } - #chat-room-div[data-mbchc-mode="h"] #TextAreaChatLog::after { content: 'π—΅π—Άπ˜€π˜π—Όπ—Ώπ˜† βŸ¨π˜—π˜¨π˜œπ˜±/π˜‹π˜―/β†•βŸ© π—Œπ–Όπ—‹π—ˆπ—…π—… β‡… ⟨𝘌𝘯𝘡𝘦𝘳⟩ π—Œπ–Ύπ—‡π–½ ↡ βŸ¨π˜›π˜’π˜£/β†”βŸ© 𝖾𝖽𝗂𝗍 ⌨ ⟨𝘌𝘴𝘀⟩ π–Ίπ–»π—ˆπ—‹π— ⟲'; display: block; position: sticky; bottom: 0; background: black; color: orange; padding: 0 0.2ex; animation: 0.2s cubic-bezier(0.19, 1, 0.22, 1) mbchc_hist_hint_show; } + #chat-room-div[data-mbchc-mode="h"] #TextAreaChatLog::after { + content: 'π—΅π—Άπ˜€π˜π—Όπ—Ώπ˜† βŸ¨π˜—π˜¨π˜œπ˜±/π˜‹π˜―/β†•βŸ© π—Œπ–Όπ—‹π—ˆπ—…π—… β‡… ⟨𝘌𝘯𝘡𝘦𝘳⟩ π—Œπ–Ύπ—‡π–½ ↡ βŸ¨π˜›π˜’π˜£/β†”βŸ© 𝖾𝖽𝗂𝗍 ⌨ ⟨𝘌𝘴𝘀⟩ π–Ίπ–»π—ˆπ—‹π— ⟲\\A' attr(data-mbchc-h-h); whitespace: pre; + display: block; position: sticky; z-index: 1; bottom: 0; background: black; color: orange; padding: 0 0.2ex; animation: 0.2s cubic-bezier(0.19, 1, 0.22, 1) mbchc_hh_show; + } #InputChat:read-only { background: black; color: orange; } - @keyframes mbchc_hist_hint_show { from {transform: translateX(-100%);} to {transform: translateX(0);} } + @keyframes mbchc_hh_show { from {transform: translateX(-100%);} to {transform: translateX(0);} } `) // Actions @@ -672,6 +675,7 @@ const/**@type {SDK.Hook}*/after = (name, f) => mod.hookFunction(name, 0, (na, n) const/**@type {Map}*/map = new Map() const/**@type {(l: string, i: number, I: string) => boolean}*/ cond = m_t(input) ? (_, i, __) => i > 0 : (l, _, i) => l !== i && l.startsWith(i) if (m_t(history.reduce((ax, l, i) => cond(l, i, input) ? ax.set(l, i) : ax, map))) return U.bell() + val(asa(HTMLDivElement, D.querySelector('#TextAreaChatLog')), t => t.dataset['mbchcHH'] = m_t(input) ? 'All history' : `Prefix: ${input}`) H.enter(ic, input, W.ElementIsScrolledToEnd('TextAreaChatLog'), new Set(map.values())) } if (ic.readOnly) { // this can't be an else, because we mutate state above. To be honest, this will always be true, but I want to make sure. diff --git a/package.json b/package.json index 1074145..6b6577c 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "brace-style": "off", "camelcase": "off", "capitalized-comments": "off", + "complexity": "off", "curly": "off", "generator-star-spacing": "off", "max-nested-callbacks": "off",