1/** 2 * Chargement de du sdk javascript facebook, initialisation et fonctions pour gérer la connexion via facebook 3 */ 4(function() { 5 window.fbAsyncInit = function() { 6 7 // Initialisation de FB 8 FB.init({ 9 appId : '937856456316593', 10 xfbml : true, 11 version : 'v2.6', 12// status : true, 13 cookie : true 14 }); 15 16 // Activation des evenements 17// FB.Event.subscribe('auth.statusChange', function(response) { 18// if (response.status === 'connected') { 19// console.log('connected'); 20// FB.api('/me?fields=first_name,last_name,email', function(response){ 21// console.log(response); 22// }); 23// } else if (response.status === 'not_authorized') { 24// console.log('not authorized'); 25// } else { 26// console.log('not logged in'); 27// } 28// }); 29 30 }; 31 32 (function(d, s, id){ 33 var js, fjs = d.getElementsByTagName(s)[0]; 34 if (d.getElementById(id)) {return;} 35 js = d.createElement(s); js.id = id; 36 js.src = "//connect.facebook.net/en_US/sdk.js"; 37 fjs.parentNode.insertBefore(js, fjs); 38 }(document, 'script', 'facebook-jssdk')); 39 40 41})(); 42 43// Callback du login au click du bouton 44function checkFBLoginState() { 45 FB.getLoginStatus(function(res) { 46 // Si on est connecté sur FB 47 if (res.status === 'connected') { 48 // On récupère, nom, prénom, email et id fb et on rempli le formulaire + redirect 49 FB.api('/me?fields=first_name,last_name,email', function(res){ 50 console.log(res); 51 $('#fb-fields .fb-firstname').val(res.first_name); 52 $('#fb-fields .fb-lastname').val(res.last_name); 53 $('#fb-fields .fb-email').val(res.email); 54 $('#fb-fields .fb-id').val(res.id); 55 $('.txtPopupLoginConchita .mandatory').removeClass('mandatory'); 56 $('#plug-myaccount-logme-in').click(); 57 }); 58 } 59 }); 60} 61 62function FBRegister() { 63 FB.getLoginStatus(function(res) { 64 // Si on est connecté sur FB 65 if (res.status === 'connected') { 66 // On récupère, nom, prénom, email et id fb et on rempli le formulaire + redirect 67 FB.api('/me?fields=first_name,last_name,email', function(res){ 68 $('#emigrantRegistration #emigrantPrenom').val(res.first_name); 69 $('#emigrantRegistration #emigrantNom').val(res.last_name); 70 $('#emigrantRegistration #email').val(res.email); 71 $('#emigrantRegistration #fb-id').val(res.id); 72 $('#emigrantRegistration .pwd').addClass('fb'); 73 $('#emigrantRegistration .pwd input').removeClass('mandatory'); 74
75 $('#emigrantRegistration .choixInscription').slideUp(); 76 $('#emigrantRegistration .innerForm').slideDown(); 77 }); 78 } 79 }); 80}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.