Skip to content

Instantly share code, notes, and snippets.

@buzamahmooza
Last active January 24, 2018 11:03
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 buzamahmooza/518352f867c34074a61527f99a3147a9 to your computer and use it in GitHub Desktop.
Save buzamahmooza/518352f867c34074a61527f99a3147a9 to your computer and use it in GitHub Desktop.
Redirects you to Google images and searches for pictures of the text selection or the site URL. (If any text is selected )
q=(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);
location.href="https://www.google.com/search?&tbm=isch&q="+((typeof q!=='string'||q.length<1?("site:"+location.hostname):(''+q)).replace(/\s+/g,"+"));
console.log('q=', q);
void(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment