sendTextArea: the same but prettier and also no jQuery

5d7c204678e5abc1f718ce226656a94aff78316e

Succubyss <87207237+Succubyss@users.noreply.github.com>

1 files changed, +8 -7Ignore whitespace
public/scripts/RossAscends-mods.js+8 -7
@@ -881,13 +881,14 @@ export function initRossMods() {
881 saveSettingsDebounced();881 saveSettingsDebounced();
882 });882 });
883883
884 $(sendTextArea).on('input', () => {884 sendTextArea.addEventListener('input', () => {
885 const scrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth && sendTextArea.offsetHeight >= window.innerHeight / 2;885 const hasContent = sendTextArea.value !== '';
886 if ((sendTextArea.scrollHeight > sendTextArea.offsetHeight && !scrollbarShown) || sendTextArea.value === '') {886 const fitsCurrentSize = sendTextArea.scrollHeight <= sendTextArea.offsetHeight;
887 autoFitSendTextArea();887 const isScrollbarShown = sendTextArea.clientWidth < sendTextArea.offsetWidth;
888 } else {888 const isHalfScreenHeight = sendTextArea.offsetHeight >= window.innerHeight / 2;
889 autoFitSendTextAreaDebounced();889 const needsDebounce = hasContent && (fitsCurrentSize || (isScrollbarShown && isHalfScreenHeight));
890 }890 if (needsDebounce) autoFitSendTextAreaDebounced();
891 else autoFitSendTextArea();
891 saveUserInputDebounced();892 saveUserInputDebounced();
892 });893 });
893894