From 516d965ad359f9df9c843174d695fd52337a9137 Mon Sep 17 00:00:00 2001 From: Arinerron Date: Thu, 6 Sep 2018 21:37:39 -0700 Subject: [PATCH] Add work --- onionr/static-data/www/ui/dist/js/timeline.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/onionr/static-data/www/ui/dist/js/timeline.js b/onionr/static-data/www/ui/dist/js/timeline.js index af554f80..73e46559 100644 --- a/onionr/static-data/www/ui/dist/js/timeline.js +++ b/onionr/static-data/www/ui/dist/js/timeline.js @@ -81,17 +81,21 @@ function toggleSaveButton(show) { function makePost() { var content = document.getElementById("onionr-post-creator-content").value; - var post = new Post(); + if(content.trim() !== '') { + var post = new Post(); - post.setUser(getCurrentUser()); - post.setContent(content); - post.setPostDate(new Date()); + post.setUser(getCurrentUser()); + post.setContent(content); + post.setPostDate(new Date()); - post.save(function(data) {}); // async, but no function + post.save(function(data) {}); // async, but no function - document.getElementById('onionr-timeline-posts').innerHTML = post.getHTML() + document.getElementById('onionr-timeline-posts').innerHTML; + document.getElementById('onionr-timeline-posts').innerHTML = post.getHTML() + document.getElementById('onionr-timeline-posts').innerHTML; - document.getElementById("onionr-post-creator-content").value = ""; + document.getElementById("onionr-post-creator-content").value = ""; + } else { + console.log('Not making empty post.'); + } } $('body').on('click', '[data-editable]', function() {