Skip to content

Instantly share code, notes, and snippets.

@ameer
Last active February 21, 2018 17:12
Show Gist options
  • Save ameer/7e5b03021b37c39e7d2211a1a5b05e4d to your computer and use it in GitHub Desktop.
Save ameer/7e5b03021b37c39e7d2211a1a5b05e4d to your computer and use it in GitHub Desktop.
If you missed the Google view image button in image search, use the below snippet to get it back again.
document.querySelector('body').addEventListener('click', function(event) {
if (event.target.tagName.toLowerCase() === 'img' && event.target.className.toLowerCase() === 'irc_mi') {
open_image(event)
} else if(event.target.tagName.toLowerCase() === 'img' && event.target.className.toLowerCase().startsWith('irc_mut')){
event.preventDefault();
}
});
var open_image = function(event){event.preventDefault(); window.open(event.target.getAttribute("src"))}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment