Skip to content

Instantly share code, notes, and snippets.

@moonhouse
Created February 18, 2017 22:57
Show Gist options
  • Select an option

  • Save moonhouse/bbdef918bffe44ecb86f2c59fa09df40 to your computer and use it in GitHub Desktop.

Select an option

Save moonhouse/bbdef918bffe44ecb86f2c59fa09df40 to your computer and use it in GitHub Desktop.
Blank Spot Project - Reverse background image search bookmarklet
javascript: var bg = jQuery('.novella-entry-mast-img').css('background-image'); if(bg===undefined) {bg = jQuery('.article-head').css('background-image');} if(bg===undefined) {bg = jQuery('img.wp-post-image')[0].src;} else {bg = bg.replace('url(','').replace(')','').replace(/\"/gi, "");} window.open('https://www.google.com/searchbyimage?image_url='+bg, '_blank');
@moonhouse

Copy link
Copy Markdown
Author

For a more general function the best way would be to find all background images, view thumbnails for all and let the user decide which to search for.

jQuery('[class]').filter(function() { return jQuery(this).css('background-image') !== undefined && jQuery(this).css('background-image') !== 'none'; } );

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