You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
588 B

var email, sessionKey, sessionVal;
function onSignIn(googleUser){
var profile = googleUser.getBasicProfile();
email = profile.email;
//
sessionKey = email;
sessionVal = localStorage.getItem(sessionKey);
}
function doAuthCheck(){
if (sessionVal != "in") {
alert("authError!");
} else {alert("auth successful")}
}
$(window).load(function ()
{
var i = setInterval(function ()
{
if ($('#foo').length)
{
clearInterval(i);
// safe to execute your code here
doAuthCheck();
}
}, 2000);
});