Last active
December 10, 2017 22:24
-
-
Save nucleartide/6db5a929376bb354cb5d98d0d78dab08 to your computer and use it in GitHub Desktop.
My Twitter theme color picker doesn't show, here's a workaround
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
/* | |
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