Skip to content

Instantly share code, notes, and snippets.

@NV
Created October 8, 2010 12:27
Show Gist options
  • Save NV/616701 to your computer and use it in GitHub Desktop.
Save NV/616701 to your computer and use it in GitHub Desktop.
UserJS: Bugzilla attachments preview
// ==UserScript==
// @name Bugzilla attachments preview
// @namespace http://userscripts.ru/js/bugzilla-attachments-preview/
// @include https://bugs.webkit.org/*
// @include https://bugzilla.mozilla.org/*
// @description Shows attached images
// @copyright 2010+, Nikita Vasilyev
// @version 1.0
// @licence MIT
// ==/UserScript==
[].forEach.call(document.querySelectorAll("#attachment_table .bz_attach_extra_info"), function(a){
if (a.textContent.indexOf("image/") > -1) {
var img = new Image();
img.style.display = "block";
img.src = a.previousElementSibling.href;
a.parentNode.insertBefore(img, a.parentNode.firstChild);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment