// FBauthStatus = unknown & # 39 ;;
//connect.facebook.net/sv_SE/sdk.js
// Load the SDK asynchronously
(function (d, s, id) {
var js, fjs = d.getElementsByTagName (s) [0];
if (d.getElementById (id)) returns;
js = d.createElement (s); js.id = id;
js.src = "http://connect.facebook.net/sv_SE/sdk.js#xfbml=1&version=v2.7&appId=108580689240322";
fjs.parentNode.insertBefore (js, fjs);
} (document, 'script', 'facebook-jssdk'));
window.fbAsyncInit = function () {
FB.init ({
appId: & # 39; 108580689240322 & # 39;
channelURL: // www.gamereactor.se/fbchannel.php' ;,
status: true,
cookie: true,
xfbml: true,
oauth: true,
version: & # 39; v2.7 & # 39;
});
if (typeof (postReview) == "function")
postReview ();
FB.Event.subscribe (& # 39; edge.create & # 39; function (targetUrl) {
_gaq.push ([‘_trackSocial’, ‘Facebook’, ‘Like’, targetUrl]);
});
FB.Event.subscribe (& # 39; edge.remove & # 39; function (targetUrl) {
_gaq.push ([‘_trackSocial’, ‘Facebook’, ‘Unlike’, targetUrl]);
});
FB.Event.subscribe ('message.send', function (targetUrl) {
_gaq.push ([‘_trackSocial’, ‘Facebook’, ‘Send’, targetUrl]);
});
}
document.addEventListener ("DOMContentLoaded", function () {
DrawFacebookLikeNotification ();
});
function FastRegister () {
ajaxAgreementsPopUp ();
if (typeof isSmartphoneLayout! = & # 39; undefined & & 39; && isSmartphoneLayout)
window.location = & # 39; / join & # 39 ;;
other {
$ .ajax ({
type: "POST",
url: "/ajaxstuff/fastRegister.php",
data: {session: {"screated": 1533059921, "updated": 1533059921, "countdownToAd": "0_1533060521"}}
})
.done (function (code) {
$ (# Re_loginbox #); replaceWith (code);
// console.log (code);
$ (& # 39 ;. loginWrapper & # 39;). show ();
})
.fail (function (jqXHR, msg) {
console.log ("failed request");
$ (selectorForLoginMessage) .text (msg) .show ();
});
}
return false;
}
function FastRegisterResponse () {
$ .ajax ({
type: "POST",
url: "/ajaxstuff/fastRegister.php",
})
.done (function (code) {
$ (# Re_loginbox #); replaceWith (code);
// console.log (code);
$ (& # 39 ;. loginWrapper & # 39;). show ();
})
.fail (function (jqXHR, msg) {
console.log ("failed request");
$ (selectorForLoginMessage) .text (msg) .show ();
});
return false;
}
function LoginWithFacebook (selectorForLoginMessage, fbUpdateUser) {
FB.login (function (response) {
if (response.authResponse) {
FB.api (& # 39; / me & # 39 ;, {fields: & # 39; email, last name, last name, first name & # 39;}, function (user) {
var main = false;
if (user &&! user.error) {
// console.log (user);
if (selectorForLoginMessage == & # 39; # fbLoginMessageMain & # 39;)
main = true;
$ .ajax ({
type: "POST",
url: "/ajaxstuff/fblogin.php",
data: {userobj: user, fbUpdateUser: fbUpdateUser, main: main}
})
.done (function (code) {
if (main) {
console.log ("is connected" + code);
if (code == 0) {
if (! $ ('signin'). hasClass ('active-signin')) {
$ (& # 39 ;. signin & # 39;). addClass (& # 39; active-signin & # 39;);
if ($ (& # 39 ;. login). hasClass (& # 39; active-login & # 39;)) {
$ (& # 39 ;. login & # 39;). removeClass (& # 39; active-login & # 39;);
var request = new GRAsync ();
var path = /ajaxstuff/join.php? ajaxRequest & # 39 ;;
request.setUrl (path)
.setSelectors ($ (# joinContainer & # 39;))
.setData ({register: true, facebookUser: user})
.setDataType (& # 39; html & # 39;)
.setType (& # 39; POST & # 39;)
. send a request ();
}
}
}
other {
window.location = "/";
}
}
other{
$ (# Re_loginbox #); replaceWith (code);
$ (& # 39 ;. loginWrapper & # 39;). show ();
location.reload (true);
}
})
.fail (function (jqXHR, msg) {
console.log ("failed request");
$ (selectorForLoginMessage) .text (msg) .show ();
});
}
});
} other {
// console.log (& # 39; Login canceled by the user or did not fully allow. & # 39;);
}
}, {scope: & # 39; email, publish_actions & # 39;});
// TODO: Do not ask publish_actions by default. This could scare some users. Ask later, when they really want it.
return false;
}
function AddSearchParamsAndReload (newParamStr) {
var newParamArr = newParamStr.split ("&");
if (window.location.search.length> 1) {// does not count the initial "?"
var oldParams = window.location.search.substr (1) .split ("&");
var paramsToAdd = [];
for (var j = 0; j <newParamArr.length; j ++) {
var found = false;
for (var i = 0; i <oldParams.length; i ++)
if (newParamArr [j] == oldParams [i])
found = true;
if found)
paramsToAdd.push (newParamArr [j]);
}
if (! paramsToAdd.length)
window.location.reload ();
other
window.location.search + = & # 39; && # 39; + paramsToAdd.join ("&");
}
other
window.location.search = & # 39;? & # 39; + newParamStr;
}
[ad_2]
Source link