JS enhancements to encourage bottom-posting

This commit is contained in:
Drew DeVault 2020-11-19 11:41:47 -05:00
parent a1e8bcc561
commit 51498a2dc3
2 changed files with 9 additions and 0 deletions

View File

@ -26,6 +26,7 @@ func quote(r io.Reader) (string, error) {
if err := scanner.Err(); err != nil {
return "", fmt.Errorf("quote: failed to read original message: %s", err)
}
builder.WriteString("\n")
return builder.String(), nil
}

View File

@ -1,3 +1,11 @@
const textarea = document.querySelector("textarea.body");
if (window.location.pathname.endsWith("/reply")) {
// Auto-focus body and scroll to bottom
textarea.focus();
textarea.setSelectionRange(textarea.value.length, textarea.value.length);
textarea.scrollTop = textarea.scrollHeight;
}
const sendButton = document.getElementById("send-button"),
saveButton = document.getElementById("save-button");