Created
April 22, 2012 20:59
-
-
Save humphd/2466896 to your computer and use it in GitHub Desktop.
Twitter Scramble
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
/** | |
* 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