Telegram:折叠引用回复
将引用回复预览缩短为一行,点击后展开完整引用。
可复制的代码
// Shorten quoted reply previews so long quotes do not crowd messages
function trimQuotes() {
const quotes = document.querySelectorAll('.bubbles .bubble .reply, .Message .EmbeddedMessage');
quotes.forEach(function (q) {
if (q.dataset.jzTrim) { return; }
q.dataset.jzTrim = '1';
q.style.maxHeight = '38px';
q.style.overflow = 'hidden';
q.style.cursor = 'pointer';
q.title = 'Click to expand the quote';
q.addEventListener('click', function () {
q.style.maxHeight = q.style.maxHeight === 'none' ? '38px' : 'none';
});
});
}
trimQuotes();
const obs = new MutationObserver(trimQuotes);
obs.observe(document.documentElement, { childList: true, subtree: true });
如何使用此示例
- 用上方按钮复制代码。
- 安装 JustZix(2 分钟),在目标页面打开扩展。
- 添加一条匹配该页面的新规则。
- 将代码粘贴到规则的 JavaScript 面板并保存 — 每次访问页面时都会运行。
为此示例评分
暂无评分 — 成为第一个。