|
1 | | -<!DOCTYPE html> |
| 1 | +<!DOCTYPE html> |
2 | 2 | <html lang="en"> |
3 | 3 |
|
4 | 4 | <head> |
|
154 | 154 | <acb-modal-shell></acb-modal-shell> |
155 | 155 |
|
156 | 156 | <script src="/static/js/shared-api.js?v=2"></script> |
| 157 | + <script src="/static/js/shared-ui-agent.js?v=1"></script> |
157 | 158 | <script src="/static/js/shared-theme.js?v=2"></script> |
158 | 159 | <script src="/static/js/shared-utils.js?v=3"></script> |
159 | 160 | <script src="/static/js/shared-message-renderer.js?v=2"></script> |
|
984 | 985 | }).catch(() => {}); |
985 | 986 | }; |
986 | 987 |
|
| 988 | + // UI-13: scroll to the message referenced by a reply-quote button |
| 989 | + window.AcbScrollToMsg = (msgId) => { |
| 990 | + const target = document.querySelector(`[data-msg-id="${CSS.escape(msgId)}"]`); |
| 991 | + if (!target) return; |
| 992 | + const scrollEl = document.getElementById('messages-scroll'); |
| 993 | + if (scrollEl) { |
| 994 | + scrollEl.scrollTo({ top: target.offsetTop - 12, behavior: 'smooth' }); |
| 995 | + } else { |
| 996 | + target.scrollIntoView({ behavior: 'smooth', block: 'start' }); |
| 997 | + } |
| 998 | + target.classList.add('msg-jump-highlight'); |
| 999 | + setTimeout(() => target.classList.remove('msg-jump-highlight'), 1500); |
| 1000 | + }; |
| 1001 | + |
| 1002 | + // UI-13: event delegation -- intercepts clicks on any .msg-reply-quote in #messages |
| 1003 | + document.getElementById('messages')?.addEventListener('click', (e) => { |
| 1004 | + const btn = e.target.closest('button.msg-reply-quote'); |
| 1005 | + if (!btn) return; |
| 1006 | + const targetId = btn.dataset.replyTarget; |
| 1007 | + if (targetId) window.AcbScrollToMsg(targetId); |
| 1008 | + }); |
| 1009 | + |
987 | 1010 | function appendBubble(m) { |
988 | 1011 | const box = document.getElementById('messages'); |
989 | 1012 |
|
|
1183 | 1206 | priorityBadgeHtml = '<span class="msg-priority-badge msg-priority-system" title="System message">SYSTEM</span>'; |
1184 | 1207 | } |
1185 | 1208 |
|
1186 | | - // Reply-to quote (UP-14) |
| 1209 | + // Reply-to quote (UP-14) -- UI-13: clickable button with event delegation |
1187 | 1210 | const replyQuoteHtml = m.reply_to_msg_id |
1188 | | - ? `<div class="msg-reply-quote" title="In reply to message ${esc(m.reply_to_msg_id)}">↩ In reply to: <em>${esc(m.reply_to_msg_id.slice(0, 8))}…</em></div>` |
| 1211 | + ? `<button class="msg-reply-quote" data-reply-target="${esc(m.reply_to_msg_id)}" title="Jump to message ${esc(m.reply_to_msg_id)}">↩ In reply to: <em>${esc(m.reply_to_msg_id.slice(0, 8))}…</em></button>` |
1189 | 1212 | : ''; |
1190 | 1213 |
|
1191 | 1214 | // Edit indicator (UP-21) |
|
0 commit comments