JSFiddle - React, Tailwind, and code Playground

by BurpmanJunior

CSS

body{
    font-family: monospace;
}

JavaScript

/**
 * Facebook Feed
 */

//https://graph.facebook.com/343818792347996/posts?fields=story,message,created_time,likes,comments&limit=10&access_token=

var _a = '1680286135537038|vOBi5Xtk0xytkN4x-gm8mAvjQWE';

var fbFeed = fbFeed || {};
fbFeed.init = function (c) {
    fbFeed.conf = {
        limit: 10,
        key: null,
        pageId: null
    }
    fbFeed.conf = fbFeed.mergeObj(fbFeed.conf, c);
    fbFeed.pullPosts();
}
fbFeed.pullPosts = function (limit) {
    if (typeof fbFeed.conf.key === 'undefined' || typeof fbFeed.conf.pageId === 'undefined') {
        return false;
    }
    var l = fbFeed.conf.limit;
    if (typeof limit === 'number') {
        l = limit;
    }
    $.getJSON(
        'https://graph.facebook.com/' + fbFeed.conf.pageId + '/posts?fields=link,story,message,created_time,likes,comments&limit=' + fbFeed.conf.limit + '&access_token=' + fbFeed.conf.key,
        {},
	function (data) {
        if (typeof data.data === 'object') {
            console.log(data);
            for (var i = 0; i < data.data.length; i++) {
                var p = fbFeed.parsePost(data.data[i]);
                if (p) {
                    $('body').append('<p>ID: '+p.id+'<br /> Link: <a href="'+p.link+'" target="_blank">'+p.link+'</a><br /> Message: '+p.message+'<br /> Date: '+fbFeed.formatDate(p.date)+'<br /> Likes: '+p.likes+'<br /> Comments: '+p.comments+'<br /> </p>');
                }
            }
        }
    });
}
fbFeed.parsePost = function (p) {
    if (typeof p !== 'object' || typeof p.story !== 'undefined') {
        return false;
    }
    var l = 0;
    if (typeof p.likes === 'object') {
        l = p.likes.data.length;
    }
    var c = 0;
    if (typeof p.comments === 'object') {
        c = p.comments.data.length;
    }
    return {
        id: p.id,
        link: p.link,
        date: new Date(p.created_time),
        message: p.message,
        likes: l,
        comments: c
    };
}
fbFeed.mergeObj = function (o1, o2) {
    var output = {};
    for...