personal.community devwork - Day 02/30 - chips
yesterdays updates on personal.community focused on making sure new posts and comments worked, and making those a little bit nicer appearing...
todays work was making communities displayed in the "interests" section more appealing to the eye...
Old:
New:
basically I had to throw together a if tag name started with hive- , make it look pretty and fetch some data about the community,... this can be achieved with the following code
if (tag.substring(0, 5) == "hive-") {
console.log("community found in interests at " + tag);
var xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
let communityinfo = JSON.parse(xhr.responseText)
console.log("at bat " + communityinfo.result.title);
let contentofTag = document.getElementById("display").innerHTML;
document.getElementById("display").innerHTML = "<small>most recent</small><div style='font-size: 300%; padding: .1em; margin: .2em'>#" + communityinfo.result.title + " posts</div><br />" + contentofTag;
}};
var data = '{"jsonrpc":"2.0", "method":"bridge.get_community", "params":{"name":"'+ tag +'","observer":"blokz"}, "id":1}';
xhr.send(data);
}
a chunk of that was copy pasta from https://reqbin.com/curl , which let me take the CURL request from bridge.get_community (hive api docs) and make it javascripty..
I'm definitely coding javascript all wrong, and I'm realizing I should spend some more time learning proper methods of coding... but hey, its working! LoL, just dont look at my code here.
Laughable "log" for day 1 can be found here, which is really more of a shitpost on what I was working on without really showing the actual tutorial of how I did what I said I did... just ignore it, but know this 30 day challenge of working on personal.community is a go!
Comments