Skip to content

Instantly share code, notes, and snippets.

@cacheflowe
Created February 28, 2016 02:08
Show Gist options
  • Save cacheflowe/323a74aad892542fdd9d to your computer and use it in GitHub Desktop.
Save cacheflowe/323a74aad892542fdd9d to your computer and use it in GitHub Desktop.
Download all .jpg attachments in an expanded gmail thread
var els = document.querySelectorAll('span[download_url]')
for(var i=0; i < els.length; i++){
(function(){
var attr = els[i].getAttribute('download_url');
if(attr.indexOf('jpg:https') != -1){
var url = 'https' + attr.split('jpg:https')[1];
setTimeout(function(){
document.location.href = url;
}, i * 1000)
}
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment