From e612f44895d3fdbd618977bd2015e8a4928c8c04 Mon Sep 17 00:00:00 2001 From: Galen Wolfe-Pauly Date: Mon, 11 Aug 2014 13:44:51 -0700 Subject: [PATCH] ok fine, now it works --- main/app/twit/app.js | 39 +++++++++++++++++++++++++++------------ main/app/twit/style.css | 4 ++++ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/main/app/twit/app.js b/main/app/twit/app.js index de921da3e6..9b17abd4e9 100644 --- a/main/app/twit/app.js +++ b/main/app/twit/app.js @@ -42,25 +42,43 @@ $(function() { appl:"twit", data:{tweet:tweet} }, function(err,res) { - console.log(arguments) $tweet.attr('disabled', false) $submit.attr('disabled', false) $submit.removeClass('disabled') + + _tweet = { + created_at: String(new Date()), + text: tweet, + pending: true + } + + console.log('set it') + console.log(_tweet) + + $time.prepend(renderTweet(_tweet)) + $tweet.val('') + setLength() }) }) + renderTweet = function(tweet) { + d = new Date(tweet.created_at) + datestr = d.getMonth()+1 + "-" + d.getDate() + "-" + d.getFullYear() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() + css = "tweet" + if(tweet.pending == true) + css += " pending" + $_tweet = $("
") + $_tweet.append("
@urbit_test
") + $_tweet.append("
"+datestr+"
") + $_tweet.append("
"+tweet.text+"
") + return $_tweet + } + renderTimeline = function(timeline) { $time.html("") for(i in timeline) { - tweets = timeline[i] - d = new Date(tweets.created_at) - datestr = d.getMonth()+1 + "-" + d.getDate() + "-" + d.getFullYear() + " " + d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds() - $tweet = $("
") - $tweet.append("
@urbit_test
") - $tweet.append("
"+datestr+"
") - $tweet.append("
"+tweets.text+"
") - $time.append($tweet) + $time.append(renderTweet(timeline[i])) } } @@ -79,9 +97,6 @@ $(function() { return if(res.data) { if(res.data[0]) { - window.tweets = res.data - console.log('render') - console.log(res.data) renderTimeline(res.data) } if(res.errors) { diff --git a/main/app/twit/style.css b/main/app/twit/style.css index 5c79cdfe26..7a56bfb99f 100644 --- a/main/app/twit/style.css +++ b/main/app/twit/style.css @@ -116,6 +116,10 @@ textarea:focus { color: #888; } +.pending { + opacity: .3; +} + .error { color: #FF5F5F; letter-spacing: .06rem;