Last active
August 29, 2015 13:56
-
-
Save marcojetson/8806021 to your computer and use it in GitHub Desktop.
Detect if visitor is logged into Google, Google Plus, Taringa! or Twitter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check<Service>Status([ onSuccess, onFailure ]); | |
// i.e checkTaringaStatus(function () { alert('+10'); }); | |
(function () { | |
var checkServiceStatus = function (image, success, error) { | |
return function (success, error) { | |
var img = new Image(); | |
img.onload = success || function () {}; | |
img.onerror = error || function () {}; | |
img.src = image; | |
}; | |
}; | |
window.checkGoogleStatus = checkServiceStatus("https://accounts.google.com/CheckCookie?continue=https%3A%2F%2Fwww.google.com%2Fintl%2Fen%2Fimages%2Flogos%2Faccounts_logo.png&followup=https%3A%2F%2Fwww.google.com%2Fintl%2Fen%2Fimages%2Flogos%2Faccounts_logo.png&chtml=LoginDoneHtml&checkedDomains=youtube&checkConnection=youtube%3A291%3A1"); | |
window.checkGooglePlusStatus = checkServiceStatus("https://plus.google.com/up/?continue=https://www.google.com/intl/en/images/logos/accounts_logo.png&type=st&gpsrc=ogpy0"); | |
window.checkTaringaStatus = checkServiceStatus("https://www.taringa.net/login?redirect=/img/logo.png"); | |
window.checkTwitterStatus = checkServiceStatus("https://twitter.com/login?redirect_after_login=%2Fimages%2Fspinner.gif"); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Validation error: update
&
to&