Skip to content

Instantly share code, notes, and snippets.

@ericclemmons
Created January 17, 2010 01:48
Show Gist options
  • Save ericclemmons/279143 to your computer and use it in GitHub Desktop.
Save ericclemmons/279143 to your computer and use it in GitHub Desktop.
Replace "Need some examples?" with actual examples
/*
Author: Eric Clemmons
Library: jQuery 1.3.2
When visiting "http://www.netflix.com/TastePreferences?lnkctr=wnph_sc_tst", I found myself
Clicking each "Click for example" link to better select my preference.
So, this script simply replaces that link with the first THREE suggested movie images.
Just Copy-Paste into Firebug & Run!
*/
jQuery('.taste-cat').find('a.ex-link').each(function(i, link) {
jQuery.ajax({
url: 'http://www.netflix.com/JSON/TasteCategoryExamples?size=small&verbose=true',
data: {
'tasteid': jQuery(this).attr('class').match(/ex-(\d+)$/)[1]
},
context: jQuery(link).parent(),
dataType: 'json',
success: function( response ) {
var images = jQuery( response.html ).find( 'img:lt(3)' );
jQuery( this.context ).empty().append( images.slice(0, 3) );
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment