',{'class': 'overlay'}),
template = d['template'] || '
',
box = d['template_id'] || '.box',
close = d['close'] || "a[rel*='dialog_close']",
title = d['title'] || '處理中..',
html = d['html'] || '',
display = d['display'] || false,
width = d['width'] || 560,
height = d['height'] || 0,
top = d['top'] || '',
left = d['left'] || '',
preload = d['preload'] || '',
callback = d['callback'] || '';
wrap.children().remove();
wrap.prepend(overlay, $(template)).hide();
wrap.find('.content').html(html);
wrap.find('.title').html(title);
if(display){
overlay.css({'width': $(document).width(), 'height': $(document).height()}).show();
$(box).find('.message').css({'width': width - 50})
$(box).css({'width': width,'height': (height ? height : $(box).outerHeight() + 33)});
var boxHeight = $(box).outerHeight() >= 400 ? ($(box).outerHeight() / 2) : $(box).outerHeight();
$(box).css({'left': (left ? left : (wrap.parent().outerWidth() / 2) - ($(box).outerWidth() /2 )) , 'top': (top ? top : (wrap.parent().height() / 2) - boxHeight)}).show();
wrap.show();
$(window).resize(function(){
overlay.css({'width': $(document).width(), 'height': $(document).height()}).show();
$(box).css({'left': (left ? left : (wrap.parent().outerWidth() / 2) - ($(box).outerWidth() /2 )) , 'top': (top ? top : (wrap.parent().height() / 2) - boxHeight)}).show();
})
if(preload instanceof Function)preload.call();
}else{
wrap.children().remove();
overlay.hide();
}
if(typeof d['html'] != 'undefined' && d['html'] != null){
$(close).bind('click',function(){
if(callback instanceof Function)callback.call();
wrap.children().remove().hide();
overlay.hide();
});
}
}
function in_array(value,array){
if(typeof value == 'number' || typeof value == 'string'){
for(var i in array){
if(array[i] == value){
return true;
}
}
}
return false;
}
function isUndefined(v){
return typeof v == 'undefined' || '' == v || v == null ? true: false;
}
window.fbAsyncInit = function() {
FB.init({
appId : '247316622082258',
status : true,
cookie : true,
xfbml : true,
channelURL : 'http://web.gamecyber.net/gcFacebook/apps/sd_activity_11/channel.htm',
oauth : true
});
FB.getLoginStatus(function(r){
if(r.authResponse == null){
window.top.location.href = requireuri;
}else{
document.getElementById('wrap').style.display = 'block';
var perms = scope.split(',');
for(var i in perms){
FB.api({method: 'users.hasAppPermission',uid: r.authResponse.userID,ext_perm:perms[i]},function(perms_result){
if(perms_result == 0){
window.top.location.href= requireuri + '&fbconnect=1';
}
});
}
$.post('json.php',{get:true},function(result){
if(result.status){
var currentTime = new Date();
var day = currentTime.getDay();
day = day == 0 ? 1 : day;
$('.count').html(result.amount);
FB.api({method:'fql.query',query:'SELECT uid2 FROM friend WHERE uid1 = me()',access_token: r.authResponse.accessToken}, function(friends){
FB.api({method : 'friends.getAppUsers',access_token: r.authResponse.accessToken},function(friends_isUser_id){
var count = 0;
for(var key in friends){
if(in_array(friends[key].uid2,friends_isUser_id)){
count++;
}
}
FB.api('/me', function(userdata) {
var params = {
method: 'feed',
name: '《新熱血籃球》',
message: 'NBA經理:'+ userdata.name +'\n 目前氣勢:'+ result.amount +'\n人氣度:'+ (parseInt(result.amount) + count) * day +'\n\n 熱血經理人 '+ userdata.name +'正在為他的籃球球會造勢!如果你是他的朋友,趕快來看看他的球隊,點擊讚好來支持他吧!\nhttp://goo.gl/LDhl1',
link: 'http://sd.gamecyber.net',
picture: 'http://web.gamecyber.net/gcFacebook/themes/sd/activity_11/images/600x450.jpg',
caption: 'sd.gamecyber.net',
description: '熱血經理人 '+ userdata.name +'正在為他的籃球球會造勢!如果你是他的朋友,趕快來看看他的球隊,點擊讚好來支持他吧!\nhttp://goo.gl/LDhl1'
};
FB.api('/me/feed', 'post', params , function(response){
if (!response || response.error){}
$('.code').html(result.code);
});
});
});
});
}
},'json');
}
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/zh_HK/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));