From 510018a51d1d0cff12842c3eac637844f66ccf49 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Fri, 2 Apr 2021 03:21:30 -0400 Subject: [PATCH] Inbound stickers (same as images) This also covers sticons, but only when a single one is sent as the sole content of a message, in which case it behaves like a sticker/image. --- ROADMAP.md | 6 +++++- puppet/src/contentscript.js | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 8445897..8e38cbc 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -18,7 +18,11 @@ * [ ] Audio * [ ] Location * [ ] Videos - * [ ] Stickers & special emoji + * [x] Stickers + * [ ] Sticons + * [x] Single + * [ ] Multiple or mixed with text + * [ ] EmojiOne * [x] Notification for message send failure * [ ] Read receipts * [x] User metadata diff --git a/puppet/src/contentscript.js b/puppet/src/contentscript.js index cc6d043..945e80d 100644 --- a/puppet/src/contentscript.js +++ b/puppet/src/contentscript.js @@ -212,9 +212,14 @@ class MautrixController { } const messageElement = element.querySelector(".mdRGT07Body > .mdRGT07Msg") if (messageElement.classList.contains("mdRGT07Text")) { - // TODO Use "Inner" or not? + // TODO Use alt text of emojione imgs messageData.text = messageElement.querySelector(".mdRGT07MsgTextInner")?.innerText - } else if (messageElement.classList.contains("mdRGT07Image")) { + // TODO HTML format for emojione imgs & sticons. + // Consider using a custom sticker pack (MSC1951) + } else if ( + messageElement.classList.contains("mdRGT07Image") || + messageElement.classList.contains("mdRGT07Sticker") + ) { const img = messageElement.querySelector(".mdRGT07MsgImg > img") if (img) { let resolve