Skip to content

Instantly share code, notes, and snippets.

@spite
Created February 20, 2018 18:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spite/94c5e6fe11e0ad7aff08821df132c2e6 to your computer and use it in GitHub Desktop.
Save spite/94c5e6fe11e0ad7aff08821df132c2e6 to your computer and use it in GitHub Desktop.
document.body.addEventListener('click', async e => {
if(e.srcElement && e.srcElement.classList.contains('irc_mi')) {
const downloadBtn = document.createElement( 'a' );
downloadBtn.setAttribute( 'target', '_blank' );
downloadBtn.setAttribute( 'href', e.srcElement.src );
downloadBtn.click();
e.preventDefault();
e.stopPropagation();
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment