show/hide this revision's text 1 [made Community Wiki]

Inline text-based attachments

Here's a script that allows you to embed text-based attachments directly into the case view based on the file extensions you specify:

name:        Inline text-based attachments
description: Inlines the specified attachments types directly into the bug view
author:      Dane Bertram
version:     1.0.0.0
minApi:      1.0

js: 

var inlineExtensions = ['txt', 'js'];

var regex = new RegExp('\\.(' + inlineExtensions.join('|') + ')$');
$('div.attachments a[href^=default.asp?pg=pgDownload]')
.filter(function(){ return regex.test($(this).attr('href')); }) // only the extensions we want inlined
.each(function(){
    var $anchor = $(this);
    $.get($anchor.attr('href'), function(data) {
        $('<pre>')
        .css({ 'max-height' : '200px', 'border' : '1px solid #C7C7C7' })
        .text(data)
        .appendTo($anchor.parent('p'));
    });
});