1/** 2 * 3 * @author 4 * 5 * @project cheznoo.net 6 * 7 * @date Monday, 06 October 2014 8 * 9 */ 10 11var url = ''; 12 13// // Additional JS functions here 14// window.fbAsyncInit = function() { 15// FB.init({ 16// appId : APP_ID, // App ID 17// cookie : true, // enable cookies to allow the server to access the session 18// cache: false, 19// version : 'v3.1' 20// // parse XFBML 21// }); 22// }; 23function fbInit(callback) { 24 $.ajaxSetup({ 25 cache : false 26 }); 27 $.getScript('https://connect.facebook.net/en_US/sdk.js', function() { 28 FB.init({ 29 appId : APP_ID, 30 cookie : true, 31 version : 'v17.0' 32 }); 33 34 callback(); 35 }); 36 37} 38 39function revoqueApp() { 40 // Additional init code here 41 FB.getLoginStatus(function(response) { 42 if (response.status === 'connected') { 43 FB.api("/me/permissions", "DELETE", function(response) { 44 console.log(response); // gives true on app delete success 45 }); 46 } else if (response.status === 'not_authorized') { 47 // not_authorized 48 facebookSignIn(); 49 } else { 50 // not_logged_in 51 facebookSignIn(); 52 } 53 }); 54 return false; 55 56} 57 58function facebookSignUp() { 59 FB.getLoginStatus(function(response) { 60 if (response.authResponse) { 61 FB.api('/me', function(response) { 62 var redirectUri = WEBSITE_URL + 'sign-up/xhr-facebook-sign-up'; 63 64 var loc = redirectUri; // or a new URL 65 window.location.href = loc + '?n=' + new Date().getTime(); 66 67 }); 68 } 69 70 else { 71 FB.login(function(response) { 72 if (response.authResponse) { 73 FB.api('/me', function(response) { 74 var redirectUri = WEBSITE_URL 75 + 'sign-up/xhr-facebook-sign-up'; 76 window.location = redirectUri; 77 78 }); 79 } 80 return false; 81 }, { 82 scope : 'email' 83 }); 84 } 85 return false; 86 87 }); 88} 89 90function facebookSignIn() { 91 92 FB.login(function(response) { 93 if (response.authResponse) { 94 FB.api('/me', function(response) { 95 var fbuid = response.id; 96 var data = new Object(); 97 data = { 98 fbuid : fbuid 99 }; 100 $.post(WEBSITE_URL + 'sign-in/xhr-facebook-sign-in', data, 101 function(o) { 102 if (o.success != 1) { 103 facebookSignUp(response); 104 } else { 105 if (typeof mySection !== 'undefined') { 106 self.setTimeout('self.location.href = \'' 107 + WEBSITE_URL + mySection + '/' 108 + mySectionType + '\''); 109 } else { 110 self.setTimeout('self.location.href = \'' 111 + WEBSITE_URL + '\''); 112 } 113 } 114 return false; 115 }); 116 return false; 117 }, { 118 scope : 'email' 119 }); 120 } 121 return false; 122 }, { 123 scope : 'email' 124 }); 125 return false; 126} 127 128function shareFacebook(url) { 129 // Additional init code here 130 FB.getLoginStatus(function(response) { 131 if (response.status === 'connected') { 132 console.log(url); 133 // connected 134 FB.ui({ 135 method : 'share', 136 href : url, 137 }, function(response) { 138 if (response && !response.error_code) { 139 alert('Posting completed.'); 140 } else { 141 alert('Error while posting.'); 142 } 143 }); 144 145 } else if (response.status === 'not_authorized') { 146 // not_authorized 147 facebookSignIn(); 148 } else { 149 // not_logged_in 150 facebookSignIn(); 151 } 152 }); 153 return false; 154}
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.