Some Pixels en / pt

Bugzilla and Attached Images

I hate Bugzilla... It's ugly, hard to use and has one of the the worst UI and UX that I know of. But the thing that annoys me most is when you have some image attached, you cannot open it. When you click at the link, it will download the image and then, you'll be able to open it.

I know that's configurable, and it's for a security reason, but this is the default behavior and most admins don't change it! So I've made this simple bookmarklet to solve the problem. Just create a bookmark for the link bellow and, when you open some bug, just click the link:

javascript:(function(){var d;var c=0;while(d=document.getElementById("c"+c)){var b=d.getElementsByTagName("a");for(i=0;i<b.length;i++){var a=b[i].href;if(a.indexOf("attachment.cgi")>-1&&a.indexOf("action=edit")==-1){d.innerHTML+='<img src="'+a+'"/><br/>'}}c++}})();

And if you are interested in the simple unobfuscated code, here it is:

(function(){

    var commentDiv;
    var commentId = 0;

    while( commentDiv = document.getElementById("c" + commentId) ) {

        var links = commentDiv.getElementsByTagName("a");

        for ( i=0; i < links.length; i++ ) {

            var href = links[i].href;

            if( href.indexOf("attachment.cgi") > -1 && href.indexOf("action=edit") == -1 ) {
                commentDiv.innerHTML += "<img src=\"" + href + "\"/><br/>";
            }
        }

        commentId++;
    }

})();

Enjoy! ;)