//该方法用于乱码时转码
function encode(str)
{
var len = str.length;
var scill='';
var isSkip=false;
for(var i=0;i<len;i++)
{
if(str.charAt(i)=="<")
{
isSkip=true;
}
if(isSkip)
{
scill += str.charAt(i);
}else{
scill += "&#"+str.charCodeAt(i)+";";
}
if(str.charAt(i)==">")
{
isSkip = false;
}
}
return scill;
}
FB.ui(
{
method: 'stream.publish',
message: ‘玩家可输入的文字’,
uid: ‘用户的FBID’,
target_id: ‘接收方的FBID’,
attachment: {
name: 'Feed名称',
caption: '标题',
href: '名称链接',
description: ('描述'),
properties: {
'子链接1':{ text: '子链接文字', href: '子链接URL'},
'子链接2':{ text: '子链接文字', href: '子链接URL'},
'子链接3':{ text: '子链接文字', href: '子链接URL'},
},
media: [
{
'type':'image',
'src':'图片地址',
'href':'图片链接URL'
}
]
},
action_links: [
{ text: '右下角链接文字', href: '右下角链接URL'} ]
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);