var access_token; function LoadFBSDk () { (function (d) { var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) { return; } js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/el_GR/all.js"; ref.parentNode.insertBefore(js, ref); } (document)); } function FBinit(){ FB.init({ appId: '680411745315810', status: false, // don't get info about the current user after init cookie: true, // enable cookies to allow the server to access the session xfbml: true, // find and initialize any social plugins that have been added using XFBML version: 'v2.6', // determine which Graph API version is used. oauth: true }); } function FBLogin(func_to_call, scope) { // https://developers.facebook.com/docs/facebook-login/permissions/v2.6 // obs: Apps that ask for more than public_profile, email and user_friends must be reviewed by Facebook before they can be made available to the general public. if (typeof (scope) === "undefined") { scope = { scope: "public_profile,email", auth_type: "rerequest" }; } func = function (response) { if (response.authResponse) { accessToken = response.authResponse.accessToken; func_to_call(); } else { console.log("User cancelled login or did not fully authorize."); } }; FB.login(func, scope); } function FBinitWillStatusandLike() { window.fbAsyncInit = function () { FB.init({ appId: '680411745315810', // Production //appId: 249589925215628, // test status: true, // check login status cookie: true, // enable cookies to allow the server to access the session xfbml: true // parse XFBML }); /* FB.Event.subscribe('edge.create', function (href, widget) { // alert('You liked the URL: ' + href); // doredirect(); WriteLike(); } );*/ }; } function PostMessage(msg, msgurl) { $('#errmsg1').text(''); FB.login(function (resp1) { if (resp1.authResponse) { FB.api( "/me/feed", "POST", { "message": msg, "link": msgurl, //lcfg.dataset[0].facebookpage "privacy": { "value": "SELF" } }, function (response) { if (response /*&& !response.error*/) { /* handle the result */ /// resfunc(); if (response.error) { $('#errmsg1').text(response.error); } else { alert('Έγινε το post. Δείτε το στην facebook σελίδα σας.'); } } } ); } }, { scope: 'publish_actions' }); /* FB.ui({ method: 'feed', link: 'https://developers.facebook.com/docs/dialogs/', caption: 'An example caption', }, function(response){alert(response)}); */ } function PostButton() { PostMessage($('#postspan').text(), function () { PostDone() } ); } function Checkin(msg, msgurl) { $('#errmsg1').text(''); FB.login(function (resp1) { if (resp1.authResponse) { FB.api( "/me/feed", "POST", { "message": msg, // "link": msgurl, //lcfg.dataset[0].facebookpage "place": '145691278971953', "privacy": { "value": "SELF" } }, function (response) { if (response /*&& !response.error*/) { /* handle the result */ /// resfunc(); if (response.error) { $('#errmsg1').text(response.error); } else { alert('Έγινε το checkin. Δείτε το στην facebook σελίδα σας.'); } } } ); } }, { scope: 'publish_actions' }); }