Skip to content

Instantly share code, notes, and snippets.

@humphd
Created April 22, 2012 20:59
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 humphd/2466896 to your computer and use it in GitHub Desktop.
Save humphd/2466896 to your computer and use it in GitHub Desktop.
Twitter Scramble
/**
* Swap Twitter pictures, remove names from tweets in your twitter
* stream. The effect is often hilarious. Can you figure out who
* said what?
*
* Assumes you're running this bookmarklet from twitter.com.
*
* Quick hack, please improve as you see fit. @humphd
**/
(function() {
// Step 1: swap faces
var images=[];
$.each(
$( 'img.avatar.js-action-profile-avatar' ),
function( index, value ) { images.push( value.src ); }
);
$.each(
$( 'img.avatar.js-action-profile-avatar' ),
function( index, value ) {
value.src = images[ Math.floor( Math.random() * images.length ) ];
}
);
// Step 2: no names
$( 'strong.fullname.js-action-profile-name.show-popup-with-id' ).html( '' );
$( 'span.js-action-profile-name' ).html( '' );
})();
// Bookmarklet:
// javascript:(function(){var images=[]; $.each($('img.avatar.js-action-profile-avatar'), function(index, value) { images.push(value.src); });$.each($('img.avatar.js-action-profile-avatar'), function(index, value) { value.src = images[Math.floor(Math.random() * images.length)]; });$('strong.fullname.js-action-profile-name.show-popup-with-id').html('');$('span.js-action-profile-name').html(''); })();
// Or copy paste into console (Tools > Web Developer > Web Console) on twitter.com:
// (function(){var images=[]; $.each($('img.avatar.js-action-profile-avatar'), function(index, value) { images.push(value.src); });$.each($('img.avatar.js-action-profile-avatar'), function(index, value) { value.src = images[Math.floor(Math.random() * images.length)]; });$('strong.fullname.js-action-profile-name.show-popup-with-id').html('');$('span.js-action-profile-name').html(''); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment