mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Channel names are directly selectable and changable in chat
This commit is contained in:
parent
a2b2839a66
commit
0ffaf41874
@ -350,6 +350,10 @@ a {
|
|||||||
color: #82b1ff;
|
color: #82b1ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#chatcontent a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
#fetching-indicator {
|
#fetching-indicator {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 1vw;
|
right: 1vw;
|
||||||
@ -482,6 +486,19 @@ p.mentioned span.chatmessage {
|
|||||||
margin-bottom: 3px;
|
margin-bottom: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chatmessage .channellink {
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
color: #82b1ff;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatmessage .channellink:hover {
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
#emoji-picker {
|
#emoji-picker {
|
||||||
color: black;
|
color: black;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
@ -650,8 +650,26 @@
|
|||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function select_channel(channel_id) {
|
function flashElement(element) {
|
||||||
if (selected_channel != channel_id) {
|
var opacity = element.css("opacity");
|
||||||
|
for (var i = 0; i < 3; i++) {
|
||||||
|
element.animate({opacity: 0}, "fast");
|
||||||
|
element.animate({opacity: 100}, "fast");
|
||||||
|
}
|
||||||
|
element.css("opacity", opacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
function select_channel(channel_id, animate_it) {
|
||||||
|
if (selected_channel != channel_id && guild_channels[channel_id] && guild_channels[channel_id].read) {
|
||||||
|
if (animate_it) {
|
||||||
|
$("#guild-btn").sideNav("show");
|
||||||
|
flashElement($("#channel-"+channel_id));
|
||||||
|
setTimeout(function () {
|
||||||
|
$("#guild-btn").sideNav("hide");
|
||||||
|
select_channel(channel_id);
|
||||||
|
}, 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
selected_channel = channel_id;
|
selected_channel = channel_id;
|
||||||
last_message_id = null;
|
last_message_id = null;
|
||||||
$("#channels-list > li.active").removeClass("active");
|
$("#channels-list > li.active").removeClass("active");
|
||||||
@ -748,8 +766,9 @@
|
|||||||
function parse_channels_in_message(message) {
|
function parse_channels_in_message(message) {
|
||||||
var channelids = Object.keys(guild_channels);
|
var channelids = Object.keys(guild_channels);
|
||||||
for (var i = 0; i < channelids.length; i++) {
|
for (var i = 0; i < channelids.length; i++) {
|
||||||
var pattern = "<#" + channelids[i] + ">";
|
var pattern = "<#" + channelids[i] + ">";
|
||||||
message.content = message.content.replace(new RegExp(pattern, "g"), "#" + guild_channels[channelids[i]].channel.name);
|
var elem = "<span class=\"channellink\" channelid=\"" + channelids[i] + "\">#" + guild_channels[channelids[i]].channel.name + "</span>";
|
||||||
|
message.content = message.content.replace(new RegExp(pattern, "g"), elem);
|
||||||
}
|
}
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
@ -852,11 +871,11 @@
|
|||||||
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 = parse_message_attachments(message);
|
||||||
message = parse_channels_in_message(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.content = parse_message_markdown(message.content);
|
message.content = parse_message_markdown(message.content);
|
||||||
|
message = parse_channels_in_message(message);
|
||||||
message = parse_emoji_in_message(message);
|
message = parse_emoji_in_message(message);
|
||||||
var username = message.author.username;
|
var username = message.author.username;
|
||||||
if (message.author.nickname) {
|
if (message.author.nickname) {
|
||||||
@ -874,10 +893,16 @@
|
|||||||
mention_member(discordid);
|
mention_member(discordid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$("#chatcontent p:last-child").find(".channellink").click(function () {
|
||||||
|
select_channel($(this).attr("channelid"), true);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
replace.html($(rendered).html());
|
replace.html($(rendered).html());
|
||||||
replace.find(".blockcode").find("br").remove();
|
replace.find(".blockcode").find("br").remove();
|
||||||
render_code_highlighting(replace.find(".blockcode"));
|
render_code_highlighting(replace.find(".blockcode"));
|
||||||
|
replace.find(".channellink").click(function () {
|
||||||
|
select_channel($(this).attr("channelid"), true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
var usrcachekey = username + "#" + message.author.discriminator;
|
var usrcachekey = username + "#" + message.author.discriminator;
|
||||||
if (usrcachekey.startsWith("(Titan Dev) ")) {
|
if (usrcachekey.startsWith("(Titan Dev) ")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user