function login() {
FB.login(function(response) {
if (response.authResponse) {
var uid = response.authResponse.userID;
var access_token = response.authResponse.accessToken;
var signed_request = response.authResponse.signedRequest;
redirectToRegister(access_token, uid, signed_request);
}
else {
jAlert('Vous devez accepter les permissions pour continuer', "Attention");
}
}, {scope: 'email, user_likes'});
}
function redirectToRegister(access_token, uid, signed_request) {
var dest = "/psychoquiz/tabs/home?&access_token=" + access_token + "&uid=" + uid + "&time=1403973233&check_birth=1";
// var dest = "index?access_token="+access_token+"&uid="+uid+"&signed_request=" + signed_request +"&time=1403973233";
dest += "&signed_request=c4x9BQzozgNyjxojr-FwLeHMkT_PTJiCDEfBdB3ds_4.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTQwMzk3MzIzMSwicGFnZSI6eyJpZCI6IjE4NDU1OTU2ODI4OTM2NyIsImxpa2VkIjp0cnVlLCJhZG1pbiI6ZmFsc2V9LCJ1c2VyIjp7ImNvdW50cnkiOiJmciIsImxvY2FsZSI6ImZyX0ZSIiwiYWdlIjp7Im1pbiI6MTgsIm1heCI6MjB9fX0";
dest += "&isNewFan=0";
location = dest;
}
function redirectToFangate(access_token, uid, signed_request) {
socialshaker_ajax("/psychoquiz/tabs/isFan",
{
signed_request: signed_request,
access_token: access_token,
user_id: uid,
page_id: 184559568289367 },
'GET',
function(resp) {
dest += "?signed_request=c4x9BQzozgNyjxojr-FwLeHMkT_PTJiCDEfBdB3ds_4.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTQwMzk3MzIzMSwicGFnZSI6eyJpZCI6IjE4NDU1OTU2ODI4OTM2NyIsImxpa2VkIjp0cnVlLCJhZG1pbiI6ZmFsc2V9LCJ1c2VyIjp7ImNvdW50cnkiOiJmciIsImxvY2FsZSI6ImZyX0ZSIiwiYWdlIjp7Im1pbiI6MTgsIm1heCI6MjB9fX0&check_birth=1";
if (resp.action == 'index') {
dest += "";
}
dest += "&page_id=184559568289367&access_token=" + access_token + "&signed_request=" + signed_request;
location = dest;
});
}
$(document).ready(function() {
FB.init({appId: '436938556418755', oauth: true, status: true, cookie: true, xfbml: true});
$(".authorizationButton").click(function() {
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var access_token = response.authResponse.accessToken;
var signed_request = response.authResponse.signedRequest;
redirectToRegister(access_token, uid, signed_request);
}
else {
login();
}
});
return (false);
});
});
//});
$(document).ready(function() {
$('.authorizationButton').unbind();
$('#container .authorizationButton').click(function() {
login();
});
});
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-324665-29', 'appshaker.net');
ga('send', 'pageview');