forked from jaredirish/Twitter-Friends-Map
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
38 lines (37 loc) · 1.56 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$(document).ready(function(){
twttr.anywhere(function (T) {
var currentUser,
screenName,
profileImage,
screenNameTemp,
profileImageTag;
if (T.isConnected()) {
currentUser = T.currentUser;
screenName = currentUser.data('screen_name');
profileImage = currentUser.data('profile_image_url');
profileImageTag = "<img src='" + profileImage + "'/>";
screenNameTemp = '<a class="logged-sn">'+screenName+'</a><div class="followers"></div>';
$(".twitter-login").append(profileImageTag + screenNameTemp);
twitterFriends = new TwitterFriends(screenName);
} else {
T(".twitter-login").connectButton({
authComplete: function(user) {
currentUser = user;
screenName = currentUser.data('screen_name');
profileImage = currentUser.data('profile_image_url');
profileImageTag = "<img src='" + profileImage + "'/>";
screenNameTemp = '<a class="logged-sn">'+screenName+'</a><div class="followers"></div>';
$(".twitter-login").append(profileImageTag + screenNameTemp);
$('.twitter-login iframe').remove();
twitterFriends = new TwitterFriends(screenName);
}
});
};
});
$('.sn-button').bind('click', function(){
var sn = $('.sn-input').val();
twitterFriends = new TwitterFriends(sn);
$('.sn-button').fadeOut();
$('.sn-input').fadeOut();
});
});