mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Collapse messages if the previous is sent by the same author
This commit is contained in:
parent
bee067f8ec
commit
2b68179a82
@ -145,6 +145,7 @@ nav .brand-logo {
|
|||||||
padding-left: 1%;
|
padding-left: 1%;
|
||||||
padding-top: 1%;
|
padding-top: 1%;
|
||||||
padding-bottom: 40px;
|
padding-bottom: 40px;
|
||||||
|
margin-bottom: 13px;
|
||||||
|
|
||||||
/* https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/ */
|
/* https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/ */
|
||||||
/* These are technically the same, but use both */
|
/* These are technically the same, but use both */
|
||||||
@ -174,7 +175,17 @@ nav .brand-logo {
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
border-top: solid 1px rgba(0, 0, 0, 0.1);
|
border-top: solid 1px rgba(0, 0, 0, 0.1);
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
margin-bottom: 11px;
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chatcontent > p.collapsed {
|
||||||
|
border-top: none;
|
||||||
|
margin-top: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#chatcontent > p.collapsed > .chattimestamp, #chatcontent > p.collapsed > .chatusername, #chatcontent > p.collapsed > .authoravatar {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#chatcontent .chatusername {
|
#chatcontent .chatusername {
|
||||||
|
@ -901,7 +901,7 @@
|
|||||||
jumpscroll = true;
|
jumpscroll = true;
|
||||||
} else {
|
} else {
|
||||||
fet = fetch(channel_id, last_message_id);
|
fet = fetch(channel_id, last_message_id);
|
||||||
jumpscroll = element_in_view($('#discordmessage_'+last_message_id), true);
|
jumpscroll = element_in_view($('#discordmessage_'+last_message_id).parent(), true);
|
||||||
}
|
}
|
||||||
fet.done(function(data) {
|
fet.done(function(data) {
|
||||||
var status = data.status;
|
var status = data.status;
|
||||||
@ -963,6 +963,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
collapse_messages();
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_message_users_cache_helper(key, usr) {
|
function process_message_users_cache_helper(key, usr) {
|
||||||
@ -982,6 +983,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function collapse_messages() {
|
||||||
|
var allMessages = $('[id^="discordmessage_"]').parent();
|
||||||
|
for (var i = 1; i < allMessages.length; i++) {
|
||||||
|
var last = $(allMessages[i - 1]);
|
||||||
|
var current = $(allMessages[i]);
|
||||||
|
if (last.attr("discord_userid") == current.attr("discord_userid")) {
|
||||||
|
current.addClass("collapsed");
|
||||||
|
} else {
|
||||||
|
current.removeClass("collapsed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function update_embed_userchip(authenticated, avatar, username, nickname, userid, discrim=null) {
|
function update_embed_userchip(authenticated, avatar, username, nickname, userid, discrim=null) {
|
||||||
if (authenticated) {
|
if (authenticated) {
|
||||||
$("#currentuserimage").show();
|
$("#currentuserimage").show();
|
||||||
@ -1224,7 +1238,7 @@
|
|||||||
if (selected_channel != thismsgchan) {
|
if (selected_channel != thismsgchan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var jumpscroll = element_in_view($('#discordmessage_'+last_message_id), true);
|
var jumpscroll = element_in_view($('#discordmessage_'+last_message_id).parent(), true);
|
||||||
last_message_id = fill_discord_messages([msg], jumpscroll);
|
last_message_id = fill_discord_messages([msg], jumpscroll);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user