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:

tags_before.png

New:
tags_after.png

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 = "most recent
#" + communityinfo.result.title + " posts
"
+ 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!

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Ecency