JSFiddle - React, Tailwind, and code Playground

by zainshaikh

HTML

<div id='te'>

</div>

CSS

ul.partss li {display:block}
ul li img {display: none}
</style>
<script src="http://platform.twitter.com/anywhere.js?id=GxXCqL57G7JeuSgsTlPg&v=1" type="text/javascript"></script>
<style>

JavaScript

window.log = function(text) {
    window && window.console && window.console.log(text);
}

function r(max, min) {
    min = min || 0;
    return Math.floor(Math.random() * (max - min + 1)) + min
}


window.h = new HootSuitePoster();
window.h.init();


function Poem() {
    this.id = 0;
    this.name = '';
    this.url = '';
    this.couplets = [];
    this.prepared_couplets = [];
}

function Writer() {

    this.id = 0;
    this.name = '';
    this.url = '';
    this.poems = [];

}


window.getSelectedPoem = function() {

    var w = find(h.d.writers, h.d.selectedWriterId);

    var p = find(w.poems, h.d.selectedPoemId);

    return p;
}


window.find = function(items, identifier) {
    var found = $.grep(items, function(n, i) {
        return n.id == identifier;
    });
    return found ? found[0] : null;
}


function HootSuitePoster() {
    this.d = null

    var self = this;
    this.init = function() {





        log('HootSuitePoster.init');

        self.d = new DataFetcher();
        log(self.d);

        self.d.chosen = function(text) {
            log('chosen:');
            log(text);

            if (window.location.toString().indexOf('autopost') > -1) {
                self.post(text);
            }
        }

        self.d.init()


    }



    this.post = function(text) {
        log('post');
        log(text);




        // The twttr.anywhere does similar to FB.init, but you use it like jQuery.ready
        twttr.anywhere(function(T) {
            // The T object seems to be a subset of jQuery (or Ender)
            // Includes Sizzle, Ajax, and some custom 
            var tweet = text; //$(this).find('input[name=tweet]').val();
            // T.requireConnect is similar to FB.login
            // may spawn a pop-up, so be sure to fire from user-event
            T.requireConnect(function() {
                T.Status.update(tweet, {
                    success: function(tweet) {
                        // (-:
                        log('tweet...