From 705359d3a6d60070bc0dd3c3c6e22422204d34c9 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 16 Apr 2019 12:04:51 -0500 Subject: [PATCH] board appearance and functionality work --- onionr/static-data/www/board/board.js | 32 +++++++++++++++---------- onionr/static-data/www/board/index.html | 23 ++++++++++++++---- onionr/static-data/www/board/theme.css | 12 +++++++--- 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/onionr/static-data/www/board/board.js b/onionr/static-data/www/board/board.js index a1ec5dc2..d9f35bce 100644 --- a/onionr/static-data/www/board/board.js +++ b/onionr/static-data/www/board/board.js @@ -2,22 +2,25 @@ requested = [] var windowHeight = window.innerHeight; webpassword = webpass -function httpGet(theUrl) { - var xmlHttp = new XMLHttpRequest() - xmlHttp.open( "GET", theUrl, false ) // false for synchronous request - xmlHttp.setRequestHeader('token', webpassword) - xmlHttp.send( null ) - if (xmlHttp.status == 200){ - return xmlHttp.responseText +newPostForm = document.getElementById('addMsg') + +function appendMessages(msg){ + var humanDate = new Date(0) + var msg = JSON.parse(msg) + var dateEl = document.createElement('span') + var el = document.createElement('div') + var msgDate = msg['meta']['time'] + if (msgDate === undefined){ + msgDate = 'unknown' } else{ - return ""; + humanDate.setUTCSeconds(msgDate) + msgDate = humanDate.toDateString() + ' ' + humanDate.toTimeString() } -} -function appendMessages(msg){ - el = document.createElement('div') + dateEl.textContent = msgDate el.className = 'entry' - el.innerText = msg + el.innerText = msg['content'] + document.getElementById('feed').appendChild(dateEl) document.getElementById('feed').appendChild(el) document.getElementById('feed').appendChild(document.createElement('br')) } @@ -38,7 +41,10 @@ function getBlocks(){ } } - document.getElementById('refreshFeed').onclick = function(){ getBlocks() +} + +newPostForm.onsubmit = function(){ + return false } \ No newline at end of file diff --git a/onionr/static-data/www/board/index.html b/onionr/static-data/www/board/index.html index 054f6a15..180bf0b0 100644 --- a/onionr/static-data/www/board/index.html +++ b/onionr/static-data/www/board/index.html @@ -4,14 +4,27 @@ - OnionrBoard + Circle + + - - - -
None Yet :)
+ +

Circle

+

+ Anonymous message board +

+
+ +

+ +
+

+
+ +

+ None Yet :)
diff --git a/onionr/static-data/www/board/theme.css b/onionr/static-data/www/board/theme.css index 766e4407..1062e49b 100644 --- a/onionr/static-data/www/board/theme.css +++ b/onionr/static-data/www/board/theme.css @@ -1,6 +1,8 @@ -h1, h2, h3{ - font-family: sans-serif; +body{ + background-color: white; + color: black; } + .hidden{ display: none; } @@ -18,7 +20,7 @@ p{ } .entry{ - color: red; + color: green; } #feed{ @@ -28,4 +30,8 @@ p{ border: 2px solid black; padding: 5px; min-height: 50px; +} + +.successBtn{ + min-width: 100px; } \ No newline at end of file