Closed davidbauer closed 11 years ago
generateTweetEmbed()
is called inside generateEmbed()
which has no knowledge of tweeId
. You could add this variable as a third parameter to generateEmbed()
when calling it inside getLinks()
.
Addendum: When declaring variables without var
(like tweetembed
in generateTweetEmbed()
), they end up in the window's scope, which is usually not the desired outcome.
Implemented it as suggested (at least I think so), still doesn't work, though. What am I missing?
I get 404s on the API calls in generateTweetEmbed
.
Hm. Updated the url to Twitter API 1.1., didn't help. What else could be the cause? https://dev.twitter.com/docs/api/1.1/get/statuses/oembed
Looks like you have to use tweet.id_str
instead of tweet.id
.
manually requesting e.g. https://api.twitter.com/1.1/statuses/oembed.json?id=286411720862351360 responds with {"errors":[{"message":"Bad Authentication data","code":215}]} maybe related?
tweet.id_str
doesn't do the trick.
Depends on what you are testing. I got rid of the 404s using tweet.id_str
.
However, I'm not sure whether you can use an AJAX request to generate the tooltip content (since there is no immediate return value of generateTweetEmbed()
). I'd suggest to init the tooltip as a callback:
function initTooltip(tweetId, $tweet) {
$.getJSON('https://api.twitter.com/1/statuses/oembed.json?id=' + tweetId + '&callback=?', function(embed) {
$tweet.tooltip({ content: embed.html });
});
}
@dergraf I guess that ID is wrong (although that should return a different message). But I'm receiving a "Rate limit exceeded" anyway. Twitter API FTW...
Addendum: 1.1 does not support this syntax anymore: http://stackoverflow.com/questions/12684765/twitter-api-returns-error-215-bad-authentication-data
me too.
one thing noticed: $( ".tweet" ).tooltip({ content: generateTweetEmbed(tweetId) }) cannot work since we always override the tooltips. It's better to add an id to the tooltip div and operate on that id, at least we should be able to get some proper tooltips.
We are already caching the specific link element (or it's parent, respectively) using $tweet, that should be enough.
Whoups, I guess my function should be the following, since $tweet is the container of the link:
function initTooltip(tweetId, $tweet) {
$.getJSON('https://api.twitter.com/1/statuses/oembed.json?id=' + tweetId + '&callback=?', function(embed) {
$tweet.find('a').tooltip({ content: embed.html });
});
}
I would add the tooltip to the link instead of the container. Otherwise it's not positioned correctly und the hover area is too wide.
agree, can you do that?
Ok, I will do it tomorrow. If I figure out how to do a pull request... :flushed:
no worries it's not difficult. just fork the repo make your changes, commit and push. Back on Github you have a button for making a pull request. Am 04.01.2013 00:03 schrieb "Thomas Jaggi" notifications@github.com:
Ok, I will do it tomorrow. If I figure out how to do a pull request... [image: :flushed:]
— Reply to this email directly or view it on GitHubhttps://github.com/davidbauer/Twitter-Times/issues/13#issuecomment-11865107.
Perfect, sounds feasible. And it's about time, I suppose.
most code needed for this is added. however
tweetId
is undefined when used bygenerateTweetEmbed()
. looks like a scope-problem, but I can't figure out what to change. probably have to add areturn tweetId
somewhere, but where? @dergraf, @backflip