Created
October 23, 2018 18:20
-
-
Save bendalton/6f24a629d2488b324daca2ffe859568e to your computer and use it in GitHub Desktop.
SSO
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
javascript:(function() %7B%0A var location %3D window.location %2B ""%3B%0A var loc %3D location.split("%2F")%3B%0A loc.length %3D 3%3B%0A var baseUrl %3D loc.join("%2F")%3B%0A if(baseUrl.match("accounts%5C.google%5C.com"))%7B%0A window.location %3D "https%3A%2F%2Fconsole.developers.google.com%2Fapis%2Fcredentials%2Foauthclient%2F610022916260-k8n7s5nv60o9r0jeosessf7f1jq8hda6.apps.googleusercontent.com%3Fproject%3D610022916260"%3B%0A %7Delse%7B%0A tryUnityUrl(baseUrl)%3B%0A %7D%0A%0Afunction tryUnityUrl(baseUrl)%7B%0A var l %3D new jsLoader()%3B%0A var testUrl %3D baseUrl %2B "%2Fconfig.js"%3B%0A l.require(testUrl%2C800%2Ctrue%2Cfunction()%7B%0A goSSO(baseUrl)%0A %7D%2Cfunction()%7B%0A var newUrl %3D prompt("Looks like you aren%27t on a Unity site%2C enter the site you are trying to reach (e.g.%2C demo.rideamigos.com)")%3B%0A if(!newUrl.match("https")) newUrl %3D "https%3A%2F%2F"%2BnewUrl%3B%0A tryUnityUrl(newUrl)%3B%0A %7D)%0A%7D%0A%0Afunction isUnitySite(baseUrl%2Ccallback)%7B%0A %0A%7D%0A%0Afunction goSSO(baseUrl)%7B%0A var ssoUrl %3D baseUrl %2B "%2Fsso%2Fra-google"%3B%0A window.location %3D ssoUrl%0A%7D%0A%0Afunction jsLoader()%0A%7B%0A var o %3D this%3B%0A%0A %2F%2F simple unstopable repeat timer%2C when t%3D-1 means endless%2C when function f() returns true it can be stopped%0A o.timer %3D function(t%2C i%2C d%2C f%2C fend%2C b)%0A %7B%0A if( t %3D%3D -1 %7C%7C t > 0 )%0A %7B%0A setTimeout(function() %7B%0A b%3D(f()) %3F 1 %3A 0%3B%0A o.timer((b) %3F 0 %3A (t>0) %3F --t %3A t%2C i%2B((d) %3F d %3A 0)%2C d%2C f%2C fend%2Cb )%3B%0A %7D%2C (b %7C%7C i < 0) %3F 0.1 %3A i)%3B%0A %7D%0A else if(typeof fend %3D%3D %27function%27)%0A %7B%0A setTimeout(fend%2C 1)%3B%0A %7D%0A %7D%3B%0A%0A o.addEvent %3D function(el%2C eventName%2C eventFunc)%0A %7B%0A if(typeof el !%3D %27object%27)%0A %7B%0A return false%3B%0A %7D%0A%0A if(el.addEventListener)%0A %7B%0A el.addEventListener (eventName%2C eventFunc%2C false)%3B%0A return true%3B%0A %7D%0A%0A if(el.attachEvent)%0A %7B%0A el.attachEvent("on" %2B eventName%2C eventFunc)%3B%0A return true%3B%0A %7D%0A%0A return false%3B%0A %7D%3B%0A %2F%2F add script to dom%0A o.require %3D function(s%2C delay%2C baSync%2C fCallback%2C fErr)%0A %7B%0A var oo %3D document.createElement(%27script%27)%2C%0A oHead %3D document.getElementsByTagName(%27head%27)%5B0%5D%3B%0A if(!oHead)%0A %7B%0A return false%3B%0A %7D%0A%0A setTimeout( function() %7B%0A var f %3D (typeof fCallback %3D%3D %27function%27) %3F fCallback %3A function()%7B%7D%3B%0A fErr %3D (typeof fErr %3D%3D %27function%27) %3F fErr %3A function()%7B%0A alert(%27require%3A Cannot load resource -%27%2Bs)%3B%0A %7D%2C%0A fe %3D function()%7B%0A if(!oo.__es)%0A %7B%0A oo.__es %3D true%3B%0A oo.id %3D %27failed%27%3B%0A fErr(oo)%3B%0A %7D%0A %7D%3B%0A oo.onload %3D function() %7B%0A oo.id %3D %27loaded%27%3B%0A f(oo)%3B%0A %7D%3B%0A oo.type %3D %27text%2Fjavascript%27%3B%0A oo.async %3D (typeof baSync %3D%3D %27boolean%27) %3F baSync %3A false%3B%0A oo.charset %3D %27utf-8%27%3B%0A o.__es %3D false%3B%0A o.addEvent( oo%2C %27error%27%2C fe )%3B %2F%2F when supported%0A%0A %2F%2F when error event is not supported fall back to timer%0A o.timer(15%2C 1000%2C 0%2C function() %7B%0A return (oo.id %3D%3D %27loaded%27)%3B%0A %7D%2C function()%7B %0A if(oo.id !%3D %27loaded%27)%7B%0A fe()%3B%0A %7D%0A %7D)%3B%0A oo.src %3D s%3B%0A setTimeout(function() %7B%0A try%7B%0A oHead.appendChild(oo)%3B%0A %7Dcatch(e)%7B%0A fe()%3B%0A %7D%0A %7D%2C1)%3B %0A %7D%2C (typeof delay %3D%3D %27number%27) %3F delay %3A 1)%3B %0A return true%3B%0A %7D%3B%0A%7D%0A%0A%7D)()%3B%0A%0A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment