mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Message box new line on shiftenter, enter submits without newline, Resolves #44
This commit is contained in:
parent
9e494f3808
commit
610d46936c
@ -26,6 +26,7 @@
|
|||||||
var priority_query_guild = false; // So you have selected a channel? Let's populate it.
|
var priority_query_guild = false; // So you have selected a channel? Let's populate it.
|
||||||
var current_username_discrim; // Current username/discrim pair, eg EndenDraogn#4151
|
var current_username_discrim; // Current username/discrim pair, eg EndenDraogn#4151
|
||||||
var visitor_mode = false; // Keep track of if using the visitor mode or authenticate mode
|
var visitor_mode = false; // Keep track of if using the visitor mode or authenticate mode
|
||||||
|
var shift_pressed = false; // Track down if shift pressed on messagebox
|
||||||
|
|
||||||
function element_in_view(element, fullyInView) {
|
function element_in_view(element, fullyInView) {
|
||||||
var pageTop = $(window).scrollTop();
|
var pageTop = $(window).scrollTop();
|
||||||
@ -895,11 +896,20 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#messagebox").keyup(function(event){
|
$("#messagebox").keyup(function (event) {
|
||||||
|
if (event.keyCode == 16) {
|
||||||
|
shift_pressed = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#messagebox").keydown(function(event){
|
||||||
if ($(this).val().length == 1) {
|
if ($(this).val().length == 1) {
|
||||||
$(this).val($.trim($(this).val()));
|
$(this).val($.trim($(this).val()));
|
||||||
}
|
}
|
||||||
if(event.keyCode == 13 && $(this).val().length >= 1 && $(this).val().length <= 350) {
|
if (event.keyCode == 16) {
|
||||||
|
shift_pressed = true;
|
||||||
|
}
|
||||||
|
if(event.keyCode == 13 && !shift_pressed && $(this).val().length >= 1 && $(this).val().length <= 350) {
|
||||||
$(this).val($.trim($(this).val()));
|
$(this).val($.trim($(this).val()));
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
$("#messagebox").attr('readonly', true);
|
$("#messagebox").attr('readonly', true);
|
||||||
|
Loading…
Reference in New Issue
Block a user