2019-02-01 06:38:12 +00:00
|
|
|
pms = ''
|
|
|
|
threadPart = document.getElementById('threads')
|
|
|
|
function getInbox(){
|
|
|
|
for(var i = 0; i < pms.length; i++) {
|
|
|
|
fetch('/getblockdata/' + pms[i], {
|
|
|
|
headers: {
|
|
|
|
"token": webpass
|
|
|
|
}})
|
|
|
|
.then((resp) => resp.json()) // Transform the data into json
|
|
|
|
.then(function(resp) {
|
2019-02-02 03:15:28 +00:00
|
|
|
|
2019-02-01 06:38:12 +00:00
|
|
|
var entry = document.createElement('div')
|
2019-02-02 03:15:28 +00:00
|
|
|
|
|
|
|
var bHashDisplay = document.createElement('a')
|
2019-02-01 19:55:59 +00:00
|
|
|
var senderInput = document.createElement('input')
|
|
|
|
var subjectLine = document.createElement('span')
|
|
|
|
var dateStr = document.createElement('span')
|
|
|
|
var humanDate = new Date(0)
|
|
|
|
humanDate.setUTCSeconds(resp['meta']['time'])
|
|
|
|
senderInput.value = resp['meta']['signer']
|
2019-02-02 03:15:28 +00:00
|
|
|
bHashDisplay.innerText = pms[i - 1].substring(0, 10)
|
|
|
|
bHashDisplay.setAttribute('hash', pms[i - 1]);
|
2019-02-01 19:55:59 +00:00
|
|
|
senderInput.readOnly = true
|
|
|
|
dateStr.innerText = humanDate.toString()
|
|
|
|
if (resp['metadata']['subject'] === undefined || resp['metadata']['subject'] === null) {
|
|
|
|
subjectLine.innerText = '()'
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
subjectLine.innerText = '(' + resp['metadata']['subject'] + ')'
|
|
|
|
}
|
|
|
|
//entry.innerHTML = 'sender ' + resp['meta']['signer'] + ' - ' + resp['meta']['time']
|
2019-02-01 06:38:12 +00:00
|
|
|
threadPart.appendChild(entry)
|
2019-02-01 19:55:59 +00:00
|
|
|
entry.appendChild(bHashDisplay)
|
|
|
|
entry.appendChild(senderInput)
|
|
|
|
entry.appendChild(subjectLine)
|
|
|
|
entry.appendChild(dateStr)
|
|
|
|
|
2019-02-02 03:15:28 +00:00
|
|
|
}.bind([pms, i]))
|
2019-02-01 06:38:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fetch('/getblocksbytype/pm', {
|
|
|
|
headers: {
|
|
|
|
"token": webpass
|
|
|
|
}})
|
|
|
|
.then((resp) => resp.text()) // Transform the data into json
|
|
|
|
.then(function(data) {
|
|
|
|
pms = data.split(',')
|
2019-02-02 03:15:28 +00:00
|
|
|
getInbox(pms)
|
2019-02-01 06:38:12 +00:00
|
|
|
})
|
|
|
|
|