board appearance and functionality work

This commit is contained in:
Kevin Froman 2019-04-16 12:04:51 -05:00
parent 9604849dbb
commit 705359d3a6
3 changed files with 46 additions and 21 deletions

View File

@ -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
}

View File

@ -4,14 +4,27 @@
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<title>
OnionrBoard
Circle
</title>
<link rel='stylesheet' href='/shared/style/modal.css'>
<link rel='stylesheet' href='/shared/main/style.css'>
<link rel='stylesheet' href='theme.css'>
</head>
<body>
<input type='button' id='refreshFeed' value='Refresh Feed'>
<div id='feed'><span id='none'>None Yet :)</span></div>
<h1>Circle</h1>
<p>
Anonymous message board
</p>
<form method='POST' action='/' id='addMsg'>
<textarea name='newMsgText' rows=10 cols=50 required minlength="2"></textarea>
<br><br>
<input class='btn successBtn' value='Post' type='submit'>
</form>
<br><br>
<div id='feed'>
<input class='primaryBtn' type='button' id='refreshFeed' value='Refresh Feed'>
<br><br>
<span id='none'>None Yet :)</span></div>
<script src='/shared/misc.js'></script>
<script src='board.js'></script>
</body>

View File

@ -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{
@ -29,3 +31,7 @@ p{
padding: 5px;
min-height: 50px;
}
.successBtn{
min-width: 100px;
}