Skip to content

Instantly share code, notes, and snippets.

@jmikkola
Created May 14, 2014 21:37
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 jmikkola/cbf2bdda31fb52bde193 to your computer and use it in GitHub Desktop.
Save jmikkola/cbf2bdda31fb52bde193 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Fix gmail images
// @namespace fixGmailImages
// @match https://mail.google.com/*
// ==/UserScript==
//
(function() {
function fix() {
var images = document.getElementsByTagName('img');
for (var i = 0; i < images.length; i++) {
var src = images[i].src;
if (/.*googleusercontent.*#.*/.exec(src)) {
images[i].src = src.split(/#/)[1];
}
}
}
var G_KEY_CODE = 71;
document.addEventListener('keydown', function(e) {
if (e.keyCode == G_KEY_CODE && e.shiftKey && e.altKey && !e.ctrlKey && !e.metaKey) {
console.log('fixing images');
fix();
}
}, false);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment