Cleaned up snippet. x() prepares a message w/ timestamp and useragent.
- Calls
FB.getLoginStatus
and grabs theuserID
if available.
if (window["FB"]) {
r["dIsAPIAvailable"] = true;
if (window["FB"]["getLoginStatus"]) {
window["FB"]["getLoginStatus"](function(j) {
if (j["status"] === "connected") {
r["dUsrId"] = j["authResponse"]["userID"];
r["dIsLoggedInF"] = true;
r["dIsAppAuthorized"] = true;
} else if (j["status"] === "not_authorized") {
r["dIsLoggedInF"] = true;
r["dIsAppAuthorized"] = false;
} else {
r["dIsLoggedInF"] = false;
r["dIsAppAuthorized"] = false;
}
x();
});
}
} else {
r["dIsAPIAvailable"] = false;
x();
}
Seems to access the Google API via data stored in the global variable window['__jsl']
. You can see this variable being written in the original Google plus script https://apis.google.com/js/plusone.js
.
() {
try {
var f = {
dIsAPIAvailable: "NA",
dType: "NA",
dLang: "NA",
dIsLoggedInG: "NA",
dIsGPlUser: "NA"
};
if (!!window["___jsl"] && !!window["___jsl"]["cfg"]) {
f["dIsAPIAvailable"] = true;
f["dType"] = window["___jsl"]["cfg"]["deviceType"];
f["dLang"] = window["___jsl"]["cfg"]["llang"];
f["dIsLoggedInG"] = window["___jsl"]["cfg"]["isLoggedIn"];
f["dIsGPlUser"] = window["___jsl"]["cfg"]["isPlusUser"];
} else {
f["dIsAPIAvailable"] = false;
}
V({
"start": G2,
"end": new Date()[O]();
"action": G,
"url": (location["href"] || "")["substring"](L4h.K, 2000),
"userAgent": navigator["userAgent"],
"text": ftr__JSON3["stringify"](f)
});
} catch (A) {
E("error in ext " + G + " (run) [" + X + "]", A);
}
}