/**
*
*/
refleshOnline : function(){
var _this = this;
if(this.initData.fansIds){
this.showFans(this, this.initData.fansIds);
} else {
FB.api('/me/friends', function(response) {
if(response.data) {
_this.alertMessage('get friend ids success');
_this.initData.fansIds = [];
$.each(response.data,function(index, friend) {
_this.initData.fansIds.push(friend.id);
});
_this.showFans(_this, _this.initData.fansIds);
} else {
_this.alertMessage('get friend ids failure');
_this.initData.fansLoop++;
if (_this.initData.fansLoop <= 3) {
_this.refleshOnline();
}
}
});
}
},
/**
* 显示好友
*
* @obj _this
* @array fans_uids
*/
showFans : function(_this, fans_uids){
var _postData = {'action' : 'reflesh', 'USERNAME' : _this.initData.playerName, 'uid' : _this.initData.playerId, 'fans_ids' : fans_uids};
_this.post('ajax_get.php', _postData, function(data){
var response = JSON.parse(data);
$('#gamefans').show();
$('#onlineusers').empty();
var index = 0;
$('#onlineusers').append("<li style=\"width: 16px; padding: 0pt 2px 2px; background: none repeat scroll 0% 0% rgb(96, 175, 5); color: rgb(255, 255, 255);\">On Line</li>");
for(var uid in response['data']){
$('#onlineusers').append("<li id=\"tips_" + index + "\">"+"<a href='http://www.facebook.com/profile.php?id="+uid+"' target='_blank' alt='" + response['data'][uid].first_name + "'> <img border=0 src='"
+ "https://graph.facebook.com/" + uid + "/picture" + "' alt='" + response['data'][uid].first_name + "'/></a><br/><a href=\"http://www.weibo.com/"+uid+"\" target=\"_blank\" title='"+response['data'][uid].first_name +"'>"
+ _this.subUserName(response['data'][uid].first_name) + "</a><a href=\"javascript:;\" onclick=\"Atlantis.addFriends('"+response['data'][uid].uid+"',this)\" class=\"log_add\">+ Add Friends</a></li>");
index++;
}
});
},
/**
*
* @string uid
* @obj element
*/
addFriends : function(uid,element){
var _this = this;
FB.ui({method: 'friends.add',id: uid}, function(param){
// If they cancel params will show:
// {action:false, ...}
// and if they send the friend request it'll have:
// {action:true, ...}
// and if they closed the pop-up window then:
// param is undefined
if (param != 'undefined' && param.action == true) {
_this.initData.fansIds.push(uid);
$(element).addClass('log_concerned').empty().append('<em>√</em>Self Friend').removeAttr("onclick");
}
});
},
/**
* 截取字符串
*
* @param username
*/
subUserName : function(username){
if(username.length < 10)
return username;
return username.substring(0, 10) + "...";
},
分享到:
相关推荐
JavaScript实现一键分享到微博、QQ空间、QQ好友、微信、腾讯微博、豆瓣、Facebook、Twitter、Linkedin、Google+、点点等 JavaScript实现一键分享到微博、QQ空间、QQ好友、微信、腾讯微博、豆瓣、Facebook...
fb-hfc, Facebook隐藏好友爬虫 fbFacebook隐藏好友 crawler Priel -用于Facebook隐藏好友漏洞的POC免责声明:这里工具仅用于教育目安装:你需要:apt安装 python-lxmlpip安装 seleniumpip安装请求p
平台包括:facebook, twitter ,whatsapp, email, linkedin , Pinterest, telegram, reddit, tumblr,proket, line, Qzon, weibo, 等等,只要你能想到的都支持
Jest来自facebook的JavaScript测试,Jest虚拟化JavaScript环境,提供了浏览器模拟,并在workers上并行运行测试
Facebook 现在有 4 亿用户,其中或许有你的同学、同事、或者老乡,除了这些你认识的老朋友之外,你还可以在 Facebook 上结交一些新朋友。 那么,如何在 Facebook 上寻找新老朋友呢?你可以使用以下 10 个 Facebook ...
使用volley里的NerworkImageView实现facebook的带图feed
NULL 博文链接:https://mozhenghua.iteye.com/blog/1218888
Facebook 开源动画库 POP 实现真实衰减动画
facebook 分享文档 twitter 分享文档 vue 使用 facebook 使用分享 找到index.html 添加一下代码 <!-- facebook 分享 --> <div id=fb-root></div> [removed](function (d, s, id) { var js, fjs = d....
facebook批量加好友,按照压缩包里面的文档,安装插件,运行脚本实现facebook,按照随机时间批量申请好友。
Django-facebook, 在 python 中,Facebook开放图api使用 Django 框架实现了 基于 Thierry Schellenbach ( mellowmorning.com ) 的 Django 状态现在,Django 和Facebook都在迅速改变。 同时,我在一个初创公司上班,...
使用自定义的按钮,实现Facebook授权登陆,跳转后显示用户的信息,并且在跳转后的页面可以选择退出登陆。代码简洁,很容易理解。
facebook-like-button, Facebook社交插件'Like'的实现 Facebook like-button 的Facebook'像'社交插件插件的实现。官方的 Facebook没有为Android提供这样的组件。这个库使用 WebView 来显示 <iframe> 插件。...
JS分享代码 全功能 支持facebook twitter等 可结合移动端页面!
NULL 博文链接:https://hfutfei.iteye.com/blog/747570
fluxy, 一种Facebook架构流量的实现 #Fluxy一种facebook架构流量的实现。##Introductionfacebook团队有一个关于流量管理的简介,包含在React文档 documentation 。 把传统的MVC方法引入到客户机端web服务中,用相同
Facebook 数据库 java 用户信息存储提取
GraphQL.js是GraphQL的JavaScript参考实现,GraphQL是Facebook创建的API的查询语言。