diff --git a/src/mami.css/input.css b/src/mami.css/input.css index a16d8da..6e54496 100644 --- a/src/mami.css/input.css +++ b/src/mami.css/input.css @@ -12,6 +12,7 @@ height: 40px; max-height: 140px; resize: none; + width: 0; } .input__text, @@ -32,9 +33,6 @@ cursor: pointer } -.input__menus { -} - .input__menu { display: flex; flex-wrap: wrap; diff --git a/src/mami.css/main.css b/src/mami.css/main.css index b211d3e..30206bc 100644 --- a/src/mami.css/main.css +++ b/src/mami.css/main.css @@ -40,6 +40,10 @@ a:hover { visibility: none !important; } +.invisible { + visibility: none !important; +} + .sjis { font-family: IPAMonaPGothic, 'IPA モナー Pゴシック', Monapo, Mona, 'MS PGothic', 'MS Pゴシック', monospace; font-size: 16px; diff --git a/src/mami.js/avatar.js b/src/mami.js/avatar.js new file mode 100644 index 0000000..f5dfe2e --- /dev/null +++ b/src/mami.js/avatar.js @@ -0,0 +1,11 @@ +const MamiFormatUserAvatarUrl = (userId, res = 0, changeTime = null) => { + const template = futami.get('avatar') ?? ''; + if(template.length < 1) + return ''; + + changeTime ??= Date.now(); + + return template.replace('{user:id}', userId) + .replace('{resolution}', res) + .replace('{user:avatar_change}', changeTime); +}; diff --git a/src/mami.js/chatform/form.jsx b/src/mami.js/chat/form.jsx similarity index 70% rename from src/mami.js/chatform/form.jsx rename to src/mami.js/chat/form.jsx index 7660ece..7260307 100644 --- a/src/mami.js/chatform/form.jsx +++ b/src/mami.js/chat/form.jsx @@ -1,8 +1,8 @@ -#include chatform/input.jsx -#include chatform/markup.jsx +#include chat/input.jsx +#include chat/markup.jsx -const MamiChatForm = function(eventTarget) { - const input = new MamiChatFormInput(eventTarget); +const MamiChatForm = function(findUserInfosByName, findEmoteByName, eventTarget) { + const input = new MamiChatFormInput(findUserInfosByName, findEmoteByName, eventTarget); const markup = new MamiChatFormMarkup; const html =
{ diff --git a/src/mami.js/chat/garbparse.jsx b/src/mami.js/chat/garbparse.jsx new file mode 100644 index 0000000..6b995a0 --- /dev/null +++ b/src/mami.js/chat/garbparse.jsx @@ -0,0 +1,37 @@ +#include parsing.js +#include url.js +#include weeb.js +#include ui/emotes.js + +// replace this with better parsing, read the fucking book already +const MamiMolestMessageContents = (info, textElem, userNameElem) => { + const hasTextElem = textElem instanceof Element; + + if(hasTextElem) { + Umi.UI.Emoticons.Parse(textElem, info.sender); + Umi.Parsing.Parse(textElem, info); + + const textSplit = textElem.innerText.split(' '); + for(const textPart of textSplit) { + const uri = Umi.URI.Parse(textPart); + + if(uri !== null && uri.Slashes !== null) { + const anchorElem = {textPart}; + textElem.innerHTML = textElem.innerHTML.replace(textPart.replace(/&/g, '&'), anchorElem.outerHTML); + } + } + } + + if(mami.settings.get('weeaboo')) { + if(userNameElem instanceof Element) + userNameElem.appendChild($t(Weeaboo.getNameSuffix(info.sender))); + + if(hasTextElem) { + textElem.appendChild($t(Weeaboo.getTextSuffix(info.sender))); + + const kaomoji = Weeaboo.getRandomKaomoji(true, info); + if(kaomoji) + textElem.append(` ${kaomoji}`); + } + } +}; diff --git a/src/mami.js/chatform/input.jsx b/src/mami.js/chat/input.jsx similarity index 86% rename from src/mami.js/chatform/input.jsx rename to src/mami.js/chat/input.jsx index f2fdf86..a26f9af 100644 --- a/src/mami.js/chatform/input.jsx +++ b/src/mami.js/chat/input.jsx @@ -1,7 +1,4 @@ -#include emotes.js -#include users.js - -const MamiChatFormInput = function(eventTarget) { +const MamiChatFormInput = function(findUserInfosByName, findEmoteByName, eventTarget) { const textElem =