Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var risp;
- var string = "";
- var stringOth = "";
- var objectID;
- var pageAccessToken;
- var rispostaPerToken;
- var stringinterno = "";
- var i;
- function statusChangeCallback(response) {
- console.log('statusChangeCallback');
- console.log(response);
- // The response object is returned with a status field that lets the
- // app know the current login status of the person.
- // Full docs on the response object can be found in the documentation
- // for FB.getLoginStatus().
- if (response.status === 'connected') {
- // Logged into your app and Facebook.
- prova();
- } else if (response.status === 'not_authorized') {
- // The person is logged into Facebook, but not your app.
- document.getElementById('status').innerHTML = "Si prega di effettuare il Login all'applcazione";
- } else {
- // The person is not logged into Facebook, so we're not sure if
- // they are logged into this app or not.
- document.getElementById('status').innerHTML = 'Per visualizzare la galleria effettuare Login a Facebook.';
- }
- };
- function checkLoginState() {
- FB.getLoginStatus(function(response) {
- statusChangeCallback(response);
- });
- }
- function prova(){
- FB.api(
- '/422454964453085/feed', {
- access_token : pageAccessToken
- },
- function (risp){
- var count=0;
- var link ="";
- //risp = response;
- for (i = 0; i < risp.data.length; i++){
- if (risp.data[i].type == "photo"){
- objectID = risp.data[i].object_id;
- obtainPic(objectID, i);
- }
- }
- $("#galleria").html(string);
- }
- )
- };
- function obtainPic(dato, i) {
- FB.api(
- '/' + dato, {
- access_token : pageAccessToken
- }, function (rispDue){
- link= rispDue.images[3].source;
- linkGrande = rispDue.images[0].source;
- if (rispDue.data[0].description == undefined){
- if (rispDue.data[0].message == undefined){
- stringinterno +="<div class='thumbnail col-sm-6 col-md-4 col-lg-4'><img class='imag' src='" + link + "'><div class='caption'><h3>" + rispDue.data[0].from.name + "</h3><p>" + rispDue.data[0].story + "</p></div></div>";
- } else {
- stringinterno +="<div class='thumbnail col-sm-6 col-md-4 col-lg-4'><img class='imag' src='" + link + "'><div class='caption'><h3>" + rispDue.data[0].from.name + "</h3><p>" + rispDue.data[0].message + "</p></div></div>";
- }
- } else {
- stringinterno +="<div class='thumbnail col-sm-6 col-md-4 col-lg-4'><img class='imag' src='" + link + "'><div class='caption'><h3>" + rispDue.data[0].from.name + "</h3><p>" + rispDue.data[0].description + "</p></div></div>";
- }
- }
- )
- }
- window.fbAsyncInit = function() {
- FB.init({
- appId : '866225023436362',
- cookie : true,
- xfbml : true,
- version : 'v2.3'
- });
- FB.getLoginStatus(function(response) {
- pageAccessToken = response.authResponse.accessToken;
- statusChangeCallback(response);
- });
- };
- (function(d, s, id) {
- var js, fjs = d.getElementsByTagName(s)[0];
- if (d.getElementById(id)) return;
- js = d.createElement(s); js.id = id;
- js.src = "http://connect.facebook.net/it_IT/sdk.js#xfbml=1&version=v2.3&appId=871644672893047";
- fjs.parentNode.insertBefore(js, fjs);
- }(document, 'script', 'facebook-jssdk'));
- function testAPI() {
- console.log('Welcome! Fetching your information.... ');
- FB.api('/me', function(response) {
- console.log('Successful login for: ' + response.name);
- document.getElementById('status').innerHTML =
- 'Thanks for logging in, ' + response.name + '!';
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement