Skip to content

Instantly share code, notes, and snippets.

@nucleartide
Last active December 10, 2017 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nucleartide/6db5a929376bb354cb5d98d0d78dab08 to your computer and use it in GitHub Desktop.
Save nucleartide/6db5a929376bb354cb5d98d0d78dab08 to your computer and use it in GitHub Desktop.
My Twitter theme color picker doesn't show, here's a workaround
/*
To use,
Edit line 38-40 below with your desired Twitter theme color.
1. Go to your profile page.
2. Enter the code below into the console.
3. Click "Edit profile".
4. Make a one-character change in your Twitter bio.
5. Click "Save changes".
Your Twitter theme color should now be updated. For me however,
the color only shows for other users and in incognito mode.
You may also need to fix your Twitter bio afterward. (Spaces get
replaced with pluses.)
*/
var oldSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function(str) {
var pairs = str.split('&').reduce(function(obj, p) {
var [k, v] = p.split('=')
k = decodeURIComponent(k);
v = decodeURIComponent(v);
obj[k] = v;
return obj;
}, {});
var condition =
'authenticity_token' in pairs &&
pairs.page_context === 'me' &&
pairs.section_context === 'profile';
if (condition) {
pairs['user[profile_link_color]'] = '#34495E'; // nice dark blue color
pairs['user[profile_link_color]'] = '#4e2a8e'; // purple-y color
pairs['user[profile_link_color]'] = '#584b5e'; // another purple-y color
str = $.param(pairs);
alert(str);
oldSend.call(this, str);
} else {
oldSend.apply(this, arguments)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment