From 63c0c51f3862705951eafc60ba923624cba02d9f Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 6 Dec 2019 14:25:02 -0600 Subject: [PATCH] circles timezone and sorting fixes --- TODO.txt | 1 + static-data/www/board/board.js | 2 +- static-data/www/board/sort-posts.js | 23 ++++++++--------------- static-data/www/chat/index.html | 2 +- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/TODO.txt b/TODO.txt index 5f6e22c4..9dcba42c 100644 --- a/TODO.txt +++ b/TODO.txt @@ -2,6 +2,7 @@ * add multi-device forward secrecy * document anonymity & security theory * document usage +* add offline mode * encrypt local data and keys * ensure accessibility for Onionr web UI * make forward secrecy compatible with multiple devices diff --git a/static-data/www/board/board.js b/static-data/www/board/board.js index 14b87f2b..5ee7e9ef 100755 --- a/static-data/www/board/board.js +++ b/static-data/www/board/board.js @@ -58,7 +58,7 @@ function appendMessages(msg, blockHash, beforeHash, channel) { msgDate = 'unknown' } else { humanDate.setUTCSeconds(msgDate) - msgDate = humanDate.toLocaleTimeString() + ' ' + humanDate.toLocaleDateString() + msgDate = humanDate.toLocaleString("en-US", {timeZone: "Etc/GMT"}) } var el = document.createElement('div') diff --git a/static-data/www/board/sort-posts.js b/static-data/www/board/sort-posts.js index fa6affb9..59b9f880 100644 --- a/static-data/www/board/sort-posts.js +++ b/static-data/www/board/sort-posts.js @@ -17,21 +17,14 @@ along with this program. If not, see . */ -function sortEntries(){ +function sortEntries() { var entries = document.getElementsByClassName('entry') - var timestamp = 0; - if (entries.length > 0){ - timestamp = entries[0].getAttribute('timestamp') + if (entries.length > 1) { + const sortBy = 'timestamp' + const parent = entries[0].parentNode + + const sorted = Array.from(entries).sort((a, b) => b.getAttribute(sortBy) - a.getAttribute(sortBy)) + sorted.forEach(element => parent.appendChild(element)) } - - for (i = 0; i < entries.length; i++){ - - if (entries[i].getAttribute('timestamp') > timestamp){ - if(entries[i].previousElementSibling){ - entries[i].parentNode.insertBefore(entries[i], entries[i].previousElementSibling) - } - } - } - -} \ No newline at end of file +} diff --git a/static-data/www/chat/index.html b/static-data/www/chat/index.html index be3b90d5..9ca39475 100755 --- a/static-data/www/chat/index.html +++ b/static-data/www/chat/index.html @@ -25,7 +25,7 @@