PageSourceSearch

https://www.jamesnottingham.co.uk/scripts/facebook.js?cdv=340928959

js jamesnottingham.co.uk collected 2026-10-01 14:43:29 UTC 3,352 bytes, 96 lines download raw bytes

1var statusResponse = "";
2
3// This is called with the results from from FB.getLoginStatus().
4function checkLoginState() {
5    FB.getLoginStatus(function (response) {
6        statusHandleCallback(response);
7    });
8}
9
10function statusHandleCallback(response, returnUrl, scrollTo, modal) {
11    // The response object is returned with a status field that lets the
12    // app know the current login status of the person.
13    // Full docs on the response object can be found in the documentation
14    // for FB.getLoginStatus().
15
16    if (response.status === 'connected') {
17        // Logged into your app and Facebook.
18        // Do a post to the server to finish the logon
19        // This is a form post since we don't want to use AJAX
20
21        var uid = response.authResponse.userID;
22        var accessToken = response.authResponse.accessToken;
23
24        var form = document.createElement("form");
25        form.setAttribute("method", 'post');
26        form.setAttribute("action", '/FacebookLogin.ashx?returnUrl=' + returnUrl + '&scrollTo=' + scrollTo + '&modal=' + modal);
27
28        var field = document.createElement("input");
29        field.setAttribute("type", "hidden");
30        field.setAttribute("name", 'accessToken');
31        field.setAttribute("value", accessToken);
32        form.appendChild(field);
33
34        document.body.appendChild(form);
35        form.submit();
36
37    } else if (response.status === 'not_authorized') {
38        FB.login(function (response) {
39            statusHandleCallback(response);
40        });
41    } else {
42        FB.login(function (response) {
43            statusHandleCallback(response);
44        });
45    }
46}
47
48window.fbAsyncInit = function () {
49    FB.init({
50        status: true,
51        appId: '494562287386081',
52        //appId: '494562287386081',
53        cookie: true,  // enable cookies to allow the server to access 
54        // the session
55        xfbml: true,  // parse social plugins on this page
56        version: 'v2.2' // use version 2.2
57    });
58
59    // Now that we've initialized the JavaScript SDK, we call 
60    // FB.getLoginStatus().  This function gets the state of the
61    // person visiting this page and can return one of three states to
62    // the callback you provide.  They can be:
63    //
64    // 1. Logged into your app ('connected')
65    // 2. Logged into Facebook, but not your app ('not_authorized')
66    // 3. Not logged into Facebook and can't tell if they are logged into
67    //    your app or not.
68    //
69    // These three cases are handled in the callback function.    
70
71    FB.getLoginStatus(function (response) {
72        statusResponse = response;
73    });
74};
75
76// Load the SDK asynchronously
77(function (d, s, id) {
78    var js, fjs = d.getElementsByTagName(s)[0];
79    if (d.getElementById(id)) return;
80    js = d.createElement(s); js.id = id;
81    js.src = "//connect.facebook.net/en_US/sdk.js";
82    fjs.parentNode.insertBefore(js, fjs);
83}(document, 'script', 'facebook-jssdk'));
84
85//bind facebook login buttons
86$(function () {
87
88    $('.facebook-login').click(function () {
89        var returnUrl = $(this).attr("data-returnurl");
90        var scrollTo = $(this).attr("data-scrollTo");
91        var modal = $(this).attr("data-openmodal");
92
93        console.log("returnUrl: " + returnUrl);
94        statusHandleCallback(statusResponse, returnUrl, scrollTo, modal);
95    });
96});

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.