aboutsummaryrefslogtreecommitdiff
path: root/microblog.js
diff options
context:
space:
mode:
authorArno Richter <oelna@oelna.de>2022-12-09 23:39:25 +0100
committerArno Richter <oelna@oelna.de>2022-12-09 23:39:25 +0100
commit2207c1f2db82fa52eb5dd8123d82380e790ee74b (patch)
tree0427d0d8a46abcdcf0e7ea5d3f30604f7f310add /microblog.js
parentd22c8b2503e08603dbdfb10d2a2004ddaf104207 (diff)
downloadmicroblog-2207c1f2db82fa52eb5dd8123d82380e790ee74b.tar.gz
microblog-2207c1f2db82fa52eb5dd8123d82380e790ee74b.tar.bz2
microblog-2207c1f2db82fa52eb5dd8123d82380e790ee74b.zip
Improved feed support, provided an ATOM feed, updated database to include UUIDv4 for posts.
Diffstat (limited to 'microblog.js')
-rw-r--r--microblog.js25
1 files changed, 14 insertions, 11 deletions
diff --git a/microblog.js b/microblog.js
index bcb207a..03e8d11 100644
--- a/microblog.js
+++ b/microblog.js
@@ -2,17 +2,20 @@
const textarea = document.querySelector('textarea[name="content"]');
const charCount = document.querySelector('#count');
-const maxCount = parseInt(textarea.getAttribute('maxlength'));
-if (textarea.value.length > 0) {
- const textLength = [...textarea.value].length;
- charCount.textContent = maxCount - textLength;
-} else {
- charCount.textContent = maxCount;
-}
+if (textarea) {
+ const maxCount = parseInt(textarea.getAttribute('maxlength'));
+
+ if (textarea.value.length > 0) {
+ const textLength = [...textarea.value].length;
+ charCount.textContent = maxCount - textLength;
+ } else {
+ charCount.textContent = maxCount;
+ }
-textarea.addEventListener('input', function () {
- const textLength = [...this.value].length;
+ textarea.addEventListener('input', function () {
+ const textLength = [...this.value].length;
- charCount.textContent = maxCount - textLength;
-}, false);
+ charCount.textContent = maxCount - textLength;
+ }, false);
+}