Embed attached images

This commit is contained in:
Jeremy Zhang 2017-11-05 06:09:05 +00:00
parent eff2b3bb46
commit 5fb860caca
2 changed files with 11 additions and 2 deletions

View File

@ -584,6 +584,11 @@ p.mentioned span.chatmessage {
width: 100%; width: 100%;
} }
#chatcontent img.attachment {
width: 100%;
max-width: 300px;
}
#emoji-picker { #emoji-picker {
color: black; color: black;
position: fixed; position: fixed;

View File

@ -736,7 +736,11 @@
if (message.content.length != 0) { if (message.content.length != 0) {
attach = " "; attach = " ";
} }
if (message.attachments[i].url.endsWith(".png") || message.attachments[i].url.endsWith(".jpg") || message.attachments[i].url.endsWith(".jpeg") || message.attachments[i].url.endsWith(".gif")) {
attach += "<img class=\"attachment\" src=\"" + message.attachments[i].url + "\">";
} else {
attach += message.attachments[i].url; attach += message.attachments[i].url;
}
message.content += attach; message.content += attach;
} }
return message; return message;
@ -900,10 +904,10 @@
message = replace_message_mentions(message); message = replace_message_mentions(message);
message = format_bot_message(message); message = format_bot_message(message);
message = parse_message_time(message); message = parse_message_time(message);
message = parse_message_attachments(message);
message.content = message.content.replaceAll("\\<", "<"); message.content = message.content.replaceAll("\\<", "<");
message.content = message.content.replaceAll("\\>", ">"); message.content = message.content.replaceAll("\\>", ">");
message.content = escapeHtml(message.content); message.content = escapeHtml(message.content);
message = parse_message_attachments(message);
message.content = parse_message_markdown(message.content); message.content = parse_message_markdown(message.content);
message = parse_channels_in_message(message); message = parse_channels_in_message(message);
message = parse_emoji_in_message(message); message = parse_emoji_in_message(message);