JSFiddle - React, Tailwind, and code Playground

by joplomacedo

JavaScript

function isValidTweets(ts_titletweets) {
    var widgetid = $('#TweetStuff').attr('data-widget-id');

    var ids = {
        'jack': fooID,
        'jill': longreadsID,
        'harry': thinkprogressID
    };


    var ts_titletweets = title.toLowerCase(); //title is parsed from URL elsewhere
    validtweets = "jack|jill|harry"; // if the title doesn't match then no streams should be used
    if (validtweets.indexOf(ts_titletweets.toLowerCase() + "|") > -1) {

        console.log('TweetsEnabled');

        widgetid = ids[ts_titletweets];
        console.log(widgetid + title);


        $('#TweetStuff').html("<a class=\"twitter-timeline\" width=\"500\" height=\"600\" data-widget-id=" + widgetid + "></a>");

        $("#newTweetsButton").delay(3000).show(0);
        $("#filters").css({'margin' : '-30px 0px 0px 0px'});
        return true;

    } console.log('no Tweets'); 
    return false;

}