Skip to content

Instantly share code, notes, and snippets.

@patik
Last active October 1, 2015 17:18
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 patik/2029861 to your computer and use it in GitHub Desktop.
Save patik/2029861 to your computer and use it in GitHub Desktop.
Twitter Avatar in Menu
// ==UserScript==
// @name Twitter Avatar in Menu
// @namespace http://patik.com/code/user-scripts/
// @include https://twitter.com/*
// @include http://twitter.com/*
// @version 2.1.20131118
// ==/UserScript==
(function _twitter_avatar_in_menu() {
// Find the generic 'person' outline in the nav bar, which will be replaced
var menuitem = document.querySelector('.nav-me') || null,
// Get avatar from the user menu (gear icon) to ensure we don't grab some other avatar
avi = document.querySelector('.global-nav .current-user .avatar[src]');
if (menuitem && avi.src) {
menuitem.style.cssText = 'background-image: url("' + avi.src + '") !important;background-position: 0 0;border-radius: 4px;background-size: 21px 22px;';
}
}());
@patik
Copy link
Author

patik commented Mar 13, 2012

Shows your avatar in the top menu on Twitter.com so you can tell at a glance which account you're logged in under.

Click on the 'raw' link in the top right of the gist to prompt Firefox & Chrome to install it as a user script.

Example

@patik
Copy link
Author

patik commented Nov 18, 2013

Updated to work with the current site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment