mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-06-16 19:35:24 +02:00
Customizable msg posting timeout and msg length
This commit is contained in:
@ -54,6 +54,28 @@ $("#mentions_limit").keyup(function(event){
|
||||
}
|
||||
});
|
||||
|
||||
$("#post_timeout").keyup(function(event){
|
||||
if(event.keyCode == 13){
|
||||
var pathname = window.location.pathname;
|
||||
var value = $("#post_timeout").val()
|
||||
var payload = {"post_timeout": value}
|
||||
$.post(pathname, payload, function(data) {
|
||||
Materialize.toast('Updated post timeout setting!', 2000)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#max_message_length").keyup(function(event){
|
||||
if(event.keyCode == 13){
|
||||
var pathname = window.location.pathname;
|
||||
var value = $("#max_message_length").val()
|
||||
var payload = {"max_message_length": value}
|
||||
$.post(pathname, payload, function(data) {
|
||||
Materialize.toast('Updated max message length setting!', 2000)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#invite_link").keyup(function(event){
|
||||
if(event.keyCode == 13){
|
||||
var pathname = window.location.pathname;
|
||||
|
@ -19,6 +19,7 @@
|
||||
/* global disabled */
|
||||
/* global wdtEmojiBundle */
|
||||
/* global EmojiConvertor */
|
||||
/* global post_timeout */
|
||||
|
||||
(function () {
|
||||
const theme_options = ["DiscordDark", "MetroEdge", "BetterTitan"]; // All the avaliable theming names
|
||||
@ -1589,7 +1590,7 @@
|
||||
if (event.keyCode == 16) {
|
||||
shift_pressed = true;
|
||||
}
|
||||
if(event.keyCode == 13 && !shift_pressed && $(this).val().length >= 1 && $(this).val().length <= 350) {
|
||||
if(event.keyCode == 13 && !shift_pressed && $(this).val().length >= 1) {
|
||||
$(this).val($.trim($(this).val()));
|
||||
$(this).blur();
|
||||
$("#messagebox").attr('readonly', true);
|
||||
@ -1613,15 +1614,13 @@
|
||||
});
|
||||
funct.catch(function(data) {
|
||||
if (data.status == 429) {
|
||||
Materialize.toast('You are sending messages too fast! 1 message per 5 seconds', 10000);
|
||||
Materialize.toast('You are sending messages too fast! 1 message per ' + post_timeout + ' seconds', 10000);
|
||||
}
|
||||
});
|
||||
funct.always(function() {
|
||||
$("#messagebox").attr('readonly', false);
|
||||
$("#messagebox").focus();
|
||||
});
|
||||
} else if (event.keyCode == 13 && !shift_pressed && $(this).val().length > 350) {
|
||||
Materialize.toast('You are sending messages too long! 350 characters limit.', 10000);
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user