Onionr/onionr/static-data/www/clandestine/js/main.js
Kevin Froman 075467ad20
* updated contributing.md with better explanations
* added clandestine endpoint and web files, basic page layout
* better comply with gplv3 in pgpwords module
2019-05-18 13:46:48 -05:00

26 lines
745 B
JavaScript

friendList = []
convoListElement = document.getElementsByClassName('conversationList')[0]
function createConvoList(){
for (var x = 0; x < friendList.length; x++){
var convoEntry = document.createElement('div')
convoEntry.classList.add('convoEntry')
convoEntry.setAttribute('data-pubkey', friendList[x])
convoEntry.innerText = friendList[x]
convoListElement.append(convoEntry)
}
}
fetch('/friends/list', {
headers: {
"token": webpass
}})
.then((resp) => resp.json()) // Transform the data into json
.then(function(resp) {
var keys = []
for(var k in resp) keys.push(k)
for (var i = 0; i < keys.length; i++){
friendList.push(keys[i])
}
createConvoList()
})